|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] xen/arm: fix iomem_ranges cfg in map_range_to_domain()
Now the following code in map_range_to_domain()
res = iomem_permit_access(d, paddr_to_pfn(addr),
paddr_to_pfn(PAGE_ALIGN(addr + len - 1)));
and
res = rangeset_add_range(mr_data->iomem_ranges,
paddr_to_pfn(addr),
paddr_to_pfn_aligned(addr + len - 1));
will incorrectly calculate end address of the iomem_range by rounding it up
to the next Xen page, which in turn will give Control domain access to
manage incorrect MMIO range.
For example, requested range:
00e6140000 - 00e6141004 should set e6140:e6141 nr=2, but will configure
e6140 e6142 nr=3 instead.
Note. paddr_to_pfn_aligned() has PAGE_ALIGN() inside.
Fix it, by using paddr_to_pfn(addr + len - 1) in both places to get correct
end address of the iomem_range.
Signed-off-by: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
---
Hi All,
I have a question - the paddr_to_pfn_aligned() is not used any more,
should I remove it as part of this patch?
xen/arch/arm/device.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c
index 5610cddcba8e..5e1c1cc326ac 100644
--- a/xen/arch/arm/device.c
+++ b/xen/arch/arm/device.c
@@ -71,7 +71,7 @@ int map_range_to_domain(const struct dt_device_node *dev,
strlen("/reserved-memory/")) != 0 )
{
res = iomem_permit_access(d, paddr_to_pfn(addr),
- paddr_to_pfn(PAGE_ALIGN(addr + len - 1)));
+ paddr_to_pfn(addr + len - 1));
if ( res )
{
printk(XENLOG_ERR "Unable to permit to dom%d access to"
@@ -107,7 +107,7 @@ int map_range_to_domain(const struct dt_device_node *dev,
{
res = rangeset_add_range(mr_data->iomem_ranges,
paddr_to_pfn(addr),
- paddr_to_pfn_aligned(addr + len - 1));
+ paddr_to_pfn(addr + len - 1));
if ( res )
return res;
}
--
2.34.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |