lkml.org 
[lkml]   [2023]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 3/7] ACPI/IORT: Handle memory address size limits as limits
On Wed, Nov 29, 2023 at 05:43:00PM +0000, Robin Murphy wrote:
> Return the Root Complex/Named Component memory address size limit as an
> inclusive limit value, rather than an exclusive size. This saves us
> having to special-case 64-bit overflow, and simplifies our caller too.
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
> drivers/acpi/arm64/dma.c | 9 +++------
> drivers/acpi/arm64/iort.c | 18 ++++++++----------
> include/linux/acpi_iort.h | 4 ++--
> 3 files changed, 13 insertions(+), 18 deletions(-)

[...]

> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
> index 6496ff5a6ba2..eb64d8e17dd1 100644
> --- a/drivers/acpi/arm64/iort.c
> +++ b/drivers/acpi/arm64/iort.c
> @@ -1367,7 +1367,7 @@ int iort_iommu_configure_id(struct device *dev, const u32 *input_id)
> { return -ENODEV; }
> #endif
>
> -static int nc_dma_get_range(struct device *dev, u64 *size)
> +static int nc_dma_get_range(struct device *dev, u64 *limit)
> {
> struct acpi_iort_node *node;
> struct acpi_iort_named_component *ncomp;
> @@ -1384,13 +1384,12 @@ static int nc_dma_get_range(struct device *dev, u64 *size)
> return -EINVAL;
> }
>
> - *size = ncomp->memory_address_limit >= 64 ? U64_MAX :
> - 1ULL<<ncomp->memory_address_limit;
> + *limit = (1ULL << ncomp->memory_address_limit) - 1;

The old code handled 'ncomp->memory_address_limit >= 64' -- why is it safe
to drop that? You mention it in the cover letter, so clearly I'm missing
something!

>
> return 0;
> }
>
> -static int rc_dma_get_range(struct device *dev, u64 *size)
> +static int rc_dma_get_range(struct device *dev, u64 *limit)
> {
> struct acpi_iort_node *node;
> struct acpi_iort_root_complex *rc;
> @@ -1408,8 +1407,7 @@ static int rc_dma_get_range(struct device *dev, u64 *size)
> return -EINVAL;
> }
>
> - *size = rc->memory_address_limit >= 64 ? U64_MAX :
> - 1ULL<<rc->memory_address_limit;
> + *limit = (1ULL << rc->memory_address_limit) - 1;

Same thing here.

Will

\
 
 \ /
  Last update: 2023-12-11 14:28    [W:0.164 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site