Skip to contentSkip to conversation

hw/xen/arch_hvm: Unify x86 and ARM variants

PATCH Applied Philippe Mathieu-Daudé 4 participants 6 messages May 13, 2025 – Jul 15, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/xen/arch_hvm: Unify x86 and ARM variants

As each target declares the same prototypes, we can use a single header, removing the TARGET_XXX uses.

---
 include/hw/arm/xen_arch_hvm.h  |  9 ---------
 include/hw/i386/xen_arch_hvm.h | 11 -----------
 include/hw/xen/arch_hvm.h      | 14 ++++++++++----
 hw/arm/xen-pvh.c               |  1 -
 4 files changed, 10 insertions(+), 25 deletions(-)
 delete mode 100644 include/hw/arm/xen_arch_hvm.h
 delete mode 100644 include/hw/i386/xen_arch_hvm.h
include/hw/arm/xen_arch_hvm.h deleted +0 -9
deleted file mode 100644
index 8fd645e7232..00000000000
@@ -1,9 +0,0 @@
-#ifndef HW_XEN_ARCH_ARM_HVM_H
-#define HW_XEN_ARCH_ARM_HVM_H
-
-#include <xen/hvm/ioreq.h>
-void arch_handle_ioreq(XenIOState *state, ioreq_t *req);
-void arch_xen_set_memory(XenIOState *state,
-                         MemoryRegionSection *section,
-                         bool add);
-#endif
include/hw/i386/xen_arch_hvm.h deleted +0 -11
deleted file mode 100644
index 1000f8f5433..00000000000
@@ -1,11 +0,0 @@
-#ifndef HW_XEN_ARCH_I386_HVM_H
-#define HW_XEN_ARCH_I386_HVM_H
-
-#include <xen/hvm/ioreq.h>
-#include "hw/xen/xen-hvm-common.h"
-
-void arch_handle_ioreq(XenIOState *state, ioreq_t *req);
-void arch_xen_set_memory(XenIOState *state,
-                         MemoryRegionSection *section,
-                         bool add);
-#endif
include/hw/xen/arch_hvm.h +10 -4
index df39c819c8f..8bacaa4ec41 100644
@@ -1,5 +1,11 @@
-#if defined(TARGET_I386) || defined(TARGET_X86_64)
-#include "hw/i386/xen_arch_hvm.h"
-#elif defined(TARGET_ARM) || defined(TARGET_AARCH64)
-#include "hw/arm/xen_arch_hvm.h"
+#ifndef HW_XEN_ARCH_HVM_H
+#define HW_XEN_ARCH_HVM_H
+
+#include <xen/hvm/ioreq.h>
+#include "hw/xen/xen-hvm-common.h"
+
+void arch_handle_ioreq(XenIOState *state, ioreq_t *req);
+void arch_xen_set_memory(XenIOState *state,
+                         MemoryRegionSection *section,
+                         bool add);
 #endif
hw/arm/xen-pvh.c +0 -1
index 4b26bcff7a5..1a9eeb01c8e 100644
@@ -10,7 +10,6 @@
 #include "hw/boards.h"
 #include "system/system.h"
 #include "hw/xen/xen-pvh-common.h"
-#include "hw/xen/arch_hvm.h"
 
 #define TYPE_XEN_ARM  MACHINE_TYPE_NAME("xenpvh")
 
Signature · 1 line
2.47.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 70 lines · Philippe Mathieu-Daudé

As each target declares the same prototypes, we can use a single header, removing the TARGET_XXX uses.

---
  include/hw/arm/xen_arch_hvm.h  |  9 ---------
  include/hw/i386/xen_arch_hvm.h | 11 -----------
  include/hw/xen/arch_hvm.h      | 14 ++++++++++----
  hw/arm/xen-pvh.c               |  1 -
  4 files changed, 10 insertions(+), 25 deletions(-)

delete mode 100644 include/hw/arm/xen_arch_hvm.h delete mode 100644 include/hw/i386/xen_arch_hvm.h

