* [PATCH] iommu: Limit the IOVA page range to the specified addresses
@ 2017-10-17 21:22 Gary R Hook
2017-10-26 8:32 ` Alex Williamson
0 siblings, 1 reply; 3+ messages in thread
From: Gary R Hook @ 2017-10-17 21:22 UTC (permalink / raw)
To: iommu; +Cc: joro, linux-kernel
From: amd <amd@sosxen2.amd.com>
The extent of pages specified when applying a reserved region should
include up to the last page of the range, but not the page following
the range.
Signed-off-by: Gary R Hook <gary.hook@amd.com>
---
drivers/iommu/amd_iommu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 27eb0d6fcdc2..bb3ef33e3784 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -3271,7 +3271,7 @@ static void amd_iommu_apply_resv_region(struct device *dev,
unsigned long start, end;
start = IOVA_PFN(region->start);
- end = IOVA_PFN(region->start + region->length);
+ end = IOVA_PFN(region->start + region->length - 1);
WARN_ON_ONCE(reserve_iova(&dma_dom->iovad, start, end) == NULL);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iommu: Limit the IOVA page range to the specified addresses
2017-10-17 21:22 [PATCH] iommu: Limit the IOVA page range to the specified addresses Gary R Hook
@ 2017-10-26 8:32 ` Alex Williamson
2017-10-27 15:20 ` Gary R Hook
0 siblings, 1 reply; 3+ messages in thread
From: Alex Williamson @ 2017-10-26 8:32 UTC (permalink / raw)
To: Gary R Hook; +Cc: iommu, linux-kernel
On Tue, 17 Oct 2017 16:22:01 -0500
Gary R Hook <gary.hook@amd.com> wrote:
> From: amd <amd@sosxen2.amd.com>
>
> The extent of pages specified when applying a reserved region should
> include up to the last page of the range, but not the page following
> the range.
>
> Signed-off-by: Gary R Hook <gary.hook@amd.com>
> ---
> drivers/iommu/amd_iommu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
> index 27eb0d6fcdc2..bb3ef33e3784 100644
> --- a/drivers/iommu/amd_iommu.c
> +++ b/drivers/iommu/amd_iommu.c
> @@ -3271,7 +3271,7 @@ static void amd_iommu_apply_resv_region(struct device *dev,
> unsigned long start, end;
>
> start = IOVA_PFN(region->start);
> - end = IOVA_PFN(region->start + region->length);
> + end = IOVA_PFN(region->start + region->length - 1);
>
> WARN_ON_ONCE(reserve_iova(&dma_dom->iovad, start, end) == NULL);
> }
This looks like a fix, should we include:
Fixes: 8d54d6c8b8f3 ('iommu/amd: Implement apply_dm_region call-back')
Thanks,
Alex
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] iommu: Limit the IOVA page range to the specified addresses
2017-10-26 8:32 ` Alex Williamson
@ 2017-10-27 15:20 ` Gary R Hook
0 siblings, 0 replies; 3+ messages in thread
From: Gary R Hook @ 2017-10-27 15:20 UTC (permalink / raw)
To: Alex Williamson; +Cc: iommu, linux-kernel
On 10/26/2017 03:32 AM, Alex Williamson wrote:
> On Tue, 17 Oct 2017 16:22:01 -0500
> Gary R Hook <gary.hook@amd.com> wrote:
>
>> From: amd <amd@sosxen2.amd.com>
>>
>> The extent of pages specified when applying a reserved region should
>> include up to the last page of the range, but not the page following
>> the range.
>>
>> Signed-off-by: Gary R Hook <gary.hook@amd.com>
>> ---
>> drivers/iommu/amd_iommu.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
>> index 27eb0d6fcdc2..bb3ef33e3784 100644
>> --- a/drivers/iommu/amd_iommu.c
>> +++ b/drivers/iommu/amd_iommu.c
>> @@ -3271,7 +3271,7 @@ static void amd_iommu_apply_resv_region(struct device *dev,
>> unsigned long start, end;
>>
>> start = IOVA_PFN(region->start);
>> - end = IOVA_PFN(region->start + region->length);
>> + end = IOVA_PFN(region->start + region->length - 1);
>>
>> WARN_ON_ONCE(reserve_iova(&dma_dom->iovad, start, end) == NULL);
>> }
>
> This looks like a fix, should we include:
>
> Fixes: 8d54d6c8b8f3 ('iommu/amd: Implement apply_dm_region call-back')
It turns out there are other places where the computation is incorrect.
Would you prefer a single patch to address all of them, or separate
patches that apply to specific areas of the driver?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-27 15:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-17 21:22 [PATCH] iommu: Limit the IOVA page range to the specified addresses Gary R Hook
2017-10-26 8:32 ` Alex Williamson
2017-10-27 15:20 ` Gary R Hook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®