|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] 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>
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -15,7 +15,9 @@ obj-$(CONFIG_HAS_ALTERNATIVE) += alterna
obj-y += cpuerrata.o
obj-y += cpufeature.o
obj-y += decode.o
-obj-y += device.o
+device-y := device.init.o
+device-$(CONFIG_OVERLAY_DTB) := device.o
+obj-y += $(device-y)
obj-$(CONFIG_IOREQ_SERVER) += dm.o
obj-$(CONFIG_DOM0LESS_BOOT) += dom0less-build.init.o
obj-y += domain.o
--- 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,
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_
* < 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 dom
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 st
* 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 str
* - 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;
--- 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;
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |