diff mbox series

[v3,09/14] xen/asm-generic: introduce generic header altp2m.h

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

Commit Message

Oleksii K. Nov. 17, 2023, 12:24 p.m. UTC
<asm/alt2pm.h> is common between archs so it is moved to
asm-generic.

Arm and PPC were switched to asm-generic version of altp2m.h.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
Changes in V3:
 - Drop Arm and PPC's altp2m.h
 - Update the commit message.
---
Changes in V2:
	- change uint16_t to unsigned int in declaration of altp2m_vcpu_idx
	- update the commit message
---
 xen/arch/arm/include/asm/Makefile |  1 +
 xen/arch/arm/include/asm/altp2m.h | 39 -------------------------------
 xen/arch/ppc/include/asm/Makefile |  1 +
 xen/arch/ppc/include/asm/altp2m.h | 25 --------------------
 xen/include/asm-generic/altp2m.h  | 34 +++++++++++++++++++++++++++
 5 files changed, 36 insertions(+), 64 deletions(-)
 delete mode 100644 xen/arch/arm/include/asm/altp2m.h
 delete mode 100644 xen/arch/ppc/include/asm/altp2m.h
 create mode 100644 xen/include/asm-generic/altp2m.h

Comments

Michal Orzel Nov. 24, 2023, 1 p.m. UTC | #1
Hi,

On 17/11/2023 13:24, Oleksii Kurochko wrote:
> 
> 
> <asm/alt2pm.h> is common between archs so it is moved to
> asm-generic.
> 
> Arm and PPC were switched to asm-generic version of altp2m.h.
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> ---
> Changes in V3:
>  - Drop Arm and PPC's altp2m.h
>  - Update the commit message.
> ---
> Changes in V2:
>         - change uint16_t to unsigned int in declaration of altp2m_vcpu_idx
>         - update the commit message
> ---
>  xen/arch/arm/include/asm/Makefile |  1 +
>  xen/arch/arm/include/asm/altp2m.h | 39 -------------------------------
>  xen/arch/ppc/include/asm/Makefile |  1 +
>  xen/arch/ppc/include/asm/altp2m.h | 25 --------------------
>  xen/include/asm-generic/altp2m.h  | 34 +++++++++++++++++++++++++++
>  5 files changed, 36 insertions(+), 64 deletions(-)
>  delete mode 100644 xen/arch/arm/include/asm/altp2m.h
>  delete mode 100644 xen/arch/ppc/include/asm/altp2m.h
>  create mode 100644 xen/include/asm-generic/altp2m.h
> 
> diff --git a/xen/arch/arm/include/asm/Makefile b/xen/arch/arm/include/asm/Makefile
> index 36d95d6310..8221429c2c 100644
> --- a/xen/arch/arm/include/asm/Makefile
> +++ b/xen/arch/arm/include/asm/Makefile
> @@ -1,4 +1,5 @@
>  # SPDX-License-Identifier: GPL-2.0-only
> +generic-y += altp2m.h
>  generic-y += hardirq.h
>  generic-y += iocap.h
>  generic-y += paging.h
> diff --git a/xen/arch/arm/include/asm/altp2m.h b/xen/arch/arm/include/asm/altp2m.h
> deleted file mode 100644
> index df50cb2f09..0000000000
> --- a/xen/arch/arm/include/asm/altp2m.h
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -/*
> - * Alternate p2m
> - *
> - * Copyright (c) 2014, Intel Corporation.
Shouldn't this copyright be moved to generic header as well?

Apart from that:
Reviewed-by: Michal Orzel <michal.orzel@amd.com>

~Michal
Jan Beulich Nov. 24, 2023, 1:18 p.m. UTC | #2
On 24.11.2023 14:00, Michal Orzel wrote:
> On 17/11/2023 13:24, Oleksii Kurochko wrote:
>> --- a/xen/arch/arm/include/asm/altp2m.h
>> +++ /dev/null
>> @@ -1,39 +0,0 @@
>> -/*
>> - * Alternate p2m
>> - *
>> - * Copyright (c) 2014, Intel Corporation.
> Shouldn't this copyright be moved to generic header as well?

In earlier communication I raised the question whether such trivial
stubs are actually copyright-able.

Jan
Jan Beulich Nov. 24, 2023, 1:26 p.m. UTC | #3
On 17.11.2023 13:24, Oleksii Kurochko wrote:
> <asm/alt2pm.h> is common between archs so it is moved to
> asm-generic.

Here and elsewhere: The statement above can be read that the same applies
to all arch-s (in which case the header would better move to include/xen/).
Since this isn't true for x86, may I suggest to insert "several" or "some"?
Then (here)
Acked-by: Jan Beulich <jbeulich@suse.com>

Jan
Oleksii K. Nov. 27, 2023, 11:48 a.m. UTC | #4
On Fri, 2023-11-24 at 14:18 +0100, Jan Beulich wrote:
> On 24.11.2023 14:00, Michal Orzel wrote:
> > On 17/11/2023 13:24, Oleksii Kurochko wrote:
> > > --- a/xen/arch/arm/include/asm/altp2m.h
> > > +++ /dev/null
> > > @@ -1,39 +0,0 @@
> > > -/*
> > > - * Alternate p2m
> > > - *
> > > - * Copyright (c) 2014, Intel Corporation.
> > Shouldn't this copyright be moved to generic header as well?
> 
> In earlier communication I raised the question whether such trivial
> stubs are actually copyright-able.
Could you please give a link? I couldn't remember what was the decision
and why.

Thanks in advance.

~ Oleksii
Jan Beulich Nov. 27, 2023, 12:11 p.m. UTC | #5
On 27.11.2023 12:48, Oleksii wrote:
> On Fri, 2023-11-24 at 14:18 +0100, Jan Beulich wrote:
>> On 24.11.2023 14:00, Michal Orzel wrote:
>>> On 17/11/2023 13:24, Oleksii Kurochko wrote:
>>>> --- a/xen/arch/arm/include/asm/altp2m.h
>>>> +++ /dev/null
>>>> @@ -1,39 +0,0 @@
>>>> -/*
>>>> - * Alternate p2m
>>>> - *
>>>> - * Copyright (c) 2014, Intel Corporation.
>>> Shouldn't this copyright be moved to generic header as well?
>>
>> In earlier communication I raised the question whether such trivial
>> stubs are actually copyright-able.
> Could you please give a link?

I'm sorry, but no, I don't recall in the context of which patch this was.

Jan

> I couldn't remember what was the decision
> and why.
> 
> Thanks in advance.
> 
> ~ Oleksii
diff mbox series

Patch

diff --git a/xen/arch/arm/include/asm/Makefile b/xen/arch/arm/include/asm/Makefile
index 36d95d6310..8221429c2c 100644
--- a/xen/arch/arm/include/asm/Makefile
+++ b/xen/arch/arm/include/asm/Makefile
@@ -1,4 +1,5 @@ 
 # SPDX-License-Identifier: GPL-2.0-only
+generic-y += altp2m.h
 generic-y += hardirq.h
 generic-y += iocap.h
 generic-y += paging.h
diff --git a/xen/arch/arm/include/asm/altp2m.h b/xen/arch/arm/include/asm/altp2m.h
deleted file mode 100644
index df50cb2f09..0000000000
--- a/xen/arch/arm/include/asm/altp2m.h
+++ /dev/null
@@ -1,39 +0,0 @@ 
-/*
- * Alternate p2m
- *
- * Copyright (c) 2014, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __ASM_ARM_ALTP2M_H
-#define __ASM_ARM_ALTP2M_H
-
-#include <xen/sched.h>
-
-/* Alternate p2m on/off per domain */
-static inline bool altp2m_active(const struct domain *d)
-{
-    /* Not implemented on ARM. */
-    return false;
-}
-
-/* Alternate p2m VCPU */
-static inline uint16_t altp2m_vcpu_idx(const struct vcpu *v)
-{
-    /* Not implemented on ARM, should not be reached. */
-    BUG();
-    return 0;
-}
-
-#endif /* __ASM_ARM_ALTP2M_H */
diff --git a/xen/arch/ppc/include/asm/Makefile b/xen/arch/ppc/include/asm/Makefile
index b4fbcc897b..a8e848d4d0 100644
--- a/xen/arch/ppc/include/asm/Makefile
+++ b/xen/arch/ppc/include/asm/Makefile
@@ -1,4 +1,5 @@ 
 # SPDX-License-Identifier: GPL-2.0-only
