diff mbox series

[v4,2/6] xen: define ACPI and DT device info sections macros

Message ID c5fd649a4ccd3a65a81dfab505fc99b2a679cda6.1727365854.git.oleksii.kurochko@gmail.com (mailing list archive)
State Superseded
Headers show
Series Move {acpi_}device_init() and device_get_class() to common code | expand

Commit Message

Oleksii Kurochko Sept. 26, 2024, 4:54 p.m. UTC
Introduce macros to define device information sections based on
the configuration of ACPI or device tree support. These sections
are required for common code of device initialization and getting
an information about a device.

These macros are expected to be used across different
architectures (Arm, PPC, RISC-V), so they are moved to
the common xen/xen.lds.h, based on their original definition
in Arm.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
Changes in V4:
 - rename ADEV_INFO to ACPI_DEV_INFO.
 - refactor ADEV_INFO and DT_DEV_INFO: add alignment and DECL_SECTION.
---
 Changes in V3:
  - drop SEC* at the end of ACPI AND DT device info
    section mancros.
  - refactor ADEV_INFO and DT_DEV_INFO macros.
---
 xen/include/xen/xen.lds.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Jan Beulich Sept. 27, 2024, 6:38 a.m. UTC | #1
On 26.09.2024 18:54, Oleksii Kurochko wrote:
> Introduce macros to define device information sections based on
> the configuration of ACPI or device tree support. These sections
> are required for common code of device initialization and getting
> an information about a device.
> 
> These macros are expected to be used across different
> architectures (Arm, PPC, RISC-V), so they are moved to
> the common xen/xen.lds.h, based on their original definition
> in Arm.
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

Acked-by: Jan Beulich <jbeulich@suse.com>
with ...

> @@ -137,6 +145,14 @@
>      *(.bug_frames.3)                            \
>      __stop_bug_frames_3 = .;
>  
> +#define DT_DEV_INFO(secname)    \
> +  . = ALIGN(POINTER_ALIGN);     \
> +  DECL_SECTION(secname) {       \
> +       _sdevice = .;           \
> +       *(secname)              \
> +       _edevice = .;           \
> +  } :text

... the trailing backslashes all aligned here (can likely be taken care of
while committing).

Jan
Jan Beulich Sept. 27, 2024, 7:28 a.m. UTC | #2
On 26.09.2024 18:54, Oleksii Kurochko wrote:
> --- a/xen/include/xen/xen.lds.h
> +++ b/xen/include/xen/xen.lds.h
> @@ -120,6 +120,14 @@
>  
>  /* List of constructs other than *_SECTIONS in alphabetical order. */
>  
> +#define ACPI_DEV_INFO(secname)  \
> +  . = ALIGN(POINTER_ALIGN);     \
> +  DECL_SECTION(secname) {       \
> +      _asdevice = .;            \
> +      *(secname)                \
> +      _aedevice = .;            \
> +  } :text
> +
>  #define BUGFRAMES                               \
>      __start_bug_frames_0 = .;                   \
>      *(.bug_frames.0)                            \
> @@ -137,6 +145,14 @@
>      *(.bug_frames.3)                            \
>      __stop_bug_frames_3 = .;
>  
> +#define DT_DEV_INFO(secname)    \
> +  . = ALIGN(POINTER_ALIGN);     \
> +  DECL_SECTION(secname) {       \
> +       _sdevice = .;           \
> +       *(secname)              \
> +       _edevice = .;           \
> +  } :text
> +
>  #ifdef CONFIG_HYPFS
>  #define HYPFS_PARAM              \
>         . = ALIGN(POINTER_ALIGN); \

Michal's comment made me notice that I overlooked the section names being
macro parameters. Why's that?

Jan
Oleksii Kurochko Sept. 27, 2024, 9:24 a.m. UTC | #3
On Fri, 2024-09-27 at 09:28 +0200, Jan Beulich wrote:
> On 26.09.2024 18:54, Oleksii Kurochko wrote:
> > --- a/xen/include/xen/xen.lds.h
> > +++ b/xen/include/xen/xen.lds.h
> > @@ -120,6 +120,14 @@
> >  
> >  /* List of constructs other than *_SECTIONS in alphabetical order.
> > */
> >  
> > +#define ACPI_DEV_INFO(secname)  \
> > +  . = ALIGN(POINTER_ALIGN);     \
> > +  DECL_SECTION(secname) {       \
> > +      _asdevice = .;            \
> > +      *(secname)                \
> > +      _aedevice = .;            \
> > +  } :text
> > +
> >  #define BUGFRAMES                               \
> >      __start_bug_frames_0 = .;                   \
> >      *(.bug_frames.0)                            \
> > @@ -137,6 +145,14 @@
> >      *(.bug_frames.3)                            \
> >      __stop_bug_frames_3 = .;
> >  
> > +#define DT_DEV_INFO(secname)    \
> > +  . = ALIGN(POINTER_ALIGN);     \
> > +  DECL_SECTION(secname) {       \
> > +       _sdevice = .;           \
> > +       *(secname)              \
> > +       _edevice = .;           \
> > +  } :text
> > +
> >  #ifdef CONFIG_HYPFS
> >  #define HYPFS_PARAM              \
> >         . = ALIGN(POINTER_ALIGN); \
> 
> Michal's comment made me notice that I overlooked the section names
> being
> macro parameters. Why's that?
I wanted to give ability for architecture to choose the name but now I
am realized that it isn't corrected as common code is using specific
names ".adev.info" and ".dev.info".

I will prepare the new version of patch series with dropped macro
parameter and just hardcode the name of the section inside the macros.

~ Oleksii
diff mbox series

Patch

diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h
index 8135732756..cec86d0781 100644
--- a/xen/include/xen/xen.lds.h
+++ b/xen/include/xen/xen.lds.h
@@ -120,6 +120,14 @@ 
 
 /* List of constructs other than *_SECTIONS in alphabetical order. */
 
+#define ACPI_DEV_INFO(secname)  \
+  . = ALIGN(POINTER_ALIGN);     \
+  DECL_SECTION(secname) {       \
+      _asdevice = .;            \
+      *(secname)                \
+      _aedevice = .;            \
+  } :text
+
 #define BUGFRAMES                               \
     __start_bug_frames_0 = .;                   \
     *(.bug_frames.0)                            \
@@ -137,6 +145,14 @@ 
     *(.bug_frames.3)                            \
     __stop_bug_frames_3 = .;
 
+#define DT_DEV_INFO(secname)    \
+  . = ALIGN(POINTER_ALIGN);     \
+  DECL_SECTION(secname) {       \
+       _sdevice = .;           \
+       *(secname)              \
+       _edevice = .;           \
+  } :text
+
 #ifdef CONFIG_HYPFS
 #define HYPFS_PARAM              \
        . = ALIGN(POINTER_ALIGN); \