diff mbox series

[v8,3/7] xen/asm-generic: introduce stub header monitor.h

Message ID 84568b0c24a5ec96244f3f34537e9a148367facf.1707499278.git.oleksii.kurochko@gmail.com (mailing list archive)
State Superseded
Headers show
Series Introduce generic headers | expand

Commit Message

Oleksii Kurochko Feb. 9, 2024, 6 p.m. UTC
The header is shared between several archs so it is
moved to asm-generic.

Switch partly Arm and PPC to asm-generic/monitor.h and only
arch_monitor_get_capabilities() left in arch-specific/monitor.h.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
---
Changes in V8:
 - Add Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
---
Changes in V7:
 - Drop definition of arch_monitor_domctl_event for PPC.
 - define arch_monitor_domctl_event in asm-generic/monitor.h.
 - add "define HAS_ARCH_MONITOR_DOMCTL_EVENT" in arm/.../monitor.h as it has arch specific implementation.
---
Changes in V6:
 - Rebase only.
---
Changes in V5:
  - Switched partly Arm and PPC to asm-generic monitor.h only
    arch_monitor_get_capabilities() left in arch-specific/monitor.h.
  - Updated the commit message.
---
Changes in V4:
 - Removed the double blank line.
 - Added Acked-by: Jan Beulich <jbeulich@suse.com>.
 - Update the commit message
---
Changes in V3:
 - Use forward-declaration of struct domain instead of " #include <xen/sched.h> ".
 - Add ' include <xen/errno.h> '
 - Drop PPC's monitor.h.
---
Changes in V2:
	- remove inclusion of "+#include <public/domctl.h>"
	- add "struct xen_domctl_monitor_op;"
	- remove one of SPDX tags.
---
 xen/arch/arm/include/asm/monitor.h | 25 +-----------
 xen/arch/ppc/include/asm/monitor.h | 28 +------------
 xen/arch/ppc/stubs.c               |  8 ----
 xen/include/asm-generic/monitor.h  | 64 ++++++++++++++++++++++++++++++
 4 files changed, 67 insertions(+), 58 deletions(-)
 create mode 100644 xen/include/asm-generic/monitor.h

Comments

Julien Grall Feb. 13, 2024, 5:40 p.m. UTC | #1
Hi Oleksii,

On 09/02/2024 18:00, Oleksii Kurochko wrote:
> The header is shared between several archs so it is
> moved to asm-generic.
> 
> Switch partly Arm and PPC to asm-generic/monitor.h and only
> arch_monitor_get_capabilities() left in arch-specific/monitor.h.
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> Acked-by: Jan Beulich <jbeulich@suse.com>
> Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
> ---
> Changes in V8:
>   - Add Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
> ---
> Changes in V7:
>   - Drop definition of arch_monitor_domctl_event for PPC.
>   - define arch_monitor_domctl_event in asm-generic/monitor.h.
>   - add "define HAS_ARCH_MONITOR_DOMCTL_EVENT" in arm/.../monitor.h as it has arch specific implementation.
> ---
> Changes in V6:
>   - Rebase only.
> ---
> Changes in V5:
>    - Switched partly Arm and PPC to asm-generic monitor.h only
>      arch_monitor_get_capabilities() left in arch-specific/monitor.h.
>    - Updated the commit message.
> ---
> Changes in V4:
>   - Removed the double blank line.
>   - Added Acked-by: Jan Beulich <jbeulich@suse.com>.
>   - Update the commit message
> ---
> Changes in V3:
>   - Use forward-declaration of struct domain instead of " #include <xen/sched.h> ".
>   - Add ' include <xen/errno.h> '
>   - Drop PPC's monitor.h.
> ---
> Changes in V2:
> 	- remove inclusion of "+#include <public/domctl.h>"
> 	- add "struct xen_domctl_monitor_op;"
> 	- remove one of SPDX tags.
> ---
>   xen/arch/arm/include/asm/monitor.h | 25 +-----------
>   xen/arch/ppc/include/asm/monitor.h | 28 +------------

Looking at MAINTAINERS, monitor.h was covered by "VM EVENT, MEM ACCESS 
and MONITOR". As you move to ...

