From patchwork Thu Oct 17 13:05:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Neronin X-Patchwork-Id: 13839994 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5C031D5164 for ; Thu, 17 Oct 2024 13:07:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729170446; cv=none; b=q4O96LrFu1Rw/r8x0MYlHzXOmUC6FQSl9ZxGC7vxuqDOr8WHTW90sp29GvCRLqa6C2n++/JPNGLV1OYKQRMcazNu0YLMBQ7aQr7kKiNOkhslfZXJ4x3mqWTh1xImrdm+Xkg+OlNCBL2a4sRqtsBQ/YEoBeSf6L6h/0APEiB6+Yo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729170446; c=relaxed/simple; bh=76Tyambl8b0QMiunD8bMa8r2+VTQE+bWWloJ2GJzv5Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Wp1eMU+aSNnJOwIn9z06lQss8NsXTXUSZc4kzvR6iq8jju3+K4iFeZ2bW9i8oHh/nRIOY9tlfiY9M6TVeLVj7K0HYkRX/PSDeBVOgwcQLfxpdf3TiT74CiPTfl9Cltt53GTbFHqTiSx1UOXV4r4WHJHXYQnsoE9SPaNYoVFbjO4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=DPyTyjBK; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="DPyTyjBK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729170441; x=1760706441; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=76Tyambl8b0QMiunD8bMa8r2+VTQE+bWWloJ2GJzv5Y=; b=DPyTyjBKQHsK7C8BuUydygtwwasjkkp2UeZCYefqB4nIvkI6TedcA7wh l7gLau0+Jl3bTiTu3sJaBHgID5wr2gOY0SQO3/fa/LT0EqsZqf9ehsuNn IjW9gatyVT0Ux51FJ4l2bA0yGEU2Lya5EZDDNZ6K5Q5fXqyRl4eYMdbTH 0yHtiWOy1fK3aZpw0AbKx7yVyTnXKRfOW/oFuF7X2yPnkIMTFTu0VdaQc tecG8IcIS8smLaZgI/0nUWtXap+RXd2yInTbjaZ+15g2W2W8p3Qak4/HM OA+apOlprscfHFvvNuOgjUaXksmFJrZgtlfc/kzXva3F2UtJC2kj9edEa A==; X-CSE-ConnectionGUID: oRXhAINbRTqJ1F5hjgegxQ== X-CSE-MsgGUID: DEinJjMAQKKwAD8hpIEPpw== X-IronPort-AV: E=McAfee;i="6700,10204,11227"; a="39290386" X-IronPort-AV: E=Sophos;i="6.11,210,1725346800"; d="scan'208";a="39290386" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2024 06:07:20 -0700 X-CSE-ConnectionGUID: AMLqehXXTDW22xSQSODU1Q== X-CSE-MsgGUID: 6HoSdWR+SVmUs9w+zPTdHQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,210,1725346800"; d="scan'208";a="78882296" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa010.fm.intel.com with ESMTP; 17 Oct 2024 06:07:19 -0700 Received: by black.fi.intel.com (Postfix, from userid 1058) id A62BC256; Thu, 17 Oct 2024 16:07:17 +0300 (EEST) From: Niklas Neronin To: mathias.nyman@linux.intel.com Cc: linux-usb@vger.kernel.org, Niklas Neronin Subject: [PATCH 1/8] usb: xhci: simplify TDs start and end naming scheme in struct 'xhci_td' Date: Thu, 17 Oct 2024 16:05:01 +0300 Message-ID: <20241017130508.1293021-2-niklas.neronin@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241017130508.1293021-1-niklas.neronin@linux.intel.com> References: <20241017130508.1293021-1-niklas.neronin@linux.intel.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Old names: * start_seg - last_trb_seg * start_trb - last_trb New names: * start_seg - end_seg * start_trb - end_trb A Transfer Descriptor (TD) in the xhci driver is a data structure that represents a single transaction to be performed by the USB host controller. This transaction is defined by TRBs from 'start_trb' in 'start_seg' to 'end_trb' in 'end_seg'. The terms "start" and "end" were chosen over "first" and "last" for ease of searching within the codebase. The ring structure uses 'first_seg' and 'last_seg', while the TD structure uses 'start_seg' and 'end_seg'. Signed-off-by: Niklas Neronin --- drivers/usb/host/xhci-ring.c | 68 ++++++++++++++++++------------------ drivers/usb/host/xhci.c | 2 +- drivers/usb/host/xhci.h | 6 ++-- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 72ea5b3af87a..a3e19fa4d2cc 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -660,8 +660,8 @@ static int xhci_move_dequeue_past_td(struct xhci_hcd *xhci, /* * We want to find the pointer, segment and cycle state of the new trb - * (the one after current TD's last_trb). We know the cycle state at - * hw_dequeue, so walk the ring until both hw_dequeue and last_trb are + * (the one after current TD's end_trb). We know the cycle state at + * hw_dequeue, so walk the ring until both hw_dequeue and end_trb are * found. */ do { @@ -671,7 +671,7 @@ static int xhci_move_dequeue_past_td(struct xhci_hcd *xhci, if (td_last_trb_found) break; } - if (new_deq == td->last_trb) + if (new_deq == td->end_trb) td_last_trb_found = true; if (cycle_found && trb_is_link(new_deq) && @@ -744,16 +744,16 @@ static void td_to_noop(struct xhci_hcd *xhci, struct xhci_ring *ep_ring, struct xhci_td *td, bool flip_cycle) { struct xhci_segment *seg = td->start_seg; - union xhci_trb *trb = td->first_trb; + union xhci_trb *trb = td->start_trb; while (1) { trb_to_noop(trb, TRB_TR_NOOP); /* flip cycle if asked to */ - if (flip_cycle && trb != td->first_trb && trb != td->last_trb) + if (flip_cycle && trb != td->start_trb && trb != td->end_trb) trb->generic.field[3] ^= cpu_to_le32(TRB_CYCLE); - if (trb == td->last_trb) + if (trb == td->end_trb) break; next_trb(&seg, &trb); @@ -978,7 +978,7 @@ static int xhci_invalidate_cancelled_tds(struct xhci_virt_ep *ep) xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, "Removing canceled TD starting at 0x%llx (dma) in stream %u URB %p", (unsigned long long)xhci_trb_virt_to_dma( - td->start_seg, td->first_trb), + td->start_seg, td->start_trb), td->urb->stream_id, td->urb); list_del_init(&td->td_list); ring = xhci_urb_to_transfer_ring(xhci, td->urb); @@ -2078,7 +2078,7 @@ struct xhci_segment *trb_in_td(struct xhci_hcd *xhci, struct xhci_td *td, dma_ad dma_addr_t end_trb_dma; struct xhci_segment *cur_seg; - start_dma = xhci_trb_virt_to_dma(td->start_seg, td->first_trb); + start_dma = xhci_trb_virt_to_dma(td->start_seg, td->start_trb); cur_seg = td->start_seg; do { @@ -2088,7 +2088,7 @@ struct xhci_segment *trb_in_td(struct xhci_hcd *xhci, struct xhci_td *td, dma_ad end_seg_dma = xhci_trb_virt_to_dma(cur_seg, &cur_seg->trbs[TRBS_PER_SEGMENT - 1]); /* If the end TRB isn't in this segment, this is set to 0 */ - end_trb_dma = xhci_trb_virt_to_dma(cur_seg, td->last_trb); + end_trb_dma = xhci_trb_virt_to_dma(cur_seg, td->end_trb); if (debug) xhci_warn(xhci, @@ -2230,7 +2230,7 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, !list_empty(&td->cancelled_td_list)) { xhci_dbg(xhci, "Already resolving halted ep for 0x%llx\n", (unsigned long long)xhci_trb_virt_to_dma( - td->start_seg, td->first_trb)); + td->start_seg, td->start_trb)); return 0; } /* endpoint not halted, don't reset it */ @@ -2262,8 +2262,8 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, } /* Update ring dequeue pointer */ - ep_ring->dequeue = td->last_trb; - ep_ring->deq_seg = td->last_trb_seg; + ep_ring->dequeue = td->end_trb; + ep_ring->deq_seg = td->end_seg; inc_deq(xhci, ep_ring); return xhci_td_cleanup(xhci, td, ep_ring, td->status); @@ -2273,7 +2273,7 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, static u32 sum_trb_lengths(struct xhci_td *td, union xhci_trb *stop_trb) { u32 sum; - union xhci_trb *trb = td->first_trb; + union xhci_trb *trb = td->start_trb; struct xhci_segment *seg = td->start_seg; for (sum = 0; trb != stop_trb; next_trb(&seg, &trb)) { @@ -2428,7 +2428,7 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, fallthrough; case COMP_ISOCH_BUFFER_OVERRUN: frame->status = -EOVERFLOW; - if (ep_trb != td->last_trb) + if (ep_trb != td->end_trb) td->error_mid_td = true; break; case COMP_INCOMPATIBLE_DEVICE_ERROR: @@ -2438,7 +2438,7 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, case COMP_USB_TRANSACTION_ERROR: frame->status = -EPROTO; sum_trbs_for_length = true; - if (ep_trb != td->last_trb) + if (ep_trb != td->end_trb) td->error_mid_td = true; break; case COMP_STOPPED: @@ -2474,7 +2474,7 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, finish_td: /* Don't give back TD yet if we encountered an error mid TD */ - if (td->error_mid_td && ep_trb != td->last_trb) { + if (td->error_mid_td && ep_trb != td->end_trb) { xhci_dbg(xhci, "Error mid isoc TD, wait for final completion event\n"); td->urb_length_set = true; return 0; @@ -2501,8 +2501,8 @@ static int skip_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, frame->actual_length = 0; /* Update ring dequeue pointer */ - ep->ring->dequeue = td->last_trb; - ep->ring->deq_seg = td->last_trb_seg; + ep->ring->dequeue = td->end_trb; + ep->ring->deq_seg = td->end_seg; inc_deq(xhci, ep->ring); return xhci_td_cleanup(xhci, td, ep->ring, status); @@ -2529,7 +2529,7 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, case COMP_SUCCESS: ep->err_count = 0; /* handle success with untransferred data as short packet */ - if (ep_trb != td->last_trb || remaining) { + if (ep_trb != td->end_trb || remaining) { xhci_warn(xhci, "WARN Successful completion on short TX\n"); xhci_dbg(xhci, "ep %#x - asked for %d bytes, %d bytes untransferred\n", td->urb->ep->desc.bEndpointAddress, @@ -2562,7 +2562,7 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, break; } - if (ep_trb == td->last_trb) + if (ep_trb == td->end_trb) td->urb->actual_length = requested - remaining; else td->urb->actual_length = @@ -2795,8 +2795,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, if (td && td->error_mid_td && !trb_in_td(xhci, td, ep_trb_dma, false)) { xhci_dbg(xhci, "Missing TD completion event after mid TD error\n"); - ep_ring->dequeue = td->last_trb; - ep_ring->deq_seg = td->last_trb_seg; + ep_ring->dequeue = td->end_trb; + ep_ring->deq_seg = td->end_seg; inc_deq(xhci, ep_ring); xhci_td_cleanup(xhci, td, ep_ring, td->status); } @@ -3308,7 +3308,7 @@ static int prepare_transfer(struct xhci_hcd *xhci, /* Add this TD to the tail of the endpoint ring's TD list */ list_add_tail(&td->td_list, &ep_ring->td_list); td->start_seg = ep_ring->enq_seg; - td->first_trb = ep_ring->enqueue; + td->start_trb = ep_ring->enqueue; return 0; } @@ -3647,8 +3647,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, field &= ~TRB_CHAIN; field |= TRB_IOC; more_trbs_coming = false; - td->last_trb = ring->enqueue; - td->last_trb_seg = ring->enq_seg; + td->end_trb = ring->enqueue; + td->end_seg = ring->enq_seg; if (xhci_urb_suitable_for_idt(urb)) { memcpy(&send_addr, urb->transfer_buffer, trb_buff_len); @@ -3696,8 +3696,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, ret = prepare_transfer(xhci, xhci->devs[slot_id], ep_index, urb->stream_id, 1, urb, 1, mem_flags); - urb_priv->td[1].last_trb = ring->enqueue; - urb_priv->td[1].last_trb_seg = ring->enq_seg; + urb_priv->td[1].end_trb = ring->enqueue; + urb_priv->td[1].end_seg = ring->enq_seg; field = TRB_TYPE(TRB_NORMAL) | ring->cycle_state | TRB_IOC; queue_trb(xhci, ring, 0, 0, 0, TRB_INTR_TARGET(0), field); } @@ -3821,8 +3821,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, } /* Save the DMA address of the last TRB in the TD */ - td->last_trb = ep_ring->enqueue; - td->last_trb_seg = ep_ring->enq_seg; + td->end_trb = ep_ring->enqueue; + td->end_seg = ep_ring->enq_seg; /* Queue status TRB - see Table 7 and sections 4.11.2.2 and 6.4.1.2.3 */ /* If the device sent data, the status stage is an OUT transfer */ @@ -4107,8 +4107,8 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, field |= TRB_CHAIN; } else { more_trbs_coming = false; - td->last_trb = ep_ring->enqueue; - td->last_trb_seg = ep_ring->enq_seg; + td->end_trb = ep_ring->enqueue; + td->end_seg = ep_ring->enq_seg; field |= TRB_IOC; if (trb_block_event_intr(xhci, num_tds, i, ir)) field |= TRB_BEI; @@ -4174,14 +4174,14 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, /* Use the first TD as a temporary variable to turn the TDs we've queued * into No-ops with a software-owned cycle bit. That way the hardware * won't accidentally start executing bogus TDs when we partially - * overwrite them. td->first_trb and td->start_seg are already set. + * overwrite them. td->start_trb and td->start_seg are already set. */ - urb_priv->td[0].last_trb = ep_ring->enqueue; + urb_priv->td[0].end_trb = ep_ring->enqueue; /* Every TRB except the first & last will have its cycle bit flipped. */ td_to_noop(xhci, ep_ring, &urb_priv->td[0], true); /* Reset the ring enqueue back to the first TRB and its cycle bit. */ - ep_ring->enqueue = urb_priv->td[0].first_trb; + ep_ring->enqueue = urb_priv->td[0].start_trb; ep_ring->enq_seg = urb_priv->td[0].start_seg; ep_ring->cycle_state = start_cycle; usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb); diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 63dc0056384a..4edd850e6328 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1752,7 +1752,7 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) urb->ep->desc.bEndpointAddress, (unsigned long long) xhci_trb_virt_to_dma( urb_priv->td[i].start_seg, - urb_priv->td[i].first_trb)); + urb_priv->td[i].start_trb)); for (; i < urb_priv->num_tds; i++) { td = &urb_priv->td[i]; diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index d18504ca7013..63bbee8b7760 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1294,9 +1294,9 @@ struct xhci_td { enum xhci_cancelled_td_status cancel_status; struct urb *urb; struct xhci_segment *start_seg; - union xhci_trb *first_trb; - union xhci_trb *last_trb; - struct xhci_segment *last_trb_seg; + union xhci_trb *start_trb; + struct xhci_segment *end_seg; + union xhci_trb *end_trb; struct xhci_segment *bounce_seg; /* actual_length of the URB has already been set */ bool urb_length_set; From patchwork Thu Oct 17 13:05:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Neronin X-Patchwork-Id: 13839992 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 159AB1DA112 for ; Thu, 17 Oct 2024 13:07:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729170445; cv=none; b=suhmLMFlm6xLdMH3T0LXTFP6gfUTQEG+O2jnsN52F9Ekku9pSvThX9OtHoWe1y9pkpkuiuQZmg75KrMPCy53Ut90vT+GOvHkA92Ci6zagRuFe5HkRy6erBV4IgX/VYydh6TUw1vESp5F4QaL5507rnsMutlQvFBNgCz6hWFaSLQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729170445; c=relaxed/simple; bh=PHY+ynLY4Pol3ilfxu0YZN9SWjBQw/9NqodcGpCdFfQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MJ6c5w8D6qaCD41/uz9vpQaKES8OtaeG1UY6rEc29nPHdrTnBn/QNopfiXjCJwuYL9UbTgwzZabvGApBq4lA7WAp/kH3YwA+EHRxOU5A/hwmL3a3nYsRRTZtv+t7S9MeFP/GRKUnvB198X+TfzyFnIO9d08eJ3uUBn44hZ7uJn4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=UataWYxO; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="UataWYxO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729170442; x=1760706442; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PHY+ynLY4Pol3ilfxu0YZN9SWjBQw/9NqodcGpCdFfQ=; b=UataWYxOdLrnoUjdr+FU37DCuuse/+Ypfkeya0XIuoDFdyUX0cYPFVij xgrB1PJxzy8HejG3ZeB26XKbinbuVHzGrW67Q3QpHT6q+dmZiP1rJ4Hgl 3wIwVvFO6FqdjchQ1sPtBNwxlRjWMiuffeC/2TfAJ4zOZaiMaKa41ob5+ 2LQfoPZix15ohvCExfr8T3VNffqup0gWl34T98Ko1kWvGMXwxpBbWfX91 s8dNAfJPuEh+tYN68nabkKpxUvYgQdPlceQWurjFLx4pEigmuiRCxIcI8 Hz8ZsX6E1bo7fL8tF3Wz5W1rOLOMCfXYF7M0k8VM1Jus+Ex/jQOcDRl3M Q==; X-CSE-ConnectionGUID: 1yJ4Ua08RKu0B25C1yE4OQ== X-CSE-MsgGUID: 68l5lSTuTkaYpGPBKc4+LQ== X-IronPort-AV: E=McAfee;i="6700,10204,11227"; a="39290389" X-IronPort-AV: E=Sophos;i="6.11,210,1725346800"; d="scan'208";a="39290389" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2024 06:07:21 -0700 X-CSE-ConnectionGUID: 9nzdVpSKS326X5TQRy3gxg== X-CSE-MsgGUID: YDy438w9RMC139wNejlcZQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,210,1725346800"; d="scan'208";a="78882302" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa010.fm.intel.com with ESMTP; 17 Oct 2024 06:07:20 -0700 Received: by black.fi.intel.com (Postfix, from userid 1058) id 5A3CD297; Thu, 17 Oct 2024 16:07:19 +0300 (EEST) From: Niklas Neronin To: mathias.nyman@linux.intel.com Cc: linux-usb@vger.kernel.org, Niklas Neronin Subject: [PATCH 2/8] usb: xhci: move link TRB quirk to xhci_gen_setup() Date: Thu, 17 Oct 2024 16:05:02 +0300 Message-ID: <20241017130508.1293021-3-niklas.neronin@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241017130508.1293021-1-niklas.neronin@linux.intel.com> References: <20241017130508.1293021-1-niklas.neronin@linux.intel.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This quirk is old and seldom seen, as a result the trace is changed to debug message and only printed when the quirk is set. Move it into xhci_gen_setup() where the majority of quirks are set. Signed-off-by: Niklas Neronin --- drivers/usb/host/xhci.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 4edd850e6328..62c2fd301456 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -473,14 +473,7 @@ static int xhci_init(struct usb_hcd *hcd) xhci_dbg_trace(xhci, trace_xhci_dbg_init, "xhci_init"); spin_lock_init(&xhci->lock); - if (xhci->hci_version == 0x95 && link_quirk) { - xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, - "QUIRK: Not clearing Link TRB chain bits."); - xhci->quirks |= XHCI_LINK_TRB_QUIRK; - } else { - xhci_dbg_trace(xhci, trace_xhci_dbg_init, - "xHCI doesn't need link TRB QUIRK"); - } + retval = xhci_mem_init(xhci, GFP_KERNEL); xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Finished xhci_init"); @@ -5247,6 +5240,11 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) if (xhci->hci_version > 0x96) xhci->quirks |= XHCI_SPURIOUS_SUCCESS; + if (xhci->hci_version == 0x95 && link_quirk) { + xhci_dbg(xhci, "QUIRK: Not clearing Link TRB chain bits"); + xhci->quirks |= XHCI_LINK_TRB_QUIRK; + } + /* Make sure the HC is halted. */ retval = xhci_halt(xhci); if (retval) From patchwork Thu Oct 17 13:05:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Neronin X-Patchwork-Id: 13839995 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E2C071DCB0F for ; Thu, 17 Oct 2024 13:07:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729170446; cv=none; b=kttvbWosndyMLPnXzstIKhczgmHyHJE/on026faLZabkKqRgxGxH+mJdSrH/4GCQ0Zslijmlw7svS+OUFElnhWlPXA+uxbRSYikbTPaIFhwfHEHJn+/+d0MIvWbdsdI9p4kLfcCJabZssQkZjPQa6Aqp3C4IdASEbIRFEDdFwm4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729170446; c=relaxed/simple; bh=z2n1FeYVq8UyncIcSDhkjFb0zHQYpdJ6y2NEf4GoqMU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Mw0+cNV77iClaWqYRWRepO5aiUAjsDhRehFxUa73gSQyfxXn++4J/2TqZF76d5CQrwLSAvgBIid+EvekZ5n8XnNFj/bD48CXtm+oc4OOTyQqrosf+GpncFRltSwQmbvCHESAURrBppUiEk55So6h5HMniERStP5lBoXLJ0ip64Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Rnp6Iw1B; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Rnp6Iw1B" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729170443; x=1760706443; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=z2n1FeYVq8UyncIcSDhkjFb0zHQYpdJ6y2NEf4GoqMU=; b=Rnp6Iw1BT69+Oi8GYon3qu2PqV6SKBDgIEyOEHHvf+17pR9dpIGcB24R qKWPucFAPgZciRYqeZ/qq5LuwJS1B2bKztqnjrSBzt7gFyeCxC3Gk+EI9 V2DorY9yoydrCFIaEG1iJ2mL9TxEAqhurCGFCmdMd4e/FWq2HvszTXeIO pSCSVLkFt20AQh3XQztCVBKlNVd/3m3OH5zIQt/3gpWOyU6SR3Zc8dA5i Pu5l78du8urxjCdO4qt+6xxmpxLOdOjEKBZPU6B0kSarZOSNQBeRvVyt8 BlHKF3PA7PsSL1V6ls/h+XIJO+tkjB3iKpJ40BLLd6o3ECpP8OIWSpVsr g==; X-CSE-ConnectionGUID: X6dJ0cncTSeNc35dajT+rw== X-CSE-MsgGUID: kthupZBKTCqr3Vz8UQK1dw== X-IronPort-AV: E=McAfee;i="6700,10204,11227"; a="32452108" X-IronPort-AV: E=Sophos;i="6.11,210,1725346800"; d="scan'208";a="32452108" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2024 06:07:22 -0700 X-CSE-ConnectionGUID: pJKfFqgBS66d9/pu4+RmUQ== X-CSE-MsgGUID: rH8tv2OQQz+5uw/7d39jXA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,210,1725346800"; d="scan'208";a="109354605" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa002.jf.intel.com with ESMTP; 17 Oct 2024 06:07:22 -0700 Received: by black.fi.intel.com (Postfix, from userid 1058) id 3B21E256; Thu, 17 Oct 2024 16:07:20 +0300 (EEST) From: Niklas Neronin To: mathias.nyman@linux.intel.com Cc: linux-usb@vger.kernel.org, Niklas Neronin Subject: [PATCH 3/8] usb: xhci: request MSI/-X according to requested amount Date: Thu, 17 Oct 2024 16:05:03 +0300 Message-ID: <20241017130508.1293021-4-niklas.neronin@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241017130508.1293021-1-niklas.neronin@linux.intel.com> References: <20241017130508.1293021-1-niklas.neronin@linux.intel.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Variable 'max_interrupts' contains the maximum supported interrupters or the maximum interrupters the user has requested. Thus, it should be used instead of HCS_MAX_INTRS(). User set 'max_interrupts' value is validated in xhci_gen_setup(), otherwise 'max_interrupts' value is 'HCS_MAX_INTRS(xhci->hcs_params1)'. Signed-off-by: Niklas Neronin --- drivers/usb/host/xhci-pci.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 295d3297ca3d..96bfd0897835 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -148,14 +148,11 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd) hcd->irq = 0; /* - * calculate number of MSI-X vectors supported. - * - HCS_MAX_INTRS: the max number of interrupts the host can handle, - * with max number of interrupters based on the xhci HCSPARAMS1. - * - num_online_cpus: maximum MSI-X vectors per CPUs core. - * Add additional 1 vector to ensure always available interrupt. + * Calculate number of MSI/MSI-X vectors supported. + * - max_interrupters: the max number of interrupts requested, capped to xhci HCSPARAMS1. + * - num_online_cpus: one vector per CPUs core, with at least one overall. */ - xhci->nvecs = min(num_online_cpus() + 1, - HCS_MAX_INTRS(xhci->hcs_params1)); + xhci->nvecs = min(num_online_cpus() + 1, xhci->max_interrupters); /* TODO: Check with MSI Soc for sysdev */ xhci->nvecs = pci_alloc_irq_vectors(pdev, 1, xhci->nvecs, From patchwork Thu Oct 17 13:05:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Neronin X-Patchwork-Id: 13839996 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 095701DD555 for ; Thu, 17 Oct 2024 13:07:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729170448; cv=none; b=Q0ENSE3BrSbE2ZnfF2+ZQeJlOF6eh9b9+Zj3uNwrWurkmNcIkiwSn5Vhha5drcjvoTikhWp8jgtFKWYt7CBl2yhhJAW0DimP/njvJVlmoSGUyqJU+thRz4rl0BZIhIl6nn0P51Ead2MPqG5HxlMUKxA2w4vXMTG63GUnORCmtRY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729170448; c=relaxed/simple; bh=lGuzb/ERQnaUKrGTzan8G/swae+p6maGTMxPIG81KS0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h1hl3j4bRfe8dI87LLii+4Ualb49aXzwPm8w2lF0yCkvR40Zq5yp8W2GU+3wc0lhVe6wlvtSghluh/s/YuDs7ecefeKmvxEhiiZR9752yzBMnbjRF5UE/eKWsoCM8byDbrm29Fw/5f0V5br2lRJSReflIx8tN3KJSnZUG1cc9VU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ZgRHxQFf; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZgRHxQFf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729170445; x=1760706445; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lGuzb/ERQnaUKrGTzan8G/swae+p6maGTMxPIG81KS0=; b=ZgRHxQFfgDgrAV5sY6tSA2mOYueZw5PHGLmm+2OhdI04UXDkG1rsDMBz ndZ/q5eBWiUSgEonmH64kzYaMPI8JLC7xnkwEC+mmzCiWMMH6blVq7gKe Gd4jc/5pecq49MP3uVMZT/pm9/BtRbppFZQDBlEzGiGIMgSzeVJXdgr+o 0lMtQz6YU1Hso81ht14/Cy+AX1NuwrPSYSHr+QVoLbR6rTw4DJKEJCv3e 7Jkp58jA9Tvy0TG4IcChGk4SGSWOi9QR99J6xZa4AnzSqMjXZS9kAihD6 mgfO+l3KEIekIpPz0guMTA+cxtUc1ilSmyksOmH+RKE2VY8FSs+7amIHI A==; X-CSE-ConnectionGUID: fGReWtTdQpuAfReo8xjhbg== X-CSE-MsgGUID: i7if6o2YRzKWsX+BTzt1+A== X-IronPort-AV: E=McAfee;i="6700,10204,11227"; a="32452109" X-IronPort-AV: E=Sophos;i="6.11,210,1725346800"; d="scan'208";a="32452109" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2024 06:07:23 -0700 X-CSE-ConnectionGUID: W05oOlW7S2i6f3ipNsQi0A== X-CSE-MsgGUID: SJB+99pBQj+06yEOHnKg0w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,210,1725346800"; d="scan'208";a="109354606" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa002.jf.intel.com with ESMTP; 17 Oct 2024 06:07:22 -0700 Received: by black.fi.intel.com (Postfix, from userid 1058) id E062736B; Thu, 17 Oct 2024 16:07:20 +0300 (EEST) From: Niklas Neronin To: mathias.nyman@linux.intel.com Cc: linux-usb@vger.kernel.org, Niklas Neronin Subject: [PATCH 4/8] usb: xhci: improve xhci_clear_command_ring() Date: Thu, 17 Oct 2024 16:05:04 +0300 Message-ID: <20241017130508.1293021-5-niklas.neronin@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241017130508.1293021-1-niklas.neronin@linux.intel.com> References: <20241017130508.1293021-1-niklas.neronin@linux.intel.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove redundant TRB cycle reset, the TRB cycle is already set to zero by the preceding memset(), making the explicit reset unnecessary. Clarify ring loop start point. Change the loop start from the dequeue segment to the start segment. Both approaches achieve the same result, but starting from the start segment makes it clearer that the entire ring is being zeroed out. Signed-off-by: Niklas Neronin --- drivers/usb/host/xhci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 62c2fd301456..52c304329f26 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -778,10 +778,8 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci) struct xhci_segment *seg; ring = xhci->cmd_ring; - xhci_for_each_ring_seg(ring->deq_seg, seg) { + xhci_for_each_ring_seg(ring->first_seg, seg) memset(seg->trbs, 0, sizeof(union xhci_trb) * (TRBS_PER_SEGMENT - 1)); - seg->trbs[TRBS_PER_SEGMENT - 1].link.control &= cpu_to_le32(~TRB_CYCLE); - } xhci_initialize_ring_info(ring); /* From patchwork Thu Oct 17 13:05:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Neronin X-Patchwork-Id: 13839993 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16F261DD53C for ; Thu, 17 Oct 2024 13:07:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729170445; cv=none; b=Ng2DkGj9Xs2Cos2EzrM9X9imZtaRTaWqfUDCsdAVSu7Cteu4p0lk/hNoLDPzPGTkfXymjqh3BPjRzMzCcPZUg/2LrAjYxTY/1JALLoUniDp7SXwEBtc5A6Qa1xJf5y78Hf+ALSYuIT+98Sodn0R3QVfXkBq7EbJmbxiGmOznsFA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729170445; c=relaxed/simple; bh=GMw7ih1Zn2jgo6wMvT89vPPt0ZrbW/5+JmhGvc8ULdc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gGbzzJk8CAWjgqCfZGHOyvZgzizqspx1prArA522i7MAtwwNYPNfhct/rKD9NpqlYECd4zJt2GRNSlLE73aIlS45URkPpVzlhuYCauQjL7UomoNxOJA2URCasU1tKRE2CcUWrYmZIWfSfEw3GO35e/QmwTObLiH9iS7+Perpa6w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WF78O0FP; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WF78O0FP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729170444; x=1760706444; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GMw7ih1Zn2jgo6wMvT89vPPt0ZrbW/5+JmhGvc8ULdc=; b=WF78O0FPzFjpfVkrwmtWPbAN7rhpfe5PnB7Nw++Pv40oIepZZARvjOVW g/cAEqIZgkvAm/cnS/5N50Vd9OoxQVQzIh8ueRph8ZHohqIdzf6InhN4I akw/rEX09ijr4v9wYZ8fZK9d8Y4xdXP+Vr2TblYwhVEXIELvZJ6Rvr6OD R6dJT34S1VmXg4t+fEmMy8WJd6NoeGkFPQeKkg/tjwXveYPAnPmeN5drB ryYvZ4htMEnpNk/2gXpRBTj7bBah7YcJE0DQp/5Npr5DSzwJl9C6gD4nI oFsHWG2aNiXyrOSrEN8mddnCr+cC/bWOM9R0f8z51v6Z7sZ1XgNZ+3kTI A==; X-CSE-ConnectionGUID: Jj+qHih0Seyjo07NOs7sPg== X-CSE-MsgGUID: thuTI0QgSCGqQLMClrisxg== X-IronPort-AV: E=McAfee;i="6700,10204,11227"; a="39290392" X-IronPort-AV: E=Sophos;i="6.11,210,1725346800"; d="scan'208";a="39290392" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2024 06:07:23 -0700 X-CSE-ConnectionGUID: FSBfYJsjTEW2xaC7PDDaMw== X-CSE-MsgGUID: XuHmYgdlQUKCDlNb7dN2PQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,210,1725346800"; d="scan'208";a="78882318" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa010.fm.intel.com with ESMTP; 17 Oct 2024 06:07:23 -0700 Received: by black.fi.intel.com (Postfix, from userid 1058) id 9F435297; Thu, 17 Oct 2024 16:07:21 +0300 (EEST) From: Niklas Neronin To: mathias.nyman@linux.intel.com Cc: linux-usb@vger.kernel.org, Niklas Neronin Subject: [PATCH 5/8] usb: xhci: remove unused arguments from td_to_noop() Date: Thu, 17 Oct 2024 16:05:05 +0300 Message-ID: <20241017130508.1293021-6-niklas.neronin@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241017130508.1293021-1-niklas.neronin@linux.intel.com> References: <20241017130508.1293021-1-niklas.neronin@linux.intel.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Function td_to_noop() does not utilize arguments 'xhci' and 'ep_ring'. These unused arguments are removed to clean up the code. Signed-off-by: Niklas Neronin --- drivers/usb/host/xhci-ring.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index a3e19fa4d2cc..e2e20ae424ad 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -740,8 +740,7 @@ static int xhci_move_dequeue_past_td(struct xhci_hcd *xhci, * (The last TRB actually points to the ring enqueue pointer, which is not part * of this TD.) This is used to remove partially enqueued isoc TDs from a ring. */ -static void td_to_noop(struct xhci_hcd *xhci, struct xhci_ring *ep_ring, - struct xhci_td *td, bool flip_cycle) +static void td_to_noop(struct xhci_td *td, bool flip_cycle) { struct xhci_segment *seg = td->start_seg; union xhci_trb *trb = td->start_trb; @@ -1020,16 +1019,16 @@ static int xhci_invalidate_cancelled_tds(struct xhci_virt_ep *ep) "Found multiple active URBs %p and %p in stream %u?\n", td->urb, cached_td->urb, td->urb->stream_id); - td_to_noop(xhci, ring, cached_td, false); + td_to_noop(cached_td, false); cached_td->cancel_status = TD_CLEARED; } - td_to_noop(xhci, ring, td, false); + td_to_noop(td, false); td->cancel_status = TD_CLEARING_CACHE; cached_td = td; break; } } else { - td_to_noop(xhci, ring, td, false); + td_to_noop(td, false); td->cancel_status = TD_CLEARED; } } @@ -1054,7 +1053,7 @@ static int xhci_invalidate_cancelled_tds(struct xhci_virt_ep *ep) continue; xhci_warn(xhci, "Failed to clear cancelled cached URB %p, mark clear anyway\n", td->urb); - td_to_noop(xhci, ring, td, false); + td_to_noop(td, false); td->cancel_status = TD_CLEARED; } } @@ -4178,7 +4177,7 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, */ urb_priv->td[0].end_trb = ep_ring->enqueue; /* Every TRB except the first & last will have its cycle bit flipped. */ - td_to_noop(xhci, ep_ring, &urb_priv->td[0], true); + td_to_noop(&urb_priv->td[0], true); /* Reset the ring enqueue back to the first TRB and its cycle bit. */ ep_ring->enqueue = urb_priv->td[0].start_trb; From patchwork Thu Oct 17 13:05:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Neronin X-Patchwork-Id: 13839999 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 309F61DDC23 for ; Thu, 17 Oct 2024 13:07:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729170449; cv=none; b=Bfl7v10yHCnilCai7L+MOQq+7BQMBv2foh/aKd0PCExYo9zgDuA0BmlLAHYPZMH6h1/J74GGRaGI/t4KSLkMle7gMGBLRFIkXXgCv7Ssz4XxmAEL49SShI6/npwvYynC4J/2e/+tjvFF1Vsf8eRcwBdWRen9BC7ZaYnXd/66EH8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729170449; c=relaxed/simple; bh=+yKwzp8zmeEWPUGogpPmzgX6GaQlsSAaDknlIJFpnUU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BKqEZG/VsrCRm5YpE4GaHxpOMFX5W8d8cHSH1ZAkHlSPtjIDG59gt44nIgpNeAU7FNqIF5GpBwKvo3lcQhu56v2x8yfYtZA91M10qa6OWEEGWPh68TMt4L1LsMLIT/1J5AC9E7FCRUGRvOnPPEvYFKdZo0C9E8dT9HSUGO5l2A0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Uvc+MswO; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Uvc+MswO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729170446; x=1760706446; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+yKwzp8zmeEWPUGogpPmzgX6GaQlsSAaDknlIJFpnUU=; b=Uvc+MswOiogyxc0d428NXQV2+5xqXzco/vd93YBmrpMJgbQNg3KGgj2R tMGPT/5d9QgQJdYlKYUpYOZ7nvw0hPeqSbX9V53eNz2QazFqXsv7rRhaQ nVzdrAFTnSoprD8YRrcER4TCcwzuTWqEQ6VzDKMqcrFh/mCnAv5pRLxcq TwFrQ3UAMhdN0Oh1T0cvCC7NE4K1AD0Jtw5hqyHyR9expiROT0oV1wWdu vySRas4HBuXfKEM0uyH0JYF7Co2EoRVnOl0wXqnCVYSnrsu13FUb1B8mq 9IoMpVSf2mjK9qwwI5A2+bzFvgxUG4vBtiROLVYgK1y2JhqZGiebmguJs Q==; X-CSE-ConnectionGUID: RI4X1te2RVOqCfN1+Pcygg== X-CSE-MsgGUID: klFI0tZ1TZ68mAsDzBjwpQ== X-IronPort-AV: E=McAfee;i="6700,10204,11227"; a="32452112" X-IronPort-AV: E=Sophos;i="6.11,210,1725346800"; d="scan'208";a="32452112" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2024 06:07:24 -0700 X-CSE-ConnectionGUID: Z0mKS/RHQ3Orh4BiBgELQA== X-CSE-MsgGUID: PoeRRwekSw+8JOqc5OH71g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,210,1725346800"; d="scan'208";a="109354610" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa002.jf.intel.com with ESMTP; 17 Oct 2024 06:07:23 -0700 Received: by black.fi.intel.com (Postfix, from userid 1058) id 46B3B3D2; Thu, 17 Oct 2024 16:07:22 +0300 (EEST) From: Niklas Neronin To: mathias.nyman@linux.intel.com Cc: linux-usb@vger.kernel.org, Niklas Neronin Subject: [PATCH 6/8] usb: xhci: refactor xhci_td_cleanup() to return void Date: Thu, 17 Oct 2024 16:05:06 +0300 Message-ID: <20241017130508.1293021-7-niklas.neronin@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241017130508.1293021-1-niklas.neronin@linux.intel.com> References: <20241017130508.1293021-1-niklas.neronin@linux.intel.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The function is modified to return 'void' instead of an integer since it invariably returns '0'. Additionally, multiple functions which only return xhci_td_cleanup() are also refactored to return void. This change eliminates the need for callers to handle a return value that does not convey meaningful information and improve code readability, as it becomes immediately clear that the function does not produce a significant output. Signed-off-by: Niklas Neronin --- drivers/usb/host/xhci-ring.c | 59 +++++++++++++++++------------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index e2e20ae424ad..13eadee89839 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -813,8 +813,8 @@ static void xhci_unmap_td_bounce_buffer(struct xhci_hcd *xhci, seg->bounce_offs = 0; } -static int xhci_td_cleanup(struct xhci_hcd *xhci, struct xhci_td *td, - struct xhci_ring *ep_ring, int status) +static void xhci_td_cleanup(struct xhci_hcd *xhci, struct xhci_td *td, + struct xhci_ring *ep_ring, int status) { struct urb *urb = NULL; @@ -857,8 +857,6 @@ static int xhci_td_cleanup(struct xhci_hcd *xhci, struct xhci_td *td, status = 0; xhci_giveback_urb_in_irq(xhci, td, status); } - - return 0; } @@ -2187,9 +2185,9 @@ int xhci_is_vendor_info_code(struct xhci_hcd *xhci, unsigned int trb_comp_code) return 0; } -static int finish_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, - struct xhci_ring *ep_ring, struct xhci_td *td, - u32 trb_comp_code) +static void finish_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, + struct xhci_ring *ep_ring, struct xhci_td *td, + u32 trb_comp_code) { struct xhci_ep_ctx *ep_ctx; @@ -2204,7 +2202,7 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, * stopped TDs. A stopped TD may be restarted, so don't update * the ring dequeue pointer or take this TD off any lists yet. */ - return 0; + return; case COMP_USB_TRANSACTION_ERROR: case COMP_BABBLE_DETECTED_ERROR: case COMP_SPLIT_TRANSACTION_ERROR: @@ -2230,7 +2228,7 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, xhci_dbg(xhci, "Already resolving halted ep for 0x%llx\n", (unsigned long long)xhci_trb_virt_to_dma( td->start_seg, td->start_trb)); - return 0; + return; } /* endpoint not halted, don't reset it */ break; @@ -2238,7 +2236,7 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, /* Almost same procedure as for STALL_ERROR below */ xhci_clear_hub_tt_buffer(xhci, td, ep); xhci_handle_halted_endpoint(xhci, ep, td, EP_HARD_RESET); - return 0; + return; case COMP_STALL_ERROR: /* * xhci internal endpoint state will go to a "halt" state for @@ -2255,7 +2253,7 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, xhci_handle_halted_endpoint(xhci, ep, td, EP_HARD_RESET); - return 0; /* xhci_handle_halted_endpoint marked td cancelled */ + return; /* xhci_handle_halted_endpoint marked td cancelled */ default: break; } @@ -2265,7 +2263,7 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, ep_ring->deq_seg = td->end_seg; inc_deq(xhci, ep_ring); - return xhci_td_cleanup(xhci, td, ep_ring, td->status); + xhci_td_cleanup(xhci, td, ep_ring, td->status); } /* sum trb lengths from the first trb up to stop_trb, _excluding_ stop_trb */ @@ -2285,9 +2283,9 @@ static u32 sum_trb_lengths(struct xhci_td *td, union xhci_trb *stop_trb) /* * Process control tds, update urb status and actual_length. */ -static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, - struct xhci_ring *ep_ring, struct xhci_td *td, - union xhci_trb *ep_trb, struct xhci_transfer_event *event) +static void process_ctrl_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, + struct xhci_ring *ep_ring, struct xhci_td *td, + union xhci_trb *ep_trb, struct xhci_transfer_event *event) { struct xhci_ep_ctx *ep_ctx; u32 trb_comp_code; @@ -2366,7 +2364,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, td->urb_length_set = true; td->urb->actual_length = requested - remaining; xhci_dbg(xhci, "Waiting for status stage event\n"); - return 0; + return; } /* at status stage */ @@ -2374,15 +2372,15 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, td->urb->actual_length = requested; finish_td: - return finish_td(xhci, ep, ep_ring, td, trb_comp_code); + finish_td(xhci, ep, ep_ring, td, trb_comp_code); } /* * Process isochronous tds, update urb packet status and actual_length. */ -static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, - struct xhci_ring *ep_ring, struct xhci_td *td, - union xhci_trb *ep_trb, struct xhci_transfer_event *event) +static void process_isoc_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, + struct xhci_ring *ep_ring, struct xhci_td *td, + union xhci_trb *ep_trb, struct xhci_transfer_event *event) { struct urb_priv *urb_priv; int idx; @@ -2476,14 +2474,13 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, if (td->error_mid_td && ep_trb != td->end_trb) { xhci_dbg(xhci, "Error mid isoc TD, wait for final completion event\n"); td->urb_length_set = true; - return 0; + return; } - - return finish_td(xhci, ep, ep_ring, td, trb_comp_code); + finish_td(xhci, ep, ep_ring, td, trb_comp_code); } -static int skip_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, - struct xhci_virt_ep *ep, int status) +static void skip_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, + struct xhci_virt_ep *ep, int status) { struct urb_priv *urb_priv; struct usb_iso_packet_descriptor *frame; @@ -2504,15 +2501,15 @@ static int skip_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, ep->ring->deq_seg = td->end_seg; inc_deq(xhci, ep->ring); - return xhci_td_cleanup(xhci, td, ep->ring, status); + xhci_td_cleanup(xhci, td, ep->ring, status); } /* * Process bulk and interrupt tds, update urb status and actual_length. */ -static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, - struct xhci_ring *ep_ring, struct xhci_td *td, - union xhci_trb *ep_trb, struct xhci_transfer_event *event) +static void process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, + struct xhci_ring *ep_ring, struct xhci_td *td, + union xhci_trb *ep_trb, struct xhci_transfer_event *event) { struct xhci_slot_ctx *slot_ctx; u32 trb_comp_code; @@ -2555,7 +2552,7 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, td->status = 0; xhci_handle_halted_endpoint(xhci, ep, td, EP_SOFT_RESET); - return 0; + return; default: /* do nothing */ break; @@ -2574,7 +2571,7 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, td->urb->actual_length = 0; } - return finish_td(xhci, ep, ep_ring, td, trb_comp_code); + finish_td(xhci, ep, ep_ring, td, trb_comp_code); } /* Transfer events which don't point to a transfer TRB, see xhci 4.17.4 */ From patchwork Thu Oct 17 13:05:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Neronin X-Patchwork-Id: 13839998 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B1931DDC2B for ; Thu, 17 Oct 2024 13:07:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729170449; cv=none; b=heXGujvEFs4ivR58/DXAK+BOuTlshDUQVKwBAnCxdaQO63yqCtFIJAo92xkH31enK4jXSytvygKhe8iaKfjbhQpBkMGkjcsGgJ3OIO90iyRUrn3RPowvrf94/dn/9Xg3Uq3q1+TFEe9Mbv4pBVZF2NpB3ms/a7kF+JpKtvJhDC4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729170449; c=relaxed/simple; bh=V7gZE8pdZLR/373Jy6krcx30yqQ2G77xsfs5If+mI9A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bNNXfTtz1mJAmXFeqmV7adN4fvLfUJGHLDijlYAwHdXVUJW+3klmGvZYBrif1AsrzevT+ygASCFKI6Itq3smKtGkSRDSCrWynNun2Yvm4s1+cR6es34lZAk2cX7vIYx4XwhH3EyUuHOERXEjjOoN+/rIvdxG22gtoij18bddtxs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=RNtvM9xQ; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="RNtvM9xQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729170446; x=1760706446; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=V7gZE8pdZLR/373Jy6krcx30yqQ2G77xsfs5If+mI9A=; b=RNtvM9xQ1pu9IxnwRHBN+12hnlKxGt2DtqtBGg2HiMR2dY3JkkKAx0wQ fKo+4Mn/lYxTZSJ5YNc79WSJunJ4NLqCGqerh7buN2xP8HSCTOKs2HC1N IaDywZqJX9EF352uAUby+1zvy5Uu9K51IfNc7urBsV8pHJELxeEUyA9V6 PWyB2oq5H1077SJSKUtQxzkbIt/p+zMo8VXdfRDR/WQiaCToqmGIgY6xd golSchCISDsrzg963Q4d9/zdg1hkw/swM+2jA567ytEepvgyYBjMOC6S3 ozXUTJZBb41MR+RfWN9I/VG5d9QGl5t6aGKNH8qiLiHRwNiWzvaZKddn+ A==; X-CSE-ConnectionGUID: 1lzp6aaKR82bdzgEheBk7Q== X-CSE-MsgGUID: AwfQog0HTc2dDQCXhXSJXQ== X-IronPort-AV: E=McAfee;i="6700,10204,11227"; a="32452113" X-IronPort-AV: E=Sophos;i="6.11,210,1725346800"; d="scan'208";a="32452113" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2024 06:07:24 -0700 X-CSE-ConnectionGUID: HKqzuONbQe6Tpxqxglxo6A== X-CSE-MsgGUID: ybsyqkOpQDqKYCwZeEqQhQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,210,1725346800"; d="scan'208";a="109354611" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa002.jf.intel.com with ESMTP; 17 Oct 2024 06:07:24 -0700 Received: by black.fi.intel.com (Postfix, from userid 1058) id D7F58256; Thu, 17 Oct 2024 16:07:22 +0300 (EEST) From: Niklas Neronin To: mathias.nyman@linux.intel.com Cc: linux-usb@vger.kernel.org, Niklas Neronin Subject: [PATCH 7/8] usb: xhci: add help function xhci_dequeue_td() Date: Thu, 17 Oct 2024 16:05:07 +0300 Message-ID: <20241017130508.1293021-8-niklas.neronin@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241017130508.1293021-1-niklas.neronin@linux.intel.com> References: <20241017130508.1293021-1-niklas.neronin@linux.intel.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add xhci_dequeue_td() helper function to reduce code duplication. Function xhci_dequeue_td() advances the dequeue pointer past the specified Transfer Descriptor (TD) and releases the TD. Signed-off-by: Niklas Neronin --- drivers/usb/host/xhci-ring.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 13eadee89839..7221547683d8 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -859,6 +859,16 @@ static void xhci_td_cleanup(struct xhci_hcd *xhci, struct xhci_td *td, } } +/* Give back previous TD and move on to the next TD. */ +static void xhci_dequeue_td(struct xhci_hcd *xhci, struct xhci_td *td, struct xhci_ring *ring, + u32 status) +{ + ring->dequeue = td->end_trb; + ring->deq_seg = td->end_seg; + inc_deq(xhci, ring); + + xhci_td_cleanup(xhci, td, ring, status); +} /* Complete the cancelled URBs we unlinked from td_list. */ static void xhci_giveback_invalidated_tds(struct xhci_virt_ep *ep) @@ -2258,12 +2268,7 @@ static void finish_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, break; } - /* Update ring dequeue pointer */ - ep_ring->dequeue = td->end_trb; - ep_ring->deq_seg = td->end_seg; - inc_deq(xhci, ep_ring); - - xhci_td_cleanup(xhci, td, ep_ring, td->status); + xhci_dequeue_td(xhci, td, ep_ring, td->status); } /* sum trb lengths from the first trb up to stop_trb, _excluding_ stop_trb */ @@ -2496,12 +2501,7 @@ static void skip_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, /* calc actual length */ frame->actual_length = 0; - /* Update ring dequeue pointer */ - ep->ring->dequeue = td->end_trb; - ep->ring->deq_seg = td->end_seg; - inc_deq(xhci, ep->ring); - - xhci_td_cleanup(xhci, td, ep->ring, status); + xhci_dequeue_td(xhci, td, ep->ring, status); } /* @@ -2791,10 +2791,7 @@ static int handle_tx_event(struct xhci_hcd *xhci, if (td && td->error_mid_td && !trb_in_td(xhci, td, ep_trb_dma, false)) { xhci_dbg(xhci, "Missing TD completion event after mid TD error\n"); - ep_ring->dequeue = td->end_trb; - ep_ring->deq_seg = td->end_seg; - inc_deq(xhci, ep_ring); - xhci_td_cleanup(xhci, td, ep_ring, td->status); + xhci_dequeue_td(xhci, td, ep_ring, td->status); } if (list_empty(&ep_ring->td_list)) { From patchwork Thu Oct 17 13:05:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Neronin X-Patchwork-Id: 13839997 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F0791DDC02 for ; Thu, 17 Oct 2024 13:07:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729170449; cv=none; b=BE/jGHN59Rz4g2ObX+ukpHTuKJDOQdhSTNdPsWUWShGb+SQO+Ksn05NRLJMWFeSKnu7Nut4Zis9RCtkWfZBvi9mAf5o0Fgvj7dX0cg5/NG//B0a4vgPk+aUmo0+fUgwAarOOyvJ3nCMXXjX1kmxOVdmivtlsq+Lgmq4xhOnD8SY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729170449; c=relaxed/simple; bh=E1u77zsKj3wLAgWtxG/RaFxPoA1UvazYJzRnBY/vJso=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a4073XvA+Y52RkN2BJUYPrRrvMT1P45yNO2wi0/nHqCrHB1R8i4K0euTjKgwhQNLVTwcaiO5X4nOdtz5yJqTrxte8Lo8QcAeG5XTInGr8ywwxcznXKqarmbD26dWdnpF+O40Z3HX1pd11H5seyjSPtg53hwwmjD0mL8N76UvkUw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=gjfziLSf; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gjfziLSf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729170445; x=1760706445; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=E1u77zsKj3wLAgWtxG/RaFxPoA1UvazYJzRnBY/vJso=; b=gjfziLSfuOxzfxu6+dMZvpSO2m80vEeDM2HhOYVNtX/RrjvDPvcVDblZ trgty19xjXqlMf9QnCP6OsCkLHXpFjTjY2C1gKPVjJvMowYFMLypLx9ON rAht0YvIvvdOp2xnh7uiBtb4HYdFBBR8JepE55jHDkZp9rTuSVlf9poYR W3wtnMW0WBA0oUe3OxFf1MN3ajkTmEWsEkFj4NV/PX2En7c7q+PBML91c MN1jlbWkwekbWNbxhOEBj1H+/8MCLnwq4yitHuFQzF2N91nY83XD/gIRo JgMlkh4Km3mAXPttvLGrnBwE0EnvKXW+jOR8i/S73WQX6CCbxDZp6mmqh Q==; X-CSE-ConnectionGUID: qkPnKZYzSneab4maKHG4Pg== X-CSE-MsgGUID: vtvT4qG5Qd2JUKbQgyPCFA== X-IronPort-AV: E=McAfee;i="6700,10204,11227"; a="39290394" X-IronPort-AV: E=Sophos;i="6.11,210,1725346800"; d="scan'208";a="39290394" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2024 06:07:25 -0700 X-CSE-ConnectionGUID: yN1yel9aQCyt2BpaAZQcIQ== X-CSE-MsgGUID: CDU3QkHlSUGlPGpt+FY9Dg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,210,1725346800"; d="scan'208";a="78882324" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa010.fm.intel.com with ESMTP; 17 Oct 2024 06:07:24 -0700 Received: by black.fi.intel.com (Postfix, from userid 1058) id 9052536B; Thu, 17 Oct 2024 16:07:23 +0300 (EEST) From: Niklas Neronin To: mathias.nyman@linux.intel.com Cc: linux-usb@vger.kernel.org, Niklas Neronin Subject: [PATCH 8/8] usb: xhci: remove irrelevant comment Date: Thu, 17 Oct 2024 16:05:08 +0300 Message-ID: <20241017130508.1293021-9-niklas.neronin@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241017130508.1293021-1-niklas.neronin@linux.intel.com> References: <20241017130508.1293021-1-niklas.neronin@linux.intel.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The code which it is referencing does not exist in the same function, or the file for that matter. Since it was added [1], the Interrupter Moderation Interval can be changed within xhci addon, e.g. PCI xhci_pci_setup(). [1], commit 0ebbab374223 ("USB: xhci: Ring allocation and initialization.") Signed-off-by: Niklas Neronin --- drivers/usb/host/xhci-mem.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 4295e9a4de50..15db90c54a45 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -2512,11 +2512,6 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) ir->isoc_bei_interval = AVOID_BEI_INTERVAL_MAX; - /* - * XXX: Might need to set the Interrupter Moderation Register to - * something other than the default (~1ms minimum between interrupts). - * See section 5.5.1.2. - */ for (i = 0; i < MAX_HC_SLOTS; i++) xhci->devs[i] = NULL;