devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: "Wesley Cheng" <quic_wcheng@quicinc.com>,
	"Michał Pecio" <michal.pecio@gmail.com>
Cc: Thinh.Nguyen@synopsys.com, broonie@kernel.org,
	conor+dt@kernel.org, corbet@lwn.net, devicetree@vger.kernel.org,
	dmitry.torokhov@gmail.com, gregkh@linuxfoundation.org,
	krzk+dt@kernel.org, lgirdwood@gmail.com,
	linux-arm-msm@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-sound@vger.kernel.org, linux-usb@vger.kernel.org,
	mathias.nyman@intel.com, perex@perex.cz,
	pierre-louis.bossart@linux.intel.com, robh@kernel.org,
	srinivas.kandagatla@linaro.org, tiwai@suse.com
Subject: Re: [PATCH v32 01/32] usb: host: xhci: Repurpose event handler for skipping interrupter events
Date: Thu, 16 Jan 2025 17:15:23 +0200	[thread overview]
Message-ID: <45a40d3e-e534-4704-a928-cb36682133dc@linux.intel.com> (raw)
In-Reply-To: <5d5e9ba4-d544-416e-b57b-dc5c8692b737@quicinc.com>

On 14.1.2025 22.42, Wesley Cheng wrote:
> Hi Michal,
> 
> On 1/14/2025 6:08 AM, Michał Pecio wrote:
>> Thanks, I think I now see how this is meant to work.
>>
>>
>> Cover leter mostly discusses the ALSA side of things, but not low level
>> details of xHCI operation, such as who will be ringing doorbells and
>> how, handling IRQs, updating event ring dequeue, or handling halted EPs.
>>
>> So for the record, as far as I see:
>> 1. There is no API for ringing doorbells or even getting a pointer,
>>     the coprocessor needs to have its own access. Fair enough.
>> 2. Same for event ring dequeue, but the driver must clean up leftover
>>     unacknowledged events after sideband operation stops.
>> 3. Linux IRQ handler never needs to worry about sideband interrupts.
>> 4. Resetting halted endpoints is not implemented at all, I think?
>>     So this code is currently mostly useful with isochronous.
> 
> 
> Yep, all your points about the code with respects to the xHCI perspective is correct.
> 
> 
>>
>> And the 'skip_events' flag only exists to enable ring cleanup when the
>> interrupter is removed? In such case I think it's overkill.
>>
>> The code would be simpler and its intent more visible if 'skip_events'
>> were a new parameter of xhci_handle_events(). Existing IRQ would call
>> the function normally, while xhci_skip_sec_intr_events() would use the
>> new parameter to suppress event handling in this one special case.
>>
>> It would be immediately clear that skipping only applies on removal.
>>
>> You could completely get rid of PATCH 01/32 because 02/32 would no
>> longer need to set this flag on the interrupter, and the 'if' branch
>> adedd by 01/32 could go into 03/32 where it logically belongs.
>>
>> Just a suggestion. I simply don't see any need to have a flag which
>> causes events on a ring to always be skipped as a matter of policy.
>> Your code doesn't seem to require it. Probably nobody ever will.

Yes, this should works as well, and is maybe a bit cleaner than current
flag approach.

>>
> 
> In my previous discussions with Mathias, I think the plan was that he wanted it to be built in a way where we should be able to accommodate a use case where the secondary interrupter was going to be actually handled by the Linux side.  This is why the skip_events is populated/defined by the xHCI sideband calls, so that we can differentiate between the secondary interrupter use cases.  Although, it is the correct assumption that this series doesn't actually implement that functionality.
> 

Idea is to support xhci virtualization at some point, but also benefit from
moving noisy devices with a lot of events away from filling up the primary
event ring.

Once a usb device gets its own xhci secondary interrupter with a dedicated
event ring for transfer events, and its own MSI/MSI-X interrupt with dedicated
interrupt handler, it is easier to support xhci virtualization.

In short, support passing one USB device to a virtual machine client.

But this is out of scope for this series, so flag or parameter will do.

For this "vendor" sideband case we use the secondary interrupter to prevent
xCH controller from triggering interrupts for this device. CPU can
"sleep" while the audio chip reads and writes TRBs on transfer rings,
and  polls dedicated event ring for transfer events.

