From: Baolu Lu <baolu.lu@linux.intel.com>
To: kobarity <kobarity@gmail.com>
Cc: "Aditya Garg" <gargaditya08@live.com>,
"Berkel Jörg" <joerg.berkel@bfh.ch>,
"Robin Murphy" <robin.murphy@arm.com>,
"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
"dmitry.torokhov@gmail.com" <dmitry.torokhov@gmail.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
"regressions@lists.linux.dev" <regressions@lists.linux.dev>,
"linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
"lukas@wunner.de" <lukas@wunner.de>,
"David Woodhouse" <dwmw2@infradead.org>,
"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
"Joerg Roedel" <joro@8bytes.org>, "Will Deacon" <will@kernel.org>
Subject: Re: [REGRESSION] applespi from 6.12 onwards
Date: Tue, 13 May 2025 09:37:33 +0800 [thread overview]
Message-ID: <5d760ba9-031f-469b-96e0-a171b7142f88@linux.intel.com> (raw)
In-Reply-To: <eke7v7q6vxai.wl-kobarity@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3251 bytes --]
On 5/12/25 20:16, kobarity wrote:
> Baolu Lu wrote:
>> On 5/11/25 21:31, kobarity wrote:
>>>
>>> Hi
>>>
>>> I'm also experiencing this problem on my MacBookPro14,3.
>>>
>>> Aditya Garg wrote:
>>>>
>>>> Hi Jörg
>>>>
>>>> Can you test the kernel here to see if this fixes your issue:
>>>>
>>>> https://github.com/t2linux/T2-Debian-and-Ubuntu-Kernel/actions/runs/14944200356
>>>>
>>>> Alternatively you can try compiling your own kernel with this patch:
>>>>
>>>> https://lore.kernel.org/all/0-v1-c26553717e90+65f-iommu_vtd_ss_wo_jgg@nvidia.com/
>>>
>>> As far as I have tried, this patch did not solve the problem.
>>>
>>> By bisecting, I found that this problem was introduced by commit
>>> 2031c469f816 ("iommu/vt-d: Add support for static identity domain").
>>> In fact, since this commit, it will panic at startup. This panic was
>>> fixed by commit 6e02a277f1db ("iommu/vt-d: Fix incorrect
>>> pci_for_each_dma_alias() for non-PCI devices"). So I applied commit
>>> 6e02a277f1db on commit 2031c469f816 and confirmed that the keyboard
>>> and touchpad is not working.
>>
>> Have you tried to apply commit 64f792981e35 ("iommu/vt-d: Remove device
>> comparison in context_setup_pass_through_cb")?
>
> Yes, I tried it on yesterday's master branch, including commit
> 64f792981e35.
>
> - Keyboard/Touchpad NOT working:
> - No patches
> - With patch in https://lore.kernel.org/all/0-v1-c26553717e90+65f-iommu_vtd_ss_wo_jgg@nvidia.com/
> - Keyboard/Touchpad working:
> - With my workaround patch
Okay, thanks! Can you please try below change? I also attached a diff
file in the attachment for your convenience.
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 49530d5d8c85..9a86ead8377d 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -1832,6 +1832,8 @@ static int dmar_domain_attach_device(struct
dmar_domain *domain,
if (ret)
goto out_block_translation;
+ info->domain_attached = true;
+
return 0;
out_block_translation:
@@ -3206,6 +3208,10 @@ void device_block_translation(struct device *dev)
struct intel_iommu *iommu = info->iommu;
unsigned long flags;
+ /* Device in DMA blocking state. Noting to do. */
+ if (!info->domain_attached)
+ return;
+
if (info->domain)
cache_tag_unassign_domain(info->domain, dev,
IOMMU_NO_PASID);
@@ -4302,6 +4308,9 @@ static int identity_domain_attach_dev(struct
iommu_domain *domain, struct device
else
ret = device_setup_pass_through(dev);
+ if (!ret)
+ info->domain_attached = true;
+
return ret;
}
diff --git a/drivers/iommu/intel/iommu.h b/drivers/iommu/intel/iommu.h
index cbfb8bb4c94a..3ddbcc603de2 100644
--- a/drivers/iommu/intel/iommu.h
+++ b/drivers/iommu/intel/iommu.h
@@ -774,6 +774,7 @@ struct device_domain_info {
u8 ats_supported:1;
u8 ats_enabled:1;
u8 dtlb_extra_inval:1; /* Quirk for devices need extra flush */
+ u8 domain_attached:1; /* Device has domain attached */
u8 ats_qdep;
unsigned int iopf_refcount;
struct device *dev; /* it's NULL for PCIe-to-PCI bridge */
Thanks,
baolu
[-- Attachment #2: diff.patch --]
[-- Type: text/x-patch, Size: 1422 bytes --]
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 49530d5d8c85..9a86ead8377d 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -1832,6 +1832,8 @@ static int dmar_domain_attach_device(struct dmar_domain *domain,
if (ret)
goto out_block_translation;
+ info->domain_attached = true;
+
return 0;
out_block_translation:
@@ -3206,6 +3208,10 @@ void device_block_translation(struct device *dev)
struct intel_iommu *iommu = info->iommu;
unsigned long flags;
+ /* Device in DMA blocking state. Noting to do. */
+ if (!info->domain_attached)
+ return;
+
if (info->domain)
cache_tag_unassign_domain(info->domain, dev, IOMMU_NO_PASID);
@@ -4302,6 +4308,9 @@ static int identity_domain_attach_dev(struct iommu_domain *domain, struct device
else
ret = device_setup_pass_through(dev);
+ if (!ret)
+ info->domain_attached = true;
+
return ret;
}
diff --git a/drivers/iommu/intel/iommu.h b/drivers/iommu/intel/iommu.h
index cbfb8bb4c94a..3ddbcc603de2 100644
--- a/drivers/iommu/intel/iommu.h
+++ b/drivers/iommu/intel/iommu.h
@@ -774,6 +774,7 @@ struct device_domain_info {
u8 ats_supported:1;
u8 ats_enabled:1;
u8 dtlb_extra_inval:1; /* Quirk for devices need extra flush */
+ u8 domain_attached:1; /* Device has domain attached */
u8 ats_qdep;
unsigned int iopf_refcount;
struct device *dev; /* it's NULL for PCIe-to-PCI bridge */
next prev parent reply other threads:[~2025-05-13 1:42 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 7:18 [REGRESSION] applespi from 6.12 onwards Berkel Jörg
2025-05-07 16:31 ` Aditya Garg
2025-05-07 20:24 ` Berkel Jörg
2025-05-07 17:07 ` Aditya Garg
2025-05-08 2:15 ` Baolu Lu
2025-05-08 6:22 ` Dmitry Torokhov
2025-05-08 11:00 ` Aditya Garg
2025-05-08 11:29 ` Robin Murphy
2025-05-08 12:54 ` Aditya Garg
2025-05-09 15:23 ` Berkel Jörg
2025-05-10 9:57 ` Aditya Garg
2025-05-11 13:31 ` kobarity
2025-05-12 5:12 ` Baolu Lu
2025-05-12 12:16 ` kobarity
2025-05-13 1:37 ` Baolu Lu [this message]
2025-05-13 12:08 ` kobarity
2025-05-14 3:39 ` Baolu Lu
2025-05-09 2:47 ` Baolu Lu
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=5d760ba9-031f-469b-96e0-a171b7142f88@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=dmitry.torokhov@gmail.com \
--cc=dwmw2@infradead.org \
--cc=gargaditya08@live.com \
--cc=iommu@lists.linux.dev \
--cc=joerg.berkel@bfh.ch \
--cc=joro@8bytes.org \
--cc=kobarity@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=regressions@lists.linux.dev \
--cc=robin.murphy@arm.com \
--cc=stable@vger.kernel.org \
--cc=will@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.