linux-i3c.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
To: Frank Li <Frank.li@nxp.com>
Cc: linux-i3c@lists.infradead.org,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	"Prabhakaran, Krishna" <krishna.prabhakaran@intel.com>
Subject: Re: [PATCH 3/4] i3c: mipi-i3c-hci: Use physical device pointer with DMA API
Date: Mon, 4 Aug 2025 17:34:39 +0300	[thread overview]
Message-ID: <5aefebb0-f5d7-4169-be06-d334ee00913f@linux.intel.com> (raw)
In-Reply-To: <aIzlNOxl3R6LMczU@lizhi-Precision-Tower-5810>

On 8/1/25 7:03 PM, Frank Li wrote:
> On Thu, Jul 31, 2025 at 05:14:19PM +0300, Jarkko Nikula wrote:
>> @@ -194,11 +196,23 @@ static int hci_dma_init(struct i3c_hci *hci)
>>   {
>>   	struct hci_rings_data *rings;
>>   	struct hci_rh_data *rh;
>> +	struct device *sysdev;
>>   	u32 regval;
>>   	unsigned int i, nr_rings, xfers_sz, resps_sz;
>>   	unsigned int ibi_status_ring_sz, ibi_data_ring_sz;
>>   	int ret;
>>
>> +	/*
>> +	 * Set pointer to a physical device that does DMA and has IOMMU setup
>> +	 * done for it in case of enabled IOMMU and use it with the DMA API.
>> +	 * Here such device is either
>> +	 * "mipi-i3c-hci" platform device (OF/ACPI enumeration) parent or
>> +	 * grandparent (PCI enumeration).
>> +	 */
>> +	sysdev = hci->master.dev.parent;
>> +	if (sysdev->parent && dev_is_pci(sysdev->parent))
>> +		sysdev = sysdev->parent;
>> +
> 
> I am not clear about how i3c master controller device create in your
> platform. If use DT, i3c master controller should direct refer to a iommu
> 
> i3c-master@123456 {
> 	...
> 	iommu = <&smmu id>;
> }
> 
> Is it children device of a PCIe devices?
> 
The master.dev is a "virtual" device object created by 
i3c_master_register() and for that there is no IOMMU link obviously. 
Only this IOMMU exercise revealed we were wrongly using the master.dev 
with DMA API.

For the OF/ACPI enumeration the physical device is in pdev->dev in 
drivers/i3c/master/mipi-i3c-hci/core.c: i3c_hci_probe() and that is 
passed to the i3c_master_register() and can be references via 
hci->master.dev.parent here.

PCI code needs it's own module mipi-i3c-hci-pci.c due to each module can 
have only one module_driver(), i.e. module_platform_driver() and 
module_pci_driver() cannot reside in the same module.

mipi_i3c_hci_pci_probe() creates a "mipi-i3c-hci" platform device and 
sets physical device pointer pci->dev as its parent. So in PCI case the 
i3c_hci_probe() don't have the physical device pointer in its pdev->dev 
like OF/ACPI cases have but as a parent of it.

Not very clear but that's how drivers with multiple enumeration need to 
cope with.

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

  reply	other threads:[~2025-08-04 15:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31 14:14 [PATCH 1/4] i3c: master: Add helpers for DMA mapping and bounce buffer handling Jarkko Nikula
2025-07-31 14:14 ` [PATCH 2/4] i3c: mipi-i3c-hci: Use core helpers for DMA mapping and bounce buffering Jarkko Nikula
2025-08-01 14:41   ` Frank Li
2025-07-31 14:14 ` [PATCH 3/4] i3c: mipi-i3c-hci: Use physical device pointer with DMA API Jarkko Nikula
2025-08-01 16:03   ` Frank Li
2025-08-04 14:34     ` Jarkko Nikula [this message]
2025-08-05 15:57       ` Frank Li
2025-07-31 14:14 ` [PATCH 4/4] i3c: mipi-i3c-hci: Use own DMA bounce buffer management for I2C transfers Jarkko Nikula
2025-08-01 14:59   ` Frank Li
2025-08-01 14:54 ` [PATCH 1/4] i3c: master: Add helpers for DMA mapping and bounce buffer handling Frank Li
2025-08-04 13:35   ` Jarkko Nikula

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=5aefebb0-f5d7-4169-be06-d334ee00913f@linux.intel.com \
    --to=jarkko.nikula@linux.intel.com \
    --cc=Frank.li@nxp.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=krishna.prabhakaran@intel.com \
    --cc=linux-i3c@lists.infradead.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 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).