Thanks
-Mathias


  reply	other threads:[~2025-01-16 15:14 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-08  1:21 [PATCH v32 00/32] Introduce QC USB SND audio offloading support Wesley Cheng
2025-01-08  1:21 ` [PATCH v32 01/32] usb: host: xhci: Repurpose event handler for skipping interrupter events Wesley Cheng
2025-01-13 13:36   ` Michał Pecio
2025-01-13 23:27     ` Wesley Cheng
2025-01-14 14:08       ` Michał Pecio
2025-01-14 20:42         ` Wesley Cheng
2025-01-16 15:15           ` Mathias Nyman [this message]
2025-01-16 22:50             ` Wesley Cheng
2025-01-08  1:21 ` [PATCH v32 02/32] xhci: sideband: add initial api to register a secondary interrupter entity Wesley Cheng
2025-01-08 14:10   ` Mathias Nyman
2025-01-13 23:28     ` Wesley Cheng
2025-01-08  1:21 ` [PATCH v32 03/32] usb: host: xhci-mem: Cleanup pending secondary event ring events Wesley Cheng
2025-01-08  1:21 ` [PATCH v32 04/32] usb: host: xhci-mem: Allow for interrupter clients to choose specific index Wesley Cheng
2025-01-08  1:21 ` [PATCH v32 05/32] usb: host: xhci-plat: Set XHCI max interrupters if property is present Wesley Cheng
2025-01-08  1:21 ` [PATCH v32 06/32] usb: host: xhci: Notify xHCI sideband on transfer ring free Wesley Cheng
2025-01-08  1:21 ` [PATCH v32 07/32] usb: dwc3: Specify maximum number of XHCI interrupters Wesley Cheng
2025-01-08  1:21 ` [PATCH v32 08/32] ALSA: Add USB audio device jack type Wesley Cheng
2025-01-08  1:21 ` [PATCH v32 09/32] ALSA: usb-audio: Export USB SND APIs for modules Wesley Cheng
2025-01-08  1:21 ` [PATCH v32 10/32] ALSA: usb-audio: Check for support for requested audio format Wesley Cheng
2025-01-08  1:21 ` [PATCH v32 11/32] ALSA: usb-audio: Save UAC sample size information Wesley Cheng
2025-01-08  1:21 ` [PATCH v32 12/32] ALSA: usb-audio: Prevent starting of audio stream if in use Wesley Cheng
2025-01-08  1:21 ` [PATCH v32 13/32] ALSA: usb-audio: Introduce USB SND platform op callbacks Wesley Cheng
2025-01-08  1:21 ` [PATCH v32 14/32] ALSA: usb-audio: Allow for rediscovery of connected USB SND devices Wesley Cheng
2025-01-08  1:21 ` [PATCH v32 15/32] ASoC: Add SoC USB APIs for adding an USB backend Wesley Cheng
2025-01-08  1:21 ` [PATCH v32 16/32] ASoC: usb: Add PCM format check API for " Wesley Cheng
2025-01-08  1:21 ` [PATCH v32 17/32] ASoC: usb: Create SOC USB SND jack kcontrol Wesley Cheng
2025-01-08  1:21 ` [PATCH v32 18/32] ASoC: usb: Fetch ASoC card and pcm device information Wesley Cheng
2025-01-08  1:22 ` [PATCH v32 19/32] ASoC: usb: Rediscover USB SND devices on USB port add Wesley Cheng
2025-01-08  1:22 ` [PATCH v32 20/32] ASoC: doc: Add documentation for SOC USB Wesley Cheng
2025-01-08  1:22 ` [PATCH v32 21/32] ASoC: dt-bindings: qcom,q6dsp-lpass-ports: Add USB_RX port Wesley Cheng
2025-01-08  1:22 ` [PATCH v32 22/32] ASoC: dt-bindings: Update example for enabling USB offload on SM8250 Wesley Cheng
2025-01-08  1:22 ` [PATCH v32 23/32] ASoC: qcom: qdsp6: Introduce USB AFE port to q6dsp Wesley Cheng
2025-01-08  1:22 ` [PATCH v32 24/32] ASoC: qcom: qdsp6: q6afe: Increase APR timeout Wesley Cheng
2025-01-08  1:22 ` [PATCH v32 25/32] ASoC: qcom: qdsp6: Add USB backend ASoC driver for Q6 Wesley Cheng
2025-01-08  1:22 ` [PATCH v32 26/32] ASoC: qcom: qdsp6: Add headphone jack for offload connection status Wesley Cheng
2025-01-08  1:22 ` [PATCH v32 27/32] ASoC: qcom: qdsp6: Fetch USB offload mapped card and PCM device Wesley Cheng
2025-01-08  1:22 ` [PATCH v32 28/32] ALSA: usb-audio: qcom: Add USB QMI definitions Wesley Cheng
2025-01-08  1:22 ` [PATCH v32 29/32] ALSA: usb-audio: qcom: Introduce QC USB SND offloading support Wesley Cheng
2025-01-08  1:22 ` [PATCH v32 30/32] ALSA: usb-audio: qcom: Don't allow USB offload path if PCM device is in use Wesley Cheng
2025-01-08  1:22 ` [PATCH v32 31/32] ALSA: usb-audio: qcom: Add USB offload route kcontrol Wesley Cheng
2025-01-08  1:22 ` [PATCH v32 32/32] ALSA: usb-audio: qcom: Notify USB audio devices on USB offload probing Wesley Cheng

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=45a40d3e-e534-4704-a928-cb36682133dc@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=michal.pecio@gmail.com \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=quic_wcheng@quicinc.com \
    --cc=robh@kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=tiwai@suse.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).