All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Hanjun Guo <hanjun.guo@linaro.org>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Will Deacon <will.deacon@arm.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Nate Watterson <nwatters@codeaurora.org>,
	Robert Moore <robert.moore@intel.com>, Feng Kan <fkan@apm.com>,
	Jon Masters <jcm@redhat.com>, Zhang Rui <rui.zhang@intel.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>
Subject: Re: [PATCH v2 5/5] ACPI/IORT: Add IORT named component memory address limits
Date: Tue, 1 Aug 2017 12:21:11 +0100	[thread overview]
Message-ID: <20170801112111.GA23348@red-moon> (raw)
In-Reply-To: <35b7d17a-7ab2-9b36-9482-33a7449691d2@linaro.org>

On Tue, Aug 01, 2017 at 06:20:43PM +0800, Hanjun Guo wrote:
> Hi Lorenzo,
> 
> On 2017/7/31 23:23, Lorenzo Pieralisi wrote:
> >IORT named components provide firmware configuration describing
> >how many address bits a given device is capable of generating
> >to address memory.
> >
> >Add code to the kernel to retrieve memory address limits
> >configuration for IORT named components and configure DMA masks
> >accordingly.
> >
> >Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> >Cc: Will Deacon <will.deacon@arm.com>
> >Cc: Robin Murphy <robin.murphy@arm.com>
> >Cc: Nate Watterson <nwatters@codeaurora.org>
> >---
> >  drivers/acpi/arm64/iort.c | 40 ++++++++++++++++++++++++++++++----------
> >  1 file changed, 30 insertions(+), 10 deletions(-)
> >
> >diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
> >index 67b85ae..b85d19f 100644
> >--- a/drivers/acpi/arm64/iort.c
> >+++ b/drivers/acpi/arm64/iort.c
> >@@ -680,6 +680,24 @@ static const struct iommu_ops *iort_iommu_xlate(struct device *dev,
> >  	return ret ? NULL : ops;
> >  }
> >+static int nc_dma_get_range(struct device *dev, u64 *size)
> >+{
> >+	struct acpi_iort_node *node;
> >+	struct acpi_iort_named_component *ncomp;
> >+
> >+	node = iort_scan_node(ACPI_IORT_NODE_NAMED_COMPONENT,
> >+			      iort_match_node_callback, dev);
> >+	if (!node)
> >+		return -ENODEV;
> >+
> >+	ncomp = (struct acpi_iort_named_component *)node->node_data;
> >+
> >+	*size = ncomp->memory_address_limit >= 64 ? ~0ULL :
> >+			1ULL<<ncomp->memory_address_limit;
> 
> Just a question here, if the IORT table didn't configure this
> value properly, will the device working properly? I'm asking this
> because in the table of IORT of D05, this value is set to 0 so far
> (SAS and network), but I can boot D05 OK with your patch set, not
> sure if any further issues.

Then you wonder why I wrote it as a separate patch. Why is that
value set to 0 (is that because that's the insane default ?) ?
It is a firmware bug and if things work ok with this patch applied
either this patch contains a bug or drivers override the DMA masks
to cancel out this patch effects.

Please fix the firmware.

Thanks,
Lorenzo

WARNING: multiple messages have this Message-ID (diff)
From: lorenzo.pieralisi@arm.com (Lorenzo Pieralisi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 5/5] ACPI/IORT: Add IORT named component memory address limits
Date: Tue, 1 Aug 2017 12:21:11 +0100	[thread overview]
Message-ID: <20170801112111.GA23348@red-moon> (raw)
In-Reply-To: <35b7d17a-7ab2-9b36-9482-33a7449691d2@linaro.org>

On Tue, Aug 01, 2017 at 06:20:43PM +0800, Hanjun Guo wrote:
> Hi Lorenzo,
> 
> On 2017/7/31 23:23, Lorenzo Pieralisi wrote:
> >IORT named components provide firmware configuration describing
> >how many address bits a given device is capable of generating
> >to address memory.
> >
> >Add code to the kernel to retrieve memory address limits
> >configuration for IORT named components and configure DMA masks
> >accordingly.
> >
> >Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> >Cc: Will Deacon <will.deacon@arm.com>
> >Cc: Robin Murphy <robin.murphy@arm.com>
> >Cc: Nate Watterson <nwatters@codeaurora.org>
> >---
> >  drivers/acpi/arm64/iort.c | 40 ++++++++++++++++++++++++++++++----------
> >  1 file changed, 30 insertions(+), 10 deletions(-)
> >
> >diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
> >index 67b85ae..b85d19f 100644
> >--- a/drivers/acpi/arm64/iort.c
> >+++ b/drivers/acpi/arm64/iort.c
> >@@ -680,6 +680,24 @@ static const struct iommu_ops *iort_iommu_xlate(struct device *dev,
> >  	return ret ? NULL : ops;
> >  }
> >+static int nc_dma_get_range(struct device *dev, u64 *size)
> >+{
> >+	struct acpi_iort_node *node;
> >+	struct acpi_iort_named_component *ncomp;
> >+
> >+	node = iort_scan_node(ACPI_IORT_NODE_NAMED_COMPONENT,
> >+			      iort_match_node_callback, dev);
> >+	if (!node)
> >+		return -ENODEV;
> >+
> >+	ncomp = (struct acpi_iort_named_component *)node->node_data;
> >+
> >+	*size = ncomp->memory_address_limit >= 64 ? ~0ULL :
> >+			1ULL<<ncomp->memory_address_limit;
> 
> Just a question here, if the IORT table didn't configure this
> value properly, will the device working properly? I'm asking this
> because in the table of IORT of D05, this value is set to 0 so far
> (SAS and network), but I can boot D05 OK with your patch set, not
> sure if any further issues.

Then you wonder why I wrote it as a separate patch. Why is that
value set to 0 (is that because that's the insane default ?) ?
It is a firmware bug and if things work ok with this patch applied
either this patch contains a bug or drivers override the DMA masks
to cancel out this patch effects.

Please fix the firmware.

Thanks,
Lorenzo

  reply	other threads:[~2017-08-01 11:21 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-31 15:23 [PATCH v2 0/5] ACPI: DMA ranges management Lorenzo Pieralisi
2017-07-31 15:23 ` Lorenzo Pieralisi
2017-07-31 15:23 ` [PATCH v2 1/5] ACPICA: resource_mgr: Allow _DMA method in walk resources Lorenzo Pieralisi
2017-07-31 15:23   ` Lorenzo Pieralisi
2017-07-31 15:23 ` [PATCH v2 2/5] ACPI: Make acpi_dev_get_resources() method agnostic Lorenzo Pieralisi
2017-07-31 15:23   ` Lorenzo Pieralisi
2017-07-31 15:23 ` [PATCH v2 3/5] ACPI: Introduce DMA ranges parsing Lorenzo Pieralisi
2017-07-31 15:23   ` Lorenzo Pieralisi
2017-07-31 15:23 ` [PATCH v2 4/5] ACPI: Make acpi_dma_configure() DMA regions aware Lorenzo Pieralisi
2017-07-31 15:23   ` Lorenzo Pieralisi
2017-07-31 15:23 ` [PATCH v2 5/5] ACPI/IORT: Add IORT named component memory address limits Lorenzo Pieralisi
2017-07-31 15:23   ` Lorenzo Pieralisi
2017-08-01 10:20   ` Hanjun Guo
2017-08-01 10:20     ` Hanjun Guo
2017-08-01 11:21     ` Lorenzo Pieralisi [this message]
2017-08-01 11:21       ` Lorenzo Pieralisi
2017-08-01 12:56       ` Hanjun Guo
2017-08-01 12:56         ` Hanjun Guo
2017-08-02 17:31   ` Nate Watterson
2017-08-02 17:31     ` Nate Watterson
2017-08-02 18:07     ` Lorenzo Pieralisi
2017-08-02 18:07       ` Lorenzo Pieralisi
2017-07-31 18:57 ` [PATCH v2 0/5] ACPI: DMA ranges management Rafael J. Wysocki
2017-07-31 18:57   ` Rafael J. Wysocki
2017-08-02 16:52   ` Lorenzo Pieralisi
2017-08-02 16:52     ` Lorenzo Pieralisi
2017-07-31 22:16 ` Feng Kan
2017-07-31 22:16   ` Feng Kan

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=20170801112111.GA23348@red-moon \
    --to=lorenzo.pieralisi@arm.com \
    --cc=fkan@apm.com \
    --cc=hanjun.guo@linaro.org \
    --cc=jcm@redhat.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nwatters@codeaurora.org \
    --cc=rjw@rjwysocki.net \
    --cc=robert.moore@intel.com \
    --cc=robin.murphy@arm.com \
    --cc=rui.zhang@intel.com \
    --cc=will.deacon@arm.com \
    /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.