>   xen/arch/ppc/stubs.c               |  8 ----
>   xen/include/asm-generic/monitor.h  | 64 ++++++++++++++++++++++++++++++

... asm-generic/, I believe it will now fall under "THE REST". So I 
think MAINTAINERS needs to be updated to also cover asm-generic/monitor.h.

Looking at what was already committed, I think asm-generic/vm_event.h 
should also be added in MAINTAINERS. Can you send a separate patch for that?

Cheers,
Julien Grall Feb. 13, 2024, 5:44 p.m. UTC | #2
Hi,

On 13/02/2024 17:40, Julien Grall wrote:
> Hi Oleksii,
> 
> On 09/02/2024 18:00, Oleksii Kurochko wrote:
>> The header is shared between several archs so it is
>> moved to asm-generic.
>>
>> Switch partly Arm and PPC to asm-generic/monitor.h and only
>> arch_monitor_get_capabilities() left in arch-specific/monitor.h.
>>
>> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
>> Acked-by: Jan Beulich <jbeulich@suse.com>
>> Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
>> ---
>> Changes in V8:
>>   - Add Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
>> ---
>> Changes in V7:
>>   - Drop definition of arch_monitor_domctl_event for PPC.
>>   - define arch_monitor_domctl_event in asm-generic/monitor.h.
>>   - add "define HAS_ARCH_MONITOR_DOMCTL_EVENT" in arm/.../monitor.h as 
>> it has arch specific implementation.
>> ---
>> Changes in V6:
>>   - Rebase only.
>> ---
>> Changes in V5:
>>    - Switched partly Arm and PPC to asm-generic monitor.h only
>>      arch_monitor_get_capabilities() left in arch-specific/monitor.h.
>>    - Updated the commit message.
>> ---
>> Changes in V4:
>>   - Removed the double blank line.
>>   - Added Acked-by: Jan Beulich <jbeulich@suse.com>.
>>   - Update the commit message
>> ---
>> Changes in V3:
>>   - Use forward-declaration of struct domain instead of " #include 
>> <xen/sched.h> ".
>>   - Add ' include <xen/errno.h> '
>>   - Drop PPC's monitor.h.
>> ---
>> Changes in V2:
>>     - remove inclusion of "+#include <public/domctl.h>"
>>     - add "struct xen_domctl_monitor_op;"
>>     - remove one of SPDX tags.
>> ---
>>   xen/arch/arm/include/asm/monitor.h | 25 +-----------
>>   xen/arch/ppc/include/asm/monitor.h | 28 +------------
> 
> Looking at MAINTAINERS, monitor.h was covered by "VM EVENT, MEM ACCESS 
> and MONITOR". As you move to ...
> 
>>   xen/arch/ppc/stubs.c               |  8 ----
>>   xen/include/asm-generic/monitor.h  | 64 ++++++++++++++++++++++++++++++
> 
> ... asm-generic/, I believe it will now fall under "THE REST". So I 
> think MAINTAINERS needs to be updated to also cover asm-generic/monitor.h.
> 
> Looking at what was already committed, I think asm-generic/vm_event.h 
> should also be added in MAINTAINERS. Can you send a separate patch for 
> that?

Oh, I just noticed that we have the following entry:

