From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.17 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796154131; b=11MiDwJv5UtF+ndElx2VGjz7nrWehGHmU98nO8mQejVbHid+o7BaaMUXhzeJoz1UPUeD BsoAnDQQPITjJQjuF2R0qJR/Ekrh9jJWzWDoBon7OTeBHQs2P6DlBs3ESjncHlTpvvA6l ug9Iuv7vjKMEAC6W77A53HZ4nzUOlWWgS319B+YML32iyNOp4MkgsUgU3FFsKKowJqDv9 SssjLWozwdKQMuCr2JOmweqS7aDShm8oMnBSDIgJbRGYYVWGHtF/uZu0ap/dFdCo0eJ4r GxvqhOHojlEYhtGvDV7bXMHSuPh5WS/xHpku0DuJzNDwAqTTxNQl7rQy/05fRKSlUHQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796154131; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Received:From:To:Cc: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=UA1vmDSLXt68GClZ/wcqo1JNhAt1mAqYFt/Dt+NGMpU=; b=h/YtNtdWFA/zmKf4JtBU5jaQwwTlPwkqp32J0GhJVc/blkjKknBfV+CJcvYkT+cWxkSi NItjf/OH+KMCpyBgXvXtwph8k6kYU440btS1u85QBtAGkSvv+/mV483DWFI9Z3wJqZtkr IfKnSPJneu0Tv5N7ITmf+vQUKevpMQgyZLqTXTc+z5E+m+AwrPLfVMKQtI/W5c5D4ImRy aMXSCN1n2AhtEl/MjXiPWZvhum6JLhlJ1OgB2dZ/AoQP5qUH7Acj2blfGNy26END846ob +Xr16ghfhD9ZQiV+C8xYK0zGMqNdwVrLFnOBLVsAeCtv7cYTGcubOwSjXmIh0WBrXwA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=E6+FjJiQ; arc=none smtp.remote-ip=198.175.65.17 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3AEDC606A684 for ; Tue, 1 Dec 2026 19:42:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3AEDC606A684 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass 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.a=rsa-sha256 header.s=Intel header.b=E6+FjJiQ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796154130; x=1827690130; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UA1vmDSLXt68GClZ/wcqo1JNhAt1mAqYFt/Dt+NGMpU=; b=E6+FjJiQWjyurXYvwo7wcSyRRl39fpoT3jKR+F1yBvFab/9ecxZUk6iM 3OS5Uvcf4SuuK1dmL6l2kempsts6/B8mN1b62aVrtZe1eOvQIlWRaqH8a S2imOjSjT2Qg9ok7LA4Ng5aFTp4ssf5oxNa13fJfTTqafmezTsokWfI+t 5vk3xeSJcz7qULu++hThSrIq7tNnCfZWqNpfhlT/NZfojPtPe3OKMUNw5 ivOMQPSmfSgI8CnOnhGRCa+lQ3GgUbvihNqFPZebpu5GUsje2pcIwWNWo D8ZixIqihwonWvlSnyprSbs9AsFWl+3/zXVACcmt+ILlxAgI9Y5Zq+vcP g==; X-CSE-ConnectionGUID: seX6/bpbRZ+gR2JR2NSTcA== X-CSE-MsgGUID: u0s/O4zTTKm7mb3QUHi+pQ== X-IronPort-AV: E=McAfee;i="6800,10657,11983"; a="5049053" X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="5049053" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 11:42:10 -0800 X-CSE-ConnectionGUID: X3b4GTDST/aztWZVs6Z/ew== X-CSE-MsgGUID: rgWFKwIlS/CrkcdghLclaA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="13818661" Received: from black.igk.intel.com ([10.91.253.5]) by fmviesa001.fm.intel.com with ESMTP; 01 Dec 2026 11:42:09 -0800 Received: by black.igk.intel.com (Postfix, from userid 1058) id 8EB9198; Tue, 01 Dec 2026 20:42:02 +0100 (CET) From: Niklas Neronin To: mathias.nyman@linux.intel.com Cc: linux-usb@vger.kernel.org, Niklas Neronin Subject: [PATCH 2/7] usb: xhci: add xhci_queue_set_deq() helper Date: Tue, 1 Dec 2026 20:41:29 +0100 Message-ID: <20261201194134.265480-3-niklas.neronin@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20261201194134.265480-1-niklas.neronin@linux.intel.com> References: <20261201194134.265480-1-niklas.neronin@linux.intel.com> X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Most xHCI commands have dedicated xhci_queue_*() helper functions that encapsulate TRB construction and command queueing. The Set TR Dequeue Pointer command is currently assembled directly in xhci_move_deq_to_next_td(), making it the only command that bypasses this pattern. Add an xhci_queue_set_deq() helper and convert the existing user to it. This improves consistency with the other command queue helpers and keeps Set TR Dequeue Pointer TRB construction in a single location. No functional change intended. Signed-off-by: Niklas Neronin --- drivers/usb/host/xhci-ring.c | 21 +++++++++++++-------- drivers/usb/host/xhci.h | 3 +++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 53e1e9a59f14..7f983e8d4697 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -62,9 +62,6 @@ #include "xhci.h" #include "xhci-trace.h" -static int queue_command(struct xhci_hcd *xhci, struct xhci_command *cmd, - u32 field1, u32 field2, - u32 field3, u32 field4, bool command_must_succeed); static void xhci_kill_endpoint_urbs(struct xhci_hcd *xhci, int slot_id, int ep_index); /* @@ -755,11 +752,9 @@ static int xhci_move_deq_to_next_td(struct xhci_hcd *xhci, if (stream_id) trb_sct = SCT_FOR_TRB(SCT_PRI_TR); - ret = queue_command(xhci, cmd, - lower_32_bits(addr) | trb_sct | new_cycle, - upper_32_bits(addr), - STREAM_ID_FOR_TRB(stream_id), SLOT_ID_FOR_TRB(ep->vdev->slot_id) | - EP_INDEX_FOR_TRB(ep->ep_index) | TRB_TYPE(TRB_SET_DEQ), false); + + ret = xhci_queue_set_deq(xhci, cmd, addr, ep->vdev->slot_id, ep->ep_index, stream_id, + new_cycle, trb_sct); if (ret < 0) goto err_out; @@ -4541,3 +4536,13 @@ int xhci_queue_reset_ep(struct xhci_hcd *xhci, struct xhci_command *cmd, return queue_command(xhci, cmd, 0, 0, 0, trb_slot_id | trb_ep_index | type, false); } + +int xhci_queue_set_deq(struct xhci_hcd *xhci, struct xhci_command *cmd, dma_addr_t addr, + u32 slot_id, unsigned int ep_index, unsigned int stream_id, int new_cycle, + u32 trb_sct) +{ + return queue_command(xhci, cmd, lower_32_bits(addr) | trb_sct | new_cycle, + upper_32_bits(addr), STREAM_ID_FOR_TRB(stream_id), + SLOT_ID_FOR_TRB(slot_id) | EP_INDEX_FOR_TRB(ep_index) | + TRB_TYPE(TRB_SET_DEQ), false); +} diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index ec4bfeb4887c..852a6b537a60 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1950,6 +1950,9 @@ int xhci_queue_evaluate_context(struct xhci_hcd *xhci, struct xhci_command *cmd, int xhci_queue_reset_ep(struct xhci_hcd *xhci, struct xhci_command *cmd, int slot_id, unsigned int ep_index, enum xhci_ep_reset_type reset_type); +int xhci_queue_set_deq(struct xhci_hcd *xhci, struct xhci_command *cmd, dma_addr_t addr, + u32 slot_id, unsigned int ep_index, unsigned int stream_id, int new_cycle, + u32 trb_sct); int xhci_queue_reset_device(struct xhci_hcd *xhci, struct xhci_command *cmd, u32 slot_id); void xhci_handle_command_timeout(struct work_struct *work); -- 2.50.1