include/hw/arm/xen_arch_hvm.h deleted +0 -9
deleted file mode 100644
index 8fd645e7232..00000000000
@@ -1,9 +0,0 @@
-#ifndef HW_XEN_ARCH_ARM_HVM_H
-#define HW_XEN_ARCH_ARM_HVM_H
-
-#include <xen/hvm/ioreq.h>
-void arch_handle_ioreq(XenIOState *state, ioreq_t *req);
-void arch_xen_set_memory(XenIOState *state,
-                         MemoryRegionSection *section,
-                         bool add);
-#endif
include/hw/i386/xen_arch_hvm.h deleted +0 -11
deleted file mode 100644
index 1000f8f5433..00000000000
@@ -1,11 +0,0 @@
-#ifndef HW_XEN_ARCH_I386_HVM_H
-#define HW_XEN_ARCH_I386_HVM_H
-
-#include <xen/hvm/ioreq.h>
-#include "hw/xen/xen-hvm-common.h"
-
-void arch_handle_ioreq(XenIOState *state, ioreq_t *req);
-void arch_xen_set_memory(XenIOState *state,
-                         MemoryRegionSection *section,
-                         bool add);
-#endif
include/hw/xen/arch_hvm.h +10 -4
index df39c819c8f..8bacaa4ec41 100644
@@ -1,5 +1,11 @@
-#if defined(TARGET_I386) || defined(TARGET_X86_64)
-#include "hw/i386/xen_arch_hvm.h"
-#elif defined(TARGET_ARM) || defined(TARGET_AARCH64)
-#include "hw/arm/xen_arch_hvm.h"
+#ifndef HW_XEN_ARCH_HVM_H
+#define HW_XEN_ARCH_HVM_H
+
+#include <xen/hvm/ioreq.h>
+#include "hw/xen/xen-hvm-common.h"
+
+void arch_handle_ioreq(XenIOState *state, ioreq_t *req);
+void arch_xen_set_memory(XenIOState *state,
+                         MemoryRegionSection *section,
+                         bool add);
  #endif
hw/arm/xen-pvh.c +0 -0
index 4b26bcff7a5..1a9eeb01c8e 100644

hw/arm/xen-pvh.c line 15

Quoted 7 lines
hw/arm/xen-pvh.c +0 -1
@@ -10,7 +10,6 @@
  #include "hw/boards.h"
  #include "system/system.h"
  #include "hw/xen/xen-pvh-common.h"
-#include "hw/xen/arch_hvm.h"
 
  #define TYPE_XEN_ARM  MACHINE_TYPE_NAME("xenpvh")
 
Reviewed-by on v1 1/1
#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 4 lines · Philippe Mathieu-Daudé

As each target declares the same prototypes, we can use a single header, removing the TARGET_XXX uses.

Quoted 76 lines
---
 include/hw/arm/xen_arch_hvm.h  |  9 ---------
 include/hw/i386/xen_arch_hvm.h | 11 -----------
 include/hw/xen/arch_hvm.h      | 14 ++++++++++----
 hw/arm/xen-pvh.c               |  1 -
 4 files changed, 10 insertions(+), 25 deletions(-)
 delete mode 100644 include/hw/arm/xen_arch_hvm.h
 delete mode 100644 include/hw/i386/xen_arch_hvm.h