xen/include/*/monitor.h

So the header is already covered. Sorry for the noise.

As the code is falling under the "VM EVENT..." subsystem, then Tamas's 
acked is technically sufficient for this patch (even for the PPC change).

But just in case you need one for Arm:

Acked-by: Julien Grall <jgrall@amazon.com>

Cheers,
Oleksii Kurochko Feb. 14, 2024, 9:09 a.m. UTC | #3
Hi Julien,

> On 13/02/2024 17:40, Julien Grall wrote:
> > Hi Oleksii,
> > 
> > On 09/02/2024 18:00, Oleksii Kurochko wrote:
> > > The header is shared between several archs so it is
> > > moved to asm-generic.
> > > 
> > > Switch partly Arm and PPC to asm-generic/monitor.h and only
> > > arch_monitor_get_capabilities() left in arch-specific/monitor.h.
> > > 
> > > Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> > > Acked-by: Jan Beulich <jbeulich@suse.com>
> > > Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
> > > ---
> > > Changes in V8:
> > >   - Add Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
> > > ---
> > > Changes in V7:
> > >   - Drop definition of arch_monitor_domctl_event for PPC.
> > >   - define arch_monitor_domctl_event in asm-generic/monitor.h.
> > >   - add "define HAS_ARCH_MONITOR_DOMCTL_EVENT" in
> > > arm/.../monitor.h as 
> > > it has arch specific implementation.
> > > ---
> > > Changes in V6:
> > >   - Rebase only.
> > > ---
> > > Changes in V5:
> > >    - Switched partly Arm and PPC to asm-generic monitor.h only
> > >      arch_monitor_get_capabilities() left in arch-
> > > specific/monitor.h.
> > >    - Updated the commit message.
> > > ---
> > > Changes in V4:
> > >   - Removed the double blank line.
> > >   - Added Acked-by: Jan Beulich <jbeulich@suse.com>.
> > >   - Update the commit message
> > > ---
> > > Changes in V3:
> > >   - Use forward-declaration of struct domain instead of "
> > > #include 
> > > <xen/sched.h> ".
> > >   - Add ' include <xen/errno.h> '
> > >   - Drop PPC's monitor.h.
> > > ---
> > > Changes in V2:
> > >     - remove inclusion of "+#include <public/domctl.h>"
> > >     - add "struct xen_domctl_monitor_op;"
> > >     - remove one of SPDX tags.
> > > ---
> > >   xen/arch/arm/include/asm/monitor.h | 25 +-----------
> > >   xen/arch/ppc/include/asm/monitor.h | 28 +------------
> > 
> > Looking at MAINTAINERS, monitor.h was covered by "VM EVENT, MEM
> > ACCESS 
> > and MONITOR". As you move to ...
> > 
> > >   xen/arch/ppc/stubs.c               |  8 ----
> > >   xen/include/asm-generic/monitor.h  | 64
> > > ++++++++++++++++++++++++++++++
> > 
> > ... asm-generic/, I believe it will now fall under "THE REST". So I
> > think MAINTAINERS needs to be updated to also cover asm-
> > generic/monitor.h.
> > 
> > Looking at what was already committed, I think asm-
> > generic/vm_event.h 
> > should also be added in MAINTAINERS. Can you send a separate patch
> > for 
> > that?
> 
> Oh, I just noticed that we have the following entry:
> 
> xen/include/*/monitor.h
> 
> So the header is already covered. Sorry for the noise.
> 
> As the code is falling under the "VM EVENT..." subsystem, then
> Tamas's 
> acked is technically sufficient for this patch (even for the PPC
> change).
> 
> But just in case you need one for Arm:
> 
> Acked-by: Julien Grall <jgrall@amazon.com>
Thanks.

~ Oleksii
diff mbox series

Patch

diff --git a/xen/arch/arm/include/asm/monitor.h b/xen/arch/arm/include/asm/monitor.h
index 7567be66bd..77a3c1a36c 100644
--- a/xen/arch/arm/include/asm/monitor.h
+++ b/xen/arch/arm/include/asm/monitor.h
@@ -25,34 +25,13 @@ 
 #include <xen/sched.h>
 #include <public/domctl.h>
 
-static inline
-void arch_monitor_allow_userspace(struct domain *d, bool allow_userspace)
-{
-}
+#define HAS_ARCH_MONITOR_DOMCTL_EVENT
 
-static inline
-int arch_monitor_domctl_op(struct domain *d, struct xen_domctl_monitor_op *mop)
-{
-    /* No arch-specific monitor ops on ARM. */
-    return -EOPNOTSUPP;
-}
+#include <asm-generic/monitor.h>
 
 int arch_monitor_domctl_event(struct domain *d,
                               struct xen_domctl_monitor_op *mop);
 