+generic-y += altp2m.h
 generic-y += div64.h
 generic-y += hardirq.h
 generic-y += hypercall.h
diff --git a/xen/arch/ppc/include/asm/altp2m.h b/xen/arch/ppc/include/asm/altp2m.h
deleted file mode 100644
index bd5c9aa415..0000000000
--- a/xen/arch/ppc/include/asm/altp2m.h
+++ /dev/null
@@ -1,25 +0,0 @@ 
-/* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_PPC_ALTP2M_H__
-#define __ASM_PPC_ALTP2M_H__
-
-#include <xen/bug.h>
-
-struct domain;
-struct vcpu;
-
-/* Alternate p2m on/off per domain */
-static inline bool altp2m_active(const struct domain *d)
-{
-    /* Not implemented on PPC. */
-    return false;
-}
-
-/* Alternate p2m VCPU */
-static inline uint16_t altp2m_vcpu_idx(const struct vcpu *v)
-{
-    /* Not implemented on PPC, should not be reached. */
-    ASSERT_UNREACHABLE();
-    return 0;
-}
-
-#endif /* __ASM_PPC_ALTP2M_H__ */
diff --git a/xen/include/asm-generic/altp2m.h b/xen/include/asm-generic/altp2m.h
new file mode 100644
index 0000000000..39865a842a
--- /dev/null
+++ b/xen/include/asm-generic/altp2m.h
@@ -0,0 +1,34 @@ 
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef __ASM_GENERIC_ALTP2M_H
+#define __ASM_GENERIC_ALTP2M_H
+
+#include <xen/bug.h>
+
+struct domain;
+struct vcpu;
+
+/* Alternate p2m on/off per domain */
+static inline bool altp2m_active(const struct domain *d)
+{
+    /* Not implemented on GENERIC. */
+    return false;
+}
+
+/* Alternate p2m VCPU */
+static inline unsigned int altp2m_vcpu_idx(const struct vcpu *v)
+{
+    /* Not implemented on GENERIC, should not be reached. */
+    BUG();
+    return 0;
+}
+
+#endif /* __ASM_GENERIC_ALTP2M_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: BSD
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */