public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Luca Weiss" <luca.weiss@fairphone.com>, "Takashi Iwai" <tiwai@suse.de>
Cc: "Arnd Bergmann" <arnd@kernel.org>,
	"Mark Brown" <broonie@kernel.org>,
	"Wesley Cheng" <quic_wcheng@quicinc.com>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Dan Carpenter" <dan.carpenter@linaro.org>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] ALSA: qc_audio_offload: try to reduce address space confusion
Date: Fri, 05 Sep 2025 14:08:25 +0200	[thread overview]
Message-ID: <246834be-9e72-432e-86e4-e1c68262e710@app.fastmail.com> (raw)
In-Reply-To: <DCKUCB8A1JCV.1GK0TW2YMXNZP@fairphone.com>

On Fri, Sep 5, 2025, at 13:47, Luca Weiss wrote:
> On Fri Aug 1, 2025 at 2:49 PM CEST, Takashi Iwai wrote:
>> On Fri, 01 Aug 2025 14:35:27 +0200,
>>> On Fri Aug 1, 2025 at 2:31 PM CEST, Takashi Iwai wrote:
>>> > On Fri, 01 Aug 2025 13:31:42 +0200,
>>> >> On Tue May 13, 2025 at 2:34 PM CEST, Arnd Bergmann wrote:
>>> >> >
>>> >> > Make this more explicit by pulling the conversion out first
>>> >> > and warning if it is not part of the linear map, and using the
>>> >> > actual physical address to map into the iommu in place of the
>>> >> > dma address that may already be iommu-mapped into the usb host.
>>> >> 
>>> >> This patch is breaking USB audio offloading on Qualcomm devices on 6.16,
>>> >> as tested on sm6350 and sc7280-based smartphones.
>>> >> 
>>> >> Let me know if I can be of any help to resolve this.
>>> >
>>> > I guess just dropping WARN_ON() would help?
>>> >
>>> > As far as I read the code, pa argument isn't used at all in
>>> > uaudio_iommu_map() unless as sgt is NULL.  In this case, sgt is never
>>> > NULL, hence the pa argument is just a placeholder.
>>> > That said, the whole xfer_buf_pa (and its sanity check) can be dropped
>>> > there.
>>> 
>>> Just the WARN splat is not the problem, it's actually failing
>>> afterwards. Without the patch it works as expected.
>>
>> That is, replace WARN_ON() with 0.
>>
>> 	if (0 /*WARN_ON(!page_is_ram(PFN_DOWN(xfer_buf_pa)))*/) {
>> 		ret = -ENXIO;
>> 		goto unmap_sync;
>> 	}
>
> Yes, that appears to work fine as well. Playback works again.
>

This does mean that the address returned from xfer_buf is not
a kernel address in the virtual map though, and converting it
through virt_to_phys() makes the pa undefined for
uaudio_iommu_map(). Can you print what that pa value
is that you get here, and where that sits in the address space?

    Arnd

  reply	other threads:[~2025-09-05 12:08 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-13 12:34 [PATCH 0/3] ALSA: qc_audio_offload: address space cleanups Arnd Bergmann
2025-05-13 12:34 ` [PATCH 1/3] ALSA: qc_audio_offload: rename dma/iova/va/cpu/phys variables Arnd Bergmann
2025-05-13 12:34 ` [PATCH 2/3] ALSA: qc_audio_offload: avoid leaking xfer_buf allocation Arnd Bergmann
2025-05-13 12:34 ` [PATCH 3/3] ALSA: qc_audio_offload: try to reduce address space confusion Arnd Bergmann
2025-08-01 11:31   ` Luca Weiss
2025-08-01 12:31     ` Takashi Iwai
2025-08-01 12:35       ` Luca Weiss
2025-08-01 12:49         ` Takashi Iwai
2025-09-05 11:47           ` Luca Weiss
2025-09-05 12:08             ` Arnd Bergmann [this message]
2025-09-05 13:17               ` Luca Weiss
2025-09-05 14:50                 ` Arnd Bergmann
2025-09-05 12:26             ` Takashi Iwai
2025-09-05 14:54               ` Arnd Bergmann
2025-09-05 14:57                 ` Takashi Iwai
2025-09-16  8:41                 ` Luca Weiss
2025-09-16 16:09                   ` Takashi Iwai
2025-09-17  8:19                     ` Luca Weiss
2025-09-17  8:30                       ` Takashi Iwai
2025-09-17 12:27                         ` Luca Weiss
2025-09-17 12:35                           ` Takashi Iwai
2025-09-17 12:52                         ` Arnd Bergmann
2025-09-17 13:12                           ` Takashi Iwai
2025-05-14  9:01 ` [PATCH 0/3] ALSA: qc_audio_offload: address space cleanups Takashi Iwai
2025-05-21 12:33   ` Greg Kroah-Hartman

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=246834be-9e72-432e-86e4-e1c68262e710@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=broonie@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=luca.weiss@fairphone.com \
    --cc=perex@perex.cz \
    --cc=quic_wcheng@quicinc.com \
    --cc=tiwai@suse.com \
    --cc=tiwai@suse.de \
    /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