-static inline
-int arch_monitor_init_domain(struct domain *d)
-{
-    /* No arch-specific domain initialization on ARM. */
-    return 0;
-}
-
-static inline
-void arch_monitor_cleanup_domain(struct domain *d)
-{
-    /* No arch-specific domain cleanup on ARM. */
-}
-
 static inline uint32_t arch_monitor_get_capabilities(struct domain *d)
 {
     uint32_t capabilities = 0;
diff --git a/xen/arch/ppc/include/asm/monitor.h b/xen/arch/ppc/include/asm/monitor.h
index e5b0282bf1..89000dacc6 100644
--- a/xen/arch/ppc/include/asm/monitor.h
+++ b/xen/arch/ppc/include/asm/monitor.h
@@ -6,33 +6,7 @@ 
 #include <public/domctl.h>
 #include <xen/errno.h>
 
-static inline
-void arch_monitor_allow_userspace(struct domain *d, bool allow_userspace)
-{
-}
-
-static inline
-int arch_monitor_domctl_op(struct domain *d, struct xen_domctl_monitor_op *mop)
-{
-    /* No arch-specific monitor ops on PPC. */
-    return -EOPNOTSUPP;
-}
-
-int arch_monitor_domctl_event(struct domain *d,
-                              struct xen_domctl_monitor_op *mop);
-
-static inline
-int arch_monitor_init_domain(struct domain *d)
-{
-    /* No arch-specific domain initialization on PPC. */
-    return 0;
-}
-
-static inline
-void arch_monitor_cleanup_domain(struct domain *d)
-{
-    /* No arch-specific domain cleanup on PPC. */
-}
+#include <asm-generic/monitor.h>
 
 static inline uint32_t arch_monitor_get_capabilities(struct domain *d)
 {
diff --git a/xen/arch/ppc/stubs.c b/xen/arch/ppc/stubs.c
index a96e45626d..da193839bd 100644
--- a/xen/arch/ppc/stubs.c
+++ b/xen/arch/ppc/stubs.c
@@ -95,14 +95,6 @@  void arch_get_domain_info(const struct domain *d,
     BUG_ON("unimplemented");
 }
 
-/* monitor.c */
-
-int arch_monitor_domctl_event(struct domain *d,
-                              struct xen_domctl_monitor_op *mop)
-{
-    BUG_ON("unimplemented");
-}
-
 /* smp.c */
 
 void arch_flush_tlb_mask(const cpumask_t *mask)
diff --git a/xen/include/asm-generic/monitor.h b/xen/include/asm-generic/monitor.h
new file mode 100644
index 0000000000..1ade289099
--- /dev/null
+++ b/xen/include/asm-generic/monitor.h
@@ -0,0 +1,64 @@ 
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * include/asm-generic/monitor.h
+ *
+ * Arch-specific monitor_op domctl handler.
+ *
+ * Copyright (c) 2015 Tamas K Lengyel (tamas@tklengyel.com)
+ * Copyright (c) 2016, Bitdefender S.R.L.
+ *
+ */
+
+#ifndef __ASM_GENERIC_MONITOR_H__
+#define __ASM_GENERIC_MONITOR_H__
+
+#include <xen/errno.h>
+#include <xen/lib.h>
+
+struct domain;
+struct xen_domctl_monitor_op;
+
+static inline
+void arch_monitor_allow_userspace(struct domain *d, bool allow_userspace)
+{
+}
+
+static inline
+int arch_monitor_domctl_op(struct domain *d, struct xen_domctl_monitor_op *mop)
+{
+    /* No arch-specific monitor ops on GENERIC. */
+    return -EOPNOTSUPP;
+}
+
+#ifndef HAS_ARCH_MONITOR_DOMCTL_EVENT
+static inline
+int arch_monitor_domctl_event(struct domain *d,
+                              struct xen_domctl_monitor_op *mop)
+{
+    BUG_ON("unimplemented");
+}
+#endif
+
+static inline
+int arch_monitor_init_domain(struct domain *d)
+{
+    /* No arch-specific domain initialization on GENERIC. */
+    return 0;
+}
+
+static inline
+void arch_monitor_cleanup_domain(struct domain *d)
+{
+    /* No arch-specific domain cleanup on GENERIC. */
+}
+
+#endif /* __ASM_GENERIC_MONITOR_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: BSD
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */