|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] Arm: device.c is init-only when OVERLAY_DTB=n
commit 227a9aae44a31c440f05e66ed0841b21fb99837d
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue May 5 08:21:45 2026 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue May 5 08:21:45 2026 +0200
Arm: device.c is init-only when OVERLAY_DTB=n
Introduce an annotation similar to __hwdom_init and use it througout the
file. All external callers are either themselves __init or are limited to
OVERLAY_DTB=y. Adjust the Makefile accordingly to also have string
literals moved into .init.rodata.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
---
xen/arch/arm/Makefile | 2 +-
xen/arch/arm/device.c | 33 ++++++++++++++++++---------------
xen/include/xen/dt-overlay.h | 8 ++++++++
3 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 69200b2728..982c6c396a 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -15,7 +15,7 @@ obj-$(CONFIG_HAS_ALTERNATIVE) += alternative.o
obj-y += cpuerrata.o
obj-y += cpufeature.o
obj-y += decode.o
-obj-y += device.o
+obj-y += $(if $(CONFIG_OVERLAY_DTB),device.o,device.init.o)
obj-$(CONFIG_IOREQ_SERVER) += dm.o
obj-$(CONFIG_DOM0LESS_BOOT) += dom0less-build.init.o
obj-y += domain.o
diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c
index 74b54cad34..7d9644fd8b 100644
--- a/xen/arch/arm/device.c
+++ b/xen/arch/arm/device.c
@@ -9,6 +9,7 @@
*/
#include <xen/device_tree.h>
+#include <xen/dt-overlay.h>
#include <xen/errno.h>
#include <xen/iocap.h>
#include <xen/lib.h>
@@ -16,8 +17,8 @@
#include <asm/firmware/sci.h>
#include <asm/setup.h>
-int map_irq_to_domain(struct domain *d, unsigned int irq,
- bool need_mapping, const char *devname)
+int __overlay_init map_irq_to_domain(struct domain *d, unsigned int irq,
+ bool need_mapping, const char *devname)
{
int res;
@@ -49,8 +50,8 @@ int map_irq_to_domain(struct domain *d, unsigned int irq,
return 0;
}
-int map_range_to_domain(const struct dt_device_node *dev,
- uint64_t addr, uint64_t len, void *data)
+int __overlay_init map_range_to_domain(const struct dt_device_node *dev,
+ uint64_t addr, uint64_t len, void *data)
{
struct map_range_data *mr_data = data;
struct domain *d = mr_data->d;
@@ -124,10 +125,10 @@ int map_range_to_domain(const struct dt_device_node *dev,
* < 0 error
* 0 success
*/
-int map_device_irqs_to_domain(struct domain *d,
- struct dt_device_node *dev,
- bool need_mapping,
- struct rangeset *irq_ranges)
+int __overlay_init map_device_irqs_to_domain(struct domain *d,
+ struct dt_device_node *dev,
+ bool need_mapping,
+ struct rangeset *irq_ranges)
{
unsigned int i, nirq;
int res, irq;
@@ -180,9 +181,9 @@ int map_device_irqs_to_domain(struct domain *d,
return 0;
}
-static int map_dt_irq_to_domain(const struct dt_device_node *dev,
- const struct dt_irq *dt_irq,
- void *data)
+static int __overlay_init map_dt_irq_to_domain(const struct dt_device_node
*dev,
+ const struct dt_irq *dt_irq,
+ void *data)
{
struct map_range_data *mr_data = data;
struct domain *d = mr_data->d;
@@ -219,8 +220,8 @@ static int map_dt_irq_to_domain(const struct dt_device_node
*dev,
* then we may need to perform additional mappings in order to make
* the child resources available to domain 0.
*/
-static int map_device_children(const struct dt_device_node *dev,
- struct map_range_data *mr_data)
+static int __overlay_init map_device_children(const struct dt_device_node *dev,
+ struct map_range_data *mr_data)
{
if ( dt_device_type_is_equal(dev, "pci") )
{
@@ -250,8 +251,10 @@ static int map_device_children(const struct dt_device_node
*dev,
* - Assign the device to the guest if it's protected by an IOMMU
* - Map the IRQs and iomem regions to DOM0
*/
-int handle_device(struct domain *d, struct dt_device_node *dev, p2m_type_t
p2mt,
- struct rangeset *iomem_ranges, struct rangeset *irq_ranges)
+int __overlay_init handle_device(struct domain *d, struct dt_device_node *dev,
+ p2m_type_t p2mt,
+ struct rangeset *iomem_ranges,
+ struct rangeset *irq_ranges)
{
unsigned int naddr;
unsigned int i;
diff --git a/xen/include/xen/dt-overlay.h b/xen/include/xen/dt-overlay.h
index b2cedf3f2a..7400382842 100644
--- a/xen/include/xen/dt-overlay.h
+++ b/xen/include/xen/dt-overlay.h
@@ -42,10 +42,18 @@ struct xen_sysctl_dt_overlay;
struct xen_domctl_dt_overlay;
#ifdef CONFIG_OVERLAY_DTB
+
+#define __overlay_init
+
long dt_overlay_sysctl(struct xen_sysctl_dt_overlay *op);
long dt_overlay_domctl(struct domain *d, struct xen_domctl_dt_overlay *op);
+
#else
+
#include <xen/errno.h>
+
+#define __overlay_init __init
+
static inline long dt_overlay_sysctl(struct xen_sysctl_dt_overlay *op)
{
return -EOPNOTSUPP;
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |