linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sricharan@codeaurora.org (Sricharan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V5 10/12] drivers: acpi: Configure acpi devices dma operation at probe time
Date: Fri, 20 Jan 2017 11:01:55 +0530	[thread overview]
Message-ID: <000001d272de$86fa4320$94eec960$@codeaurora.org> (raw)
In-Reply-To: <20170119164222.GA28483@red-moon>

Hi Lorenzo,

>On Thu, Jan 19, 2017 at 08:35:54PM +0530, Sricharan R wrote:
>> With all the DT based devices getting their dma ops configured
>> during probe time to have the right iommu setup, let us do the
>> same for acpi based devices as well.
>>
>> Configuring DMA ops at probe time will allow deferring device probe when
>> the IOMMU isn't available yet. The dma_configure for the device is
>> now called from the generic device_attach callback just before the
>> bus/driver probe is called. This way, configuring the DMA ops for the
>> device would be called at the same place for all bus_types, hence the
>> deferred probing mechanism should work for all buses as well.
>>
>> Signed-off-by: Sricharan R <sricharan@codeaurora.org>
>> ---
>>  * Removed the dma configuration for the pci devices in case of ACPI
>>    from pci_dma_configure which was hanging outside separately and
>>    doing it in dma_configure function itself.
>>
>>  drivers/acpi/glue.c        |  5 -----
>>  drivers/base/dma-mapping.c | 13 ++++++++++++-
>>  drivers/pci/probe.c        | 25 -------------------------
>>  3 files changed, 12 insertions(+), 31 deletions(-)
>>
>> diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
>> index fb19e1c..c05f241 100644
>> --- a/drivers/acpi/glue.c
>> +++ b/drivers/acpi/glue.c
>> @@ -176,7 +176,6 @@ int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev)
>>  	struct list_head *physnode_list;
>>  	unsigned int node_id;
>>  	int retval = -EINVAL;
>> -	enum dev_dma_attr attr;
>>
>>  	if (has_acpi_companion(dev)) {
>>  		if (acpi_dev) {
>> @@ -233,10 +232,6 @@ int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev)
>>  	if (!has_acpi_companion(dev))
>>  		ACPI_COMPANION_SET(dev, acpi_dev);
>>
>> -	attr = acpi_get_dma_attr(acpi_dev);
>> -	if (attr != DEV_DMA_NOT_SUPPORTED)
>> -		acpi_dma_configure(dev, attr);
>> -
>>  	acpi_physnode_link_name(physical_node_name, node_id);
>>  	retval = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
>>  				   physical_node_name);
>> diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c
>> index f82212c..294942d 100644
>> --- a/drivers/base/dma-mapping.c
>> +++ b/drivers/base/dma-mapping.c
>> @@ -7,6 +7,7 @@
>>   * This file is released under the GPLv2.
>>   */
>>
>> +#include <linux/acpi.h>
>>  #include <linux/dma-mapping.h>
>>  #include <linux/export.h>
>>  #include <linux/gfp.h>
>> @@ -352,6 +353,7 @@ int dma_configure(struct device *dev)
>>  {
>>  	struct device *_dev = dev;
>>  	int is_pci = dev_is_pci(dev);
>> +	enum dev_dma_attr attr;
>>  	int ret = 0;
>>
>>  	if (is_pci) {
>> @@ -361,8 +363,16 @@ int dma_configure(struct device *dev)
>>  			_dev = _dev->parent;
>>  	}
>>
>> -	if (_dev->of_node)
>> +	if (_dev->of_node) {
>>  		ret = of_dma_configure(dev, _dev->of_node);
>> +	} else if (has_acpi_companion(_dev)) {
>> +		attr = acpi_get_dma_attr(to_acpi_device_node(_dev->fwnode));
>> +
>> +		if (attr == DEV_DMA_NOT_SUPPORTED)
>> +			dev_warn(dev, "DMA not supported.\n");
>
>The changes you are making are correct but now this dev_warn spits hell
>for non-pci devices that do not support DMA (ie they do not have a _CCA
>on CONFIG_ACPI_CCA_REQUIRED systems), so you will have to remove it
>given that this path is now shared.
>

ok, will remove this WARN now.

Regards,
 Sricharan

  reply	other threads:[~2017-01-20  5:31 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-19 15:05 [PATCH V5 00/12] IOMMU probe deferral support Sricharan R
2017-01-19 15:05 ` [PATCH V5 01/12] iommu/of: Refactor of_iommu_configure() for error handling Sricharan R
2017-01-19 15:05 ` [PATCH V5 02/12] iommu/of: Prepare for deferred IOMMU configuration Sricharan R
2017-01-19 15:05 ` [PATCH V5 03/12] of: dma: Move range size workaround to of_dma_get_range() Sricharan R
2017-01-19 15:05 ` [PATCH V5 04/12] of: dma: Make of_dma_deconfigure() public Sricharan R
2017-01-19 15:05 ` [PATCH V5 05/12] drivers: platform: Configure dma operations at probe time Sricharan R
2017-01-19 16:48   ` Lorenzo Pieralisi
2017-01-20  5:34     ` Sricharan
2017-01-19 17:49   ` Robin Murphy
2017-01-19 19:02     ` Lorenzo Pieralisi
2017-01-20  6:25       ` Sricharan
2017-01-20  6:18     ` Sricharan
2017-01-19 15:05 ` [PATCH V5 06/12] iommu: of: Handle IOMMU lookup failure with deferred probing or error Sricharan R
2017-01-19 15:05 ` [PATCH V5 07/12] arm64: dma-mapping: Remove the notifier trick to handle early setting of dma_ops Sricharan R
2017-01-19 16:20   ` Will Deacon
2017-01-19 15:05 ` [PATCH V5 08/12] iommu/arm-smmu: Clean up early-probing workarounds Sricharan R
2017-01-19 16:18   ` Will Deacon
2017-01-20 19:20     ` Sricharan
2017-01-19 16:50   ` Lorenzo Pieralisi
2017-01-19 17:58     ` Robin Murphy
2017-01-20  6:32       ` Sricharan
2017-01-19 15:05 ` [PATCH V5 09/12] ACPI/IORT: Add function to check SMMUs drivers presence Sricharan R
2017-01-19 15:05 ` [PATCH V5 10/12] drivers: acpi: Configure acpi devices dma operation at probe time Sricharan R
2017-01-19 16:42   ` Lorenzo Pieralisi
2017-01-20  5:31     ` Sricharan [this message]
2017-01-19 15:05 ` [PATCH V5 11/12] drivers: acpi: Handle IOMMU lookup failure with deferred probing or error Sricharan R
2017-01-19 15:05 ` [PATCH V5 12/12] ACPI/IORT: Remove linker section for IORT entries probing Sricharan R

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='000001d272de$86fa4320$94eec960$@codeaurora.org' \
    --to=sricharan@codeaurora.org \
    --cc=linux-arm-kernel@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).