xen/arm: misc tiny fixes
cover xen/arm: misc tiny fixes
Series of unconnected, tiny patches accumulated recently.
Michal Orzel (4):
xen/arm: dm: Bail out if padding != 0 for XEN_DMOP_set_irq_level xen/arm: Check return code from fdt_finish_reservemap() xen/arm: static-shmem: Drop unused size_cells xen/arm: Don't blindly print hwdom in generic panic messages
xen/arch/arm/dm.c | 2 +- xen/arch/arm/domain_build.c | 8 +++++--- xen/arch/arm/kernel.c | 4 ++-- xen/arch/arm/static-shmem.c | 3 +-- 4 files changed, 9 insertions(+), 8 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/4 xen/arm: dm: Bail out if padding != 0 for XEN_DMOP_set_irq_level
XEN_DMOP_set_irq_level operation requires elements of pad array (being member of xen_dm_op_set_irq_level structure) to be 0. While handling the hypercall we validate this. If one of the elements is not zero, we set rc to -EINVAL. At this point we should stop further DM handling and bail out propagating the error to the caller. However, instead of goto the code uses break which has basically no meaningful effect. The rc value is never read and the code continues with the hypercall processing ending up (possibly) with the interrupt injection. Fix it.
--- xen/arch/arm/dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/dm.c +1 -1
@@ -93,7 +93,7 @@ int dm_op(const struct dmop_args *op_args)if ( data->pad[i] ) { rc = -EINVAL ; -break ; + goto out; } }
Signature · 1 line
2.25.1
Re: [PATCH 1/4] xen/arm: dm: Bail out if padding != 0 for XEN_DMOP_set_irq_level
Hi Michal,
Quoted 11 lines · Michal Orzel
XEN_DMOP_set_irq_leveloperation requires elements of pad array (being member ofxen_dm_op_set_irq_levelstructure) to be 0. While handling the hypercall we validate this. If one of the elements is not zero, we set rc to-EINVAL. At this point we should stop further DM handling and bail out propagating the error to the caller. However, instead of goto the code uses break which has basically no meaningful effect. The rc value is never read and the code continues with the hypercall processing ending up (possibly) with the interrupt injection. Fix it.
Quoted 2 lines
Fixes 5d752df85f2c ("xen/dm: Introduce xendevicemodel_set_irq_level DM op")Signed-off-by Michal Orzel <[email protected]>
Cheers
Bertrand
Quoted 20 lines
---
xen/arch/arm/dm.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)xen/arch/arm/dm.c +1
-1@@ -93,7 +93,7 @@ int dm_op(const struct dmop_args *op_args)if ( data->pad[i] ) { rc = -EINVAL ; -break ; + goto out; } }Signature · 1 line
2.25.1
PATCH 2/4 xen/arm: Check return code from fdt_finish_reservemap()
In reply to Michal Orzelfdt_finish_reservemap() may fail (with -FDT_ERR_NOSPACE) in which case further DTB creation (in prepare_dtb_hwdom()) makes no sense. Fix it.
--- xen/arch/arm/domain_build.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
xen/arch/arm/domain_build.c +3 -1
@@ -2033,7 +2033,9 @@ static int __init prepare_dtb_hwdom(struct domain *d, struct kernel_info *kinfo)if ( ret <0 ) goto err; -fdt_finish_reservemap (kinfo->fdt); + ret =fdt_finish_reservemap (kinfo->fdt); +if ( ret ) + goto err; ret =handle_node (d, kinfo, dt_host, default_p2mt);if ( ret )
Signature · 1 line
2.25.1
Re: [PATCH 2/4] xen/arm: Check return code from fdt_finish_reservemap()
Hi Michal,
Quoted 7 lines · Michal Orzel
fdt_finish_reservemap()may fail (with -FDT_ERR_NOSPACE) in which case further DTB creation (inprepare_dtb_hwdom()) makes no sense. Fix it.Fixes 13bb63b754e4 ("device tree,arm: supply a flat device tree to dom0")Signed-off-by Michal Orzel <[email protected]>
Cheers
Bertrand
Quoted 22 lines
---
xen/arch/arm/domain_build.c| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)xen/arch/arm/domain_build.c +3
-1@@ -2033,7 +2033,9 @@ static int __init prepare_dtb_hwdom(struct domain *d, struct kernel_info *kinfo)if ( ret <0 ) goto err; -fdt_finish_reservemap (kinfo->fdt); + ret =fdt_finish_reservemap (kinfo->fdt); +if ( ret ) + goto err; ret =handle_node (d, kinfo, dt_host, default_p2mt);if ( ret )Signature · 1 line
2.25.1
PATCH 3/4 xen/arm: static-shmem: Drop unused size_cells
In reply to Michal OrzelValue stored in size_cells is never read because we're only interested in retrieving gbase address of shmem region for which we only need address cells.
--- xen/arch/arm/static-shmem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
xen/arch/arm/static-shmem.c +1 -2
@@ -302,7 +302,7 @@ int __init process_shm(struct domain *d, struct kernel_info *kinfo,const struct membank *boot_shm_bank;const struct dt_property *prop;const __be32 *cells; -uint32_t addr_cells, size_cells; +uint32_t addr_cells;paddr_t gbase, pbase, psize;int ret =0 ;unsigned int i;
@@ -338,7 +338,6 @@ int __init process_shm(struct domain *d, struct kernel_info *kinfo,* pbase is optional. */ addr_cells =dt_n_addr_cells (shm_node); - size_cells =dt_n_size_cells (shm_node); prop =dt_find_property (shm_node,"xen,shared-mem" ,NULL );BUG_ON (!prop); cells = (const __be32 *)prop->value;
Signature · 1 line
2.25.1
Re: [PATCH 3/4] xen/arm: static-shmem: Drop unused size_cells
Hi Michal,
Quoted 7 lines · Michal Orzel
Value stored in
size_cellsis never read because we're only interested in retrieving gbase address of shmem region for which we only need address cells.Signed-off-by Michal Orzel <[email protected]>
Cheers
Bertrand
Quoted 28 lines
---
xen/arch/arm/static-shmem.c| 3 +--1 file changed, 1 insertion(+), 2 deletions(-)xen/arch/arm/static-shmem.c +1
-2@@ -302,7 +302,7 @@ int __init process_shm(struct domain *d, struct kernel_info *kinfo,const struct membank *boot_shm_bank;const struct dt_property *prop;const __be32 *cells; -uint32_t addr_cells, size_cells; +uint32_t addr_cells;paddr_t gbase, pbase, psize;int ret =0 ;unsigned int i;@@ -338,7 +338,6 @@ int __init process_shm(struct domain *d, struct kernel_info *kinfo,* pbase is optional. */ addr_cells =dt_n_addr_cells (shm_node); - size_cells =dt_n_size_cells (shm_node); prop =dt_find_property (shm_node,"xen,shared-mem" ,NULL );BUG_ON (!prop); cells = (const __be32 *)prop->value;Signature · 1 line
2.25.1
PATCH 4/4 xen/arm: Don't blindly print hwdom in generic panic messages
In reply to Michal OrzelThese functions are generic and used not only for hardware domain. This creates confusion when printing any of these panic messages (e.g. failure when loading domU kernel would result in informing a user about a failure in loading hwdom kernel).
--- xen/arch/arm/domain_build.c | 4 ++-- xen/arch/arm/kernel.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
xen/arch/arm/domain_build.c +2 -2
@@ -2112,12 +2112,12 @@ static void __init initrd_load(struct kernel_info *kinfo) initrd =ioremap_wc (paddr, len);if ( !initrd ) -panic ("Unable to map the hwdom initrd\n" ); +panic ("Unable to map the %pd initrd\n" , kinfo->d); res =copy_to_guest_phys_flush_dcache (kinfo->d, load_addr, initrd, len);if ( res !=0 ) -panic ("Unable to copy the initrd in the hwdom memory\n" ); +panic ("Unable to copy the initrd in the %pd memory\n" , kinfo->d);iounmap (initrd); }
xen/arch/arm/kernel.c +2 -2
@@ -150,12 +150,12 @@ static void __init kernel_zimage_load(struct kernel_info *info) kernel =ioremap_wc (paddr, len);if ( !kernel ) -panic ("Unable to map the hwdom kernel\n" ); +panic ("Unable to map the %pd kernel\n" , info->d); rc =copy_to_guest_phys_flush_dcache (info->d, load_addr, kernel, len);if ( rc !=0 ) -panic ("Unable to copy the kernel in the hwdom memory\n" ); +panic ("Unable to copy the kernel in the %pd memory\n" , info->d);iounmap (kernel); }
Signature · 1 line
2.25.1
Re: [PATCH 4/4] xen/arm: Don't blindly print hwdom in generic panic messages
Hi Michal,
Quoted 8 lines · Michal Orzel
These functions are generic and used not only for hardware domain. This creates confusion when printing any of these panic messages (e.g. failure when loading domU kernel would result in informing a user about a failure in loading hwdom kernel).
Signed-off-by Michal Orzel <[email protected]>
Cheers
Bertrand
Quoted 46 lines
---
xen/arch/arm/domain_build.c| 4 ++--xen/arch/arm/kernel.c| 4 ++--2 files changed, 4 insertions(+), 4 deletions(-)xen/arch/arm/domain_build.c +2
-2@@ -2112,12 +2112,12 @@ static void __init initrd_load(struct kernel_info *kinfo) initrd =ioremap_wc (paddr, len);if ( !initrd ) -panic ("Unable to map the hwdom initrd\n" ); +panic ("Unable to map the %pd initrd\n" , kinfo->d); res =copy_to_guest_phys_flush_dcache (kinfo->d, load_addr, initrd, len);if ( res !=0 ) -panic ("Unable to copy the initrd in the hwdom memory\n" ); +panic ("Unable to copy the initrd in the %pd memory\n" , kinfo->d);iounmap (initrd); }xen/arch/arm/kernel.c +2
-2@@ -150,12 +150,12 @@ static void __init kernel_zimage_load(struct kernel_info *info) kernel =ioremap_wc (paddr, len);if ( !kernel ) -panic ("Unable to map the hwdom kernel\n" ); +panic ("Unable to map the %pd kernel\n" , info->d); rc =copy_to_guest_phys_flush_dcache (info->d, load_addr, kernel, len);if ( rc !=0 ) -panic ("Unable to copy the kernel in the hwdom memory\n" ); +panic ("Unable to copy the kernel in the %pd memory\n" , info->d);iounmap (kernel); }Signature · 1 line
2.25.1