Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ae5cc37 authored by Liangliang Lu's avatar Liangliang Lu
Browse files

sound: usb: use er_mapped flag to indicate event ring mapped or not



In the case that have two USB controller, xHCI address is different.
If we plug in one USB headset to one USB port, and play audio, when
another USB head plug into the 2rd USB port, there will be IOMMU
mapping error like below.

Fix this by use er_mapped flag instead of xHCI address to indicate
event ring mapped or not.

[<ffffff920b01cdec>] arm_lpae_init_pte.isra.11+0x4c/0xf0
[<ffffff920b01d21c>] __arm_lpae_map+0x38c/0x3a4
[<ffffff920b01cfa8>] __arm_lpae_map+0x118/0x3a4
[<ffffff920b01cfa8>] __arm_lpae_map+0x118/0x3a4
[<ffffff920b01d890>] arm_lpae_map+0x8c/0xa8
[<ffffff920b02785c>] arm_smmu_map+0x9c/0x134
[<ffffff920b01700c>] iommu_map+0xe8/0x2f0
[<ffffff920b8b9e94>] uaudio_iommu_map+0x27c/0x338
[<ffffff920b8ba600>] handle_uaudio_stream_req+0x608/0x1030
[<ffffff920b8bb0a4>] uaudio_qmi_svc_req_cb+0x7c/0xa4
[<ffffff920af81520>] qmi_recv_msg+0x23c/0x97c
[<ffffff920b8b9fc0>] uaudio_qmi_svc_recv_msg+0x70/0xa8
[<ffffff920aac7f4c>] process_one_work+0x1a8/0x4ac
[<ffffff920aac8390>] worker_thread+0x140/0x460
[<ffffff920aacf5c8>] kthread+0xf4/0x108
[<ffffff920aa83700>] ret_from_fork+0x10/0x50

Change-Id: Ibbb670d226fdfd6c2589996b8e4b406ab26e0e9a
Signed-off-by: default avatarLiangliang Lu <luliang@codeaurora.org>
parent 7d7c5b26
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -110,8 +110,8 @@ struct uaudio_qmi_dev {
	unsigned long curr_xfer_buf_iova;
	/* bit fields representing pcm card enabled */
	unsigned long card_slot;
	/* cache event ring phys addr */
	u64 er_phys_addr;
	/* indicate event ring mapped or not */
	bool er_mapped;
};

static struct uaudio_qmi_dev *uaudio_qdev;
@@ -295,7 +295,7 @@ static unsigned long uaudio_iommu_map(enum mem_type mtype, phys_addr_t pa,
	case MEM_EVENT_RING:
		va = IOVA_BASE;
		/* er already mapped */
		if (uaudio_qdev->er_phys_addr == pa)
		if (uaudio_qdev->er_mapped)
			map = false;
		break;
	case MEM_XFER_RING:
@@ -407,8 +407,8 @@ static void uaudio_iommu_unmap(enum mem_type mtype, unsigned long va,

	switch (mtype) {
	case MEM_EVENT_RING:
		if (uaudio_qdev->er_phys_addr)
			uaudio_qdev->er_phys_addr = 0;
		if (uaudio_qdev->er_mapped)
			uaudio_qdev->er_mapped = false;
		else
			unmap = false;
		break;
@@ -637,7 +637,7 @@ static int prepare_qmi_response(struct snd_usb_substream *subs,
						uaudio_qdev->sid);
	resp->xhci_mem_info.evt_ring.pa = dma;
	resp->xhci_mem_info.evt_ring.size = PAGE_SIZE;
	uaudio_qdev->er_phys_addr = xhci_pa;
	uaudio_qdev->er_mapped = true;

	resp->speed_info = get_speed_info(subs->dev->speed);
	if (resp->speed_info == USB_AUDIO_DEVICE_SPEED_INVALID_V01)