include/hw/arm/xen_arch_hvm.h deleted +0 -9
deleted file mode 100644
index 8fd645e7232..00000000000
@@ -1,9 +0,0 @@
-#ifndef HW_XEN_ARCH_ARM_HVM_H
-#define HW_XEN_ARCH_ARM_HVM_H
-
-#include <xen/hvm/ioreq.h>
-void arch_handle_ioreq(XenIOState *state, ioreq_t *req);
-void arch_xen_set_memory(XenIOState *state,
-                         MemoryRegionSection *section,
-                         bool add);
-#endif
include/hw/i386/xen_arch_hvm.h deleted +0 -11
deleted file mode 100644
index 1000f8f5433..00000000000
@@ -1,11 +0,0 @@
-#ifndef HW_XEN_ARCH_I386_HVM_H
-#define HW_XEN_ARCH_I386_HVM_H
-
-#include <xen/hvm/ioreq.h>
-#include "hw/xen/xen-hvm-common.h"
-
-void arch_handle_ioreq(XenIOState *state, ioreq_t *req);
-void arch_xen_set_memory(XenIOState *state,
-                         MemoryRegionSection *section,
-                         bool add);
-#endif
include/hw/xen/arch_hvm.h +10 -4
index df39c819c8f..8bacaa4ec41 100644
@@ -1,5 +1,11 @@
-#if defined(TARGET_I386) || defined(TARGET_X86_64)
-#include "hw/i386/xen_arch_hvm.h"
-#elif defined(TARGET_ARM) || defined(TARGET_AARCH64)
-#include "hw/arm/xen_arch_hvm.h"
+#ifndef HW_XEN_ARCH_HVM_H
+#define HW_XEN_ARCH_HVM_H
+
+#include <xen/hvm/ioreq.h>
+#include "hw/xen/xen-hvm-common.h"
+
+void arch_handle_ioreq(XenIOState *state, ioreq_t *req);
+void arch_xen_set_memory(XenIOState *state,
+                         MemoryRegionSection *section,
+                         bool add);
 #endif
hw/arm/xen-pvh.c +0 -1
index 4b26bcff7a5..1a9eeb01c8e 100644
@@ -10,7 +10,6 @@
 #include "hw/boards.h"
 #include "system/system.h"
 #include "hw/xen/xen-pvh-common.h"
-#include "hw/xen/arch_hvm.h"
 
 #define TYPE_XEN_ARM  MACHINE_TYPE_NAME("xenpvh")
 
Signature · 1 line
2.47.1
#3 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 4 lines · Philippe Mathieu-Daudé

As each target declares the same prototypes, we can use a single header, removing the TARGET_XXX uses.

...

hw/arm/xen-pvh.c line 15

Quoted 12 lines
hw/arm/xen-pvh.c +0 -1
index 4b26bcff7a5..1a9eeb01c8e 100644
@@ -10,7 +10,6 @@
  #include "hw/boards.h"
  #include "system/system.h"
  #include "hw/xen/xen-pvh-common.h"
-#include "hw/xen/arch_hvm.h"
 
  #define TYPE_XEN_ARM  MACHINE_TYPE_NAME("xenpvh")
 

This chunk seems unrelated.

#4 lore raw
Quoted 6 lines · Xiaoyao Li
Quoted 4 lines · Philippe Mathieu-Daudé

As each target declares the same prototypes, we can use a single header, removing the TARGET_XXX uses.

...

Quoted 12 lines

hw/arm/xen-pvh.c line 13

Quoted 10 lines
hw/arm/xen-pvh.c +0 -1
index 4b26bcff7a5..1a9eeb01c8e 100644
@@ -10,7 +10,6 @@
   #include "hw/boards.h"
   #include "system/system.h"
   #include "hw/xen/xen-pvh-common.h"
-#include "hw/xen/arch_hvm.h"
   #define TYPE_XEN_ARM  MACHINE_TYPE_NAME("xenpvh")

This chunk seems unrelated.

I'll split in 2 patches, thanks.

#5 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 4 lines · Philippe Mathieu-Daudé

As each target declares the same prototypes, we can use a single header, removing the TARGET_XXX uses.

Quoted 8 lines
---
  include/hw/arm/xen_arch_hvm.h  |  9 ---------
  include/hw/i386/xen_arch_hvm.h | 11 -----------
  include/hw/xen/arch_hvm.h      | 14 ++++++++++----
  hw/arm/xen-pvh.c               |  1 -
  4 files changed, 10 insertions(+), 25 deletions(-)

delete mode 100644 include/hw/arm/xen_arch_hvm.h delete mode 100644 include/hw/i386/xen_arch_hvm.h

Queued, thanks.