All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hanjun Guo <guohanjun@huawei.com>
To: Robin Murphy <robin.murphy@arm.com>,
	lorenzo.pieralisi@arm.com, sudeep.holla@arm.com,
	hanjun.guo@linaro.org
Cc: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] ACPI/IORT: Support address size limit for root complexes
Date: Fri, 20 Jul 2018 10:36:22 +0800	[thread overview]
Message-ID: <43f65aea-ee08-00d5-7cf2-0f14a7fc52d4@huawei.com> (raw)
In-Reply-To: <b52cdefb7a3f631340b98dcd38a274ae277bd561.1531239023.git.robin.murphy@arm.com>

On 2018/7/11 0:13, Robin Murphy wrote:
> IORT revision D allows PCI root complex nodes to specify a memory
> address size limit equivalently to named components, to help describe
> straightforward integrations which don't really warrant a full-blown
> _DMA method. Now that our headers are up-to-date, plumb it in.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  drivers/acpi/arm64/iort.c | 25 +++++++++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
> index 7a3a541046ed..4a66896e2aa3 100644
> --- a/drivers/acpi/arm64/iort.c
> +++ b/drivers/acpi/arm64/iort.c
> @@ -947,6 +947,24 @@ static int nc_dma_get_range(struct device *dev, u64 *size)
>  	return 0;
>  }
>  
> +static int rc_dma_get_range(struct device *dev, u64 *size)
> +{
> +	struct acpi_iort_node *node;
> +	struct acpi_iort_root_complex *rc;
> +
> +	node = iort_scan_node(ACPI_IORT_NODE_PCI_ROOT_COMPLEX,
> +			      iort_match_node_callback, dev);
> +	if (!node || node->revision < 1)
> +		return -ENODEV;
> +
> +	rc = (struct acpi_iort_root_complex *)node->node_data;
> +
> +	*size = rc->memory_address_limit >= 64 ? U64_MAX :
> +			1ULL<<rc->memory_address_limit;
> +
> +	return 0;
> +}
> +
>  /**
>   * iort_dma_setup() - Set-up device DMA parameters.
>   *
> @@ -975,10 +993,13 @@ void iort_dma_setup(struct device *dev, u64 *dma_addr, u64 *dma_size)
>  
>  	size = max(dev->coherent_dma_mask, dev->coherent_dma_mask + 1);
>  
> -	if (dev_is_pci(dev))
> +	if (dev_is_pci(dev)) {
>  		ret = acpi_dma_get_range(dev, &dmaaddr, &offset, &size);
> -	else
> +		if (ret == -ENODEV)
> +			ret = rc_dma_get_range(dev, &size);
> +	} else {
>  		ret = nc_dma_get_range(dev, &size);
> +	}
>  
>  	if (!ret) {
>  		msb = fls64(dmaaddr + size - 1);
> 

Looks good to me,

Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>

Thanks
Hanjun

WARNING: multiple messages have this Message-ID (diff)
From: guohanjun@huawei.com (Hanjun Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ACPI/IORT: Support address size limit for root complexes
Date: Fri, 20 Jul 2018 10:36:22 +0800	[thread overview]
Message-ID: <43f65aea-ee08-00d5-7cf2-0f14a7fc52d4@huawei.com> (raw)
In-Reply-To: <b52cdefb7a3f631340b98dcd38a274ae277bd561.1531239023.git.robin.murphy@arm.com>

On 2018/7/11 0:13, Robin Murphy wrote:
> IORT revision D allows PCI root complex nodes to specify a memory
> address size limit equivalently to named components, to help describe
> straightforward integrations which don't really warrant a full-blown
> _DMA method. Now that our headers are up-to-date, plumb it in.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  drivers/acpi/arm64/iort.c | 25 +++++++++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
> index 7a3a541046ed..4a66896e2aa3 100644
> --- a/drivers/acpi/arm64/iort.c
> +++ b/drivers/acpi/arm64/iort.c
> @@ -947,6 +947,24 @@ static int nc_dma_get_range(struct device *dev, u64 *size)
>  	return 0;
>  }
>  
> +static int rc_dma_get_range(struct device *dev, u64 *size)
> +{
> +	struct acpi_iort_node *node;
> +	struct acpi_iort_root_complex *rc;
> +
> +	node = iort_scan_node(ACPI_IORT_NODE_PCI_ROOT_COMPLEX,
> +			      iort_match_node_callback, dev);
> +	if (!node || node->revision < 1)
> +		return -ENODEV;
> +
> +	rc = (struct acpi_iort_root_complex *)node->node_data;
> +
> +	*size = rc->memory_address_limit >= 64 ? U64_MAX :
> +			1ULL<<rc->memory_address_limit;
> +
> +	return 0;
> +}
> +
>  /**
>   * iort_dma_setup() - Set-up device DMA parameters.
>   *
> @@ -975,10 +993,13 @@ void iort_dma_setup(struct device *dev, u64 *dma_addr, u64 *dma_size)
>  
>  	size = max(dev->coherent_dma_mask, dev->coherent_dma_mask + 1);
>  
> -	if (dev_is_pci(dev))
> +	if (dev_is_pci(dev)) {
>  		ret = acpi_dma_get_range(dev, &dmaaddr, &offset, &size);
> -	else
> +		if (ret == -ENODEV)
> +			ret = rc_dma_get_range(dev, &size);
> +	} else {
>  		ret = nc_dma_get_range(dev, &size);
> +	}
>  
>  	if (!ret) {
>  		msb = fls64(dmaaddr + size - 1);
> 

Looks good to me,

Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>

Thanks
Hanjun

  parent reply	other threads:[~2018-07-20  2:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-10 16:13 [PATCH] ACPI/IORT: Support address size limit for root complexes Robin Murphy
2018-07-10 16:13 ` Robin Murphy
2018-07-16 15:10 ` Lorenzo Pieralisi
2018-07-16 15:10   ` Lorenzo Pieralisi
2018-07-16 15:34   ` Robin Murphy
2018-07-16 15:34     ` Robin Murphy
2018-07-18 16:36     ` Lorenzo Pieralisi
2018-07-18 16:36       ` Lorenzo Pieralisi
2018-07-23 17:18       ` Robin Murphy
2018-07-23 17:18         ` Robin Murphy
2018-07-20  2:36 ` Hanjun Guo [this message]
2018-07-20  2:36   ` Hanjun Guo

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=43f65aea-ee08-00d5-7cf2-0f14a7fc52d4@huawei.com \
    --to=guohanjun@huawei.com \
    --cc=hanjun.guo@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=robin.murphy@arm.com \
    --cc=sudeep.holla@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.