All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: <gregkh@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>,
	Mathias Nyman <mathias.nyman@linux.intel.com>
Subject: [PATCH 13/19] xhci: Simplify event ring dequeue pointer update for port change events
Date: Thu, 19 Oct 2023 13:29:18 +0300	[thread overview]
Message-ID: <20231019102924.2797346-14-mathias.nyman@linux.intel.com> (raw)
In-Reply-To: <20231019102924.2797346-1-mathias.nyman@linux.intel.com>

Increase the event ring dequeue pointer for port change events in the
same way as other event types. No need to handle it separately.

This only touches the driver side tracking of event ring dequeue.

Note: this does move forward the event ring dequeue increase for port
change events a bit.
Previously the dequeue was increased before temporarily dropping
the xhci lock while kicking roothub polling.
Now dequeue is increased after re-aquiring the lock.

This should not matter as event ring dequeue is not touched at all by
hub thread. It's only touched in xhci interrupt handler.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---
 drivers/usb/host/xhci-ring.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 7aa6f132835b..73057f01e4aa 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1879,7 +1879,6 @@ static void handle_port_status(struct xhci_hcd *xhci,
 	if ((port_id <= 0) || (port_id > max_ports)) {
 		xhci_warn(xhci, "Port change event with invalid port ID %d\n",
 			  port_id);
-		inc_deq(xhci, ir->event_ring);
 		return;
 	}
 
@@ -2007,8 +2006,6 @@ static void handle_port_status(struct xhci_hcd *xhci,
 	}
 
 cleanup:
-	/* Update event ring dequeue pointer before dropping the lock */
-	inc_deq(xhci, ir->event_ring);
 
 	/* Don't make the USB core poll the roothub if we got a bad port status
 	 * change event.  Besides, at that point we can't tell which roothub
@@ -2915,7 +2912,6 @@ static int handle_tx_event(struct xhci_hcd *xhci,
 static int xhci_handle_event(struct xhci_hcd *xhci, struct xhci_interrupter *ir)
 {
 	union xhci_trb *event;
-	int update_ptrs = 1;
 	u32 trb_type;
 
 	/* Event ring hasn't been allocated yet. */
@@ -2946,7 +2942,6 @@ static int xhci_handle_event(struct xhci_hcd *xhci, struct xhci_interrupter *ir)
 		break;
 	case TRB_PORT_STATUS:
 		handle_port_status(xhci, ir, event);
-		update_ptrs = 0;
 		break;
 	case TRB_TRANSFER:
 		handle_tx_event(xhci, ir, &event->trans_event);
@@ -2969,9 +2964,8 @@ static int xhci_handle_event(struct xhci_hcd *xhci, struct xhci_interrupter *ir)
 		return 0;
 	}
 
-	if (update_ptrs)
-		/* Update SW event ring dequeue pointer */
-		inc_deq(xhci, ir->event_ring);
+	/* Update SW event ring dequeue pointer */
+	inc_deq(xhci, ir->event_ring);
 
 	/* Are there more items on the event ring?  Caller will call us again to
 	 * check.
-- 
2.25.1


  parent reply	other threads:[~2023-10-19 10:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19 10:29 [PATCH 00/19] xhci features for usb-next Mathias Nyman
2023-10-19 10:29 ` [PATCH 01/19] xhci: pass port structure to tracing instead of port number Mathias Nyman
2023-10-19 10:29 ` [PATCH 02/19] xhci: Add busnumber to port tracing Mathias Nyman
2023-10-19 10:29 ` [PATCH 03/19] xhci: expand next_trb() helper to support more ring types Mathias Nyman
2023-10-19 10:29 ` [PATCH 04/19] xhci: Set DESI bits in ERDP register correctly Mathias Nyman
2023-10-19 10:29 ` [PATCH 05/19] xhci: Use more than one Event Ring segment Mathias Nyman
2023-10-19 10:29 ` [PATCH 06/19] xhci: Adjust segment numbers after ring expansion Mathias Nyman
2023-10-19 10:29 ` [PATCH 07/19] xhci: Update last segment pointer after Event Ring expansion Mathias Nyman
2023-10-19 10:29 ` [PATCH 08/19] xhci: Expose segment numbers in debugfs Mathias Nyman
2023-10-19 10:29 ` [PATCH 09/19] xhci: Clean up ERST_PTR_MASK inversion Mathias Nyman
2023-10-19 10:29 ` [PATCH 10/19] xhci: Clean up stale comment on ERST_SIZE macro Mathias Nyman
2023-10-19 10:29 ` [PATCH 11/19] xhci: Clean up xhci_{alloc,free}_erst() declarations Mathias Nyman
2023-10-19 10:29 ` [PATCH 12/19] xhci: simplify event ring dequeue tracking for transfer events Mathias Nyman
2023-10-19 10:29 ` Mathias Nyman [this message]
2023-10-19 10:29 ` [PATCH 14/19] xhci: Loosen RPM as default policy to cover for AMD xHC 1.1 Mathias Nyman
2023-10-19 10:29 ` [PATCH 15/19] xhci: Enable RPM on controllers that support low-power states Mathias Nyman
2023-10-19 10:29 ` [PATCH 16/19] xhci: split free interrupter into separate remove and free parts Mathias Nyman
2023-10-19 10:29 ` [PATCH 17/19] usb: xhci: Implement xhci_handshake_check_state() helper Mathias Nyman
2023-10-19 10:29 ` [PATCH 18/19] usb: host: xhci-plat: fix possible kernel oops while resuming Mathias Nyman
2023-10-19 10:29 ` [PATCH 19/19] usb: host: xhci: Avoid XHCI resume delay if SSUSB device is not present Mathias Nyman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231019102924.2797346-14-mathias.nyman@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.