Skip to contentSkip to conversation

iommu/hyperv: Create hyperv subdirectory under drivers/iommu

PATCH Superseded Mukesh R 2 participants 6 messages May 29 – Jun 2

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Mukesh R

author
#0 lore raw

PATCH 1/1 iommu/hyperv: Create hyperv subdirectory under drivers/iommu

Create hyperv subdirectory under drivers/iommu in anticipation of more hyperv related files from upcoming PCI passthru and pv-IOMMU patches. Also, the current file hyperv-iommu.c actually implements irq remapping, so rename to more appropriate hv-irq-remap.c and move it under the new hyperv subdirectory. Since this file implements irq_remap_ops exposed by drivers/iommu/irq_remapping.h, it cannot be relocated to the irq directory. This is in sync with other backend directories like amd and intel there.

Lastly, this file should not be tied to CONFIG_HYPERV_IOMMU, but to CONFIG_HYPERV and CONFIG_IRQ_REMAP.

---
 MAINTAINERS                                             | 2 +-
 drivers/iommu/Kconfig                                   | 9 ---------
 drivers/iommu/Makefile                                  | 2 +-
 drivers/iommu/hyperv/Makefile                           | 2 ++
 drivers/iommu/{hyperv-iommu.c => hyperv/hv-irq-remap.c} | 8 +-------
 drivers/iommu/irq_remapping.c                           | 2 +-
 6 files changed, 6 insertions(+), 19 deletions(-)
 create mode 100644 drivers/iommu/hyperv/Makefile
 rename drivers/iommu/{hyperv-iommu.c => hyperv/hv-irq-remap.c} (99%)
MAINTAINERS +1 -1
index b539be153f6a..93a7105e9cef 100644
@@ -11988,7 +11988,7 @@ F:	drivers/clocksource/hyperv_timer.c
 F:	drivers/hid/hid-hyperv.c
 F:	drivers/hv/
 F:	drivers/input/serio/hyperv-keyboard.c
-F:	drivers/iommu/hyperv-iommu.c
+F:	drivers/iommu/hyperv/
 F:	drivers/net/ethernet/microsoft/
 F:	drivers/net/hyperv/
 F:	drivers/pci/controller/pci-hyperv-intf.c
drivers/iommu/Kconfig +0 -9
index f86262b11416..1becc0f20222 100644
@@ -351,15 +351,6 @@ config MTK_IOMMU_V1
 
 	  if unsure, say N here.
 
-config HYPERV_IOMMU
-	bool "Hyper-V IRQ Handling"
-	depends on HYPERV && X86
-	select IOMMU_API
-	default HYPERV
-	help
-	  Stub IOMMU driver to handle IRQs to support Hyper-V Linux
-	  guest and root partitions.
-
 config VIRTIO_IOMMU
 	tristate "Virtio IOMMU driver"
 	depends on VIRTIO
drivers/iommu/Makefile +1 -1
index 0275821f4ef9..d9683422aecb 100644
@@ -4,6 +4,7 @@ obj-$(CONFIG_AMD_IOMMU) += amd/
 obj-$(CONFIG_INTEL_IOMMU) += intel/
 obj-$(CONFIG_RISCV_IOMMU) += riscv/
 obj-$(CONFIG_GENERIC_PT) += generic_pt/fmt/
+obj-$(CONFIG_HYPERV) += hyperv/
 obj-$(CONFIG_IOMMU_API) += iommu.o
 obj-$(CONFIG_IOMMU_SUPPORT) += iommu-pages.o
 obj-$(CONFIG_IOMMU_API) += iommu-traces.o
@@ -30,7 +31,6 @@ obj-$(CONFIG_TEGRA_IOMMU_SMMU) += tegra-smmu.o
 obj-$(CONFIG_EXYNOS_IOMMU) += exynos-iommu.o
 obj-$(CONFIG_FSL_PAMU) += fsl_pamu.o fsl_pamu_domain.o
 obj-$(CONFIG_S390_IOMMU) += s390-iommu.o
-obj-$(CONFIG_HYPERV_IOMMU) += hyperv-iommu.o
 obj-$(CONFIG_VIRTIO_IOMMU) += virtio-iommu.o
 obj-$(CONFIG_IOMMU_SVA) += iommu-sva.o
 obj-$(CONFIG_IOMMU_IOPF) += io-pgfault.o
drivers/iommu/hyperv/Makefile new file +2 -0
new file mode 100644
index 000000000000..0053e00e08e6
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_IRQ_REMAP) += hv-irq-remap.o
drivers/iommu/hyperv/hv-irq-remap.c renamed from drivers/iommu/hyperv-iommu.c +1 -7
similarity index 99%
rename from drivers/iommu/hyperv-iommu.c
rename to drivers/iommu/hyperv/hv-irq-remap.c
index 479103261ae6..b34ee9589190 100644
@@ -7,13 +7,11 @@
  *
  * Author : Lan Tianyu <[email protected]>
  */
-
 #include <linux/types.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/iommu.h>
 #include <linux/module.h>
-
 #include <asm/apic.h>
 #include <asm/cpu.h>
 #include <asm/hw_irq.h>
@@ -22,9 +20,7 @@
 #include <asm/hypervisor.h>
 #include <asm/mshyperv.h>
 
-#include "irq_remapping.h"
-
-#ifdef CONFIG_IRQ_REMAP
+#include "../irq_remapping.h"
 
 /*
  * According 82093AA IO-APIC spec , IO APIC has a 24-entry Interrupt
@@ -330,5 +326,3 @@ static const struct irq_domain_ops hyperv_root_ir_domain_ops = {
 	.alloc = hyperv_root_irq_remapping_alloc,
 	.free = hyperv_root_irq_remapping_free,
 };
-
-#endif
drivers/iommu/irq_remapping.c +1 -1
index c2443659812a..41bf65e4ea88 100644
@@ -108,7 +108,7 @@ int __init irq_remapping_prepare(void)
 	else if (IS_ENABLED(CONFIG_AMD_IOMMU) &&
 		 amd_iommu_irq_ops.prepare() == 0)
 		remap_ops = &amd_iommu_irq_ops;
-	else if (IS_ENABLED(CONFIG_HYPERV_IOMMU) &&
+	else if (IS_ENABLED(CONFIG_HYPERV) &&
 		 hyperv_irq_remap_ops.prepare() == 0)
 		remap_ops = &hyperv_irq_remap_ops;
 	else
Signature · 1 line
2.51.2.vfs.0.1
#1 lore raw

Hi Mukesh,

Quoted 83 lines · On Thu, 28 May 2026 18:41:48 -0700 Mukesh R <[email protected]> wrote:

Create hyperv subdirectory under drivers/iommu in anticipation of more hyperv related files from upcoming PCI passthru and pv-IOMMU patches. Also, the current file hyperv-iommu.c actually implements irq remapping, so rename to more appropriate hv-irq-remap.c and move it under the new hyperv subdirectory. Since this file implements irq_remap_ops exposed by drivers/iommu/irq_remapping.h, it cannot be relocated to the irq directory. This is in sync with other backend directories like amd and intel there.

Lastly, this file should not be tied to CONFIG_HYPERV_IOMMU, but to CONFIG_HYPERV and CONFIG_IRQ_REMAP.

---
 MAINTAINERS                                             | 2 +-
 drivers/iommu/Kconfig                                   | 9 ---------
 drivers/iommu/Makefile                                  | 2 +-
 drivers/iommu/hyperv/Makefile                           | 2 ++
 drivers/iommu/{hyperv-iommu.c => hyperv/hv-irq-remap.c} | 8 +-------
 drivers/iommu/irq_remapping.c                           | 2 +-
 6 files changed, 6 insertions(+), 19 deletions(-)
 create mode 100644 drivers/iommu/hyperv/Makefile
 rename drivers/iommu/{hyperv-iommu.c => hyperv/hv-irq-remap.c} (99%)
MAINTAINERS +1 -1
index b539be153f6a..93a7105e9cef 100644
@@ -11988,7 +11988,7 @@ F:	drivers/clocksource/hyperv_timer.c
 F:	drivers/hid/hid-hyperv.c
 F:	drivers/hv/
 F:	drivers/input/serio/hyperv-keyboard.c
-F:	drivers/iommu/hyperv-iommu.c
+F:	drivers/iommu/hyperv/
 F:	drivers/net/ethernet/microsoft/
 F:	drivers/net/hyperv/
 F:	drivers/pci/controller/pci-hyperv-intf.c
drivers/iommu/Kconfig +0 -9
index f86262b11416..1becc0f20222 100644
@@ -351,15 +351,6 @@ config MTK_IOMMU_V1
 
 	  if unsure, say N here.
 
-config HYPERV_IOMMU
-	bool "Hyper-V IRQ Handling"
-	depends on HYPERV && X86
-	select IOMMU_API
-	default HYPERV
-	help
-	  Stub IOMMU driver to handle IRQs to support Hyper-V Linux
-	  guest and root partitions.
-
 config VIRTIO_IOMMU
 	tristate "Virtio IOMMU driver"
 	depends on VIRTIO
drivers/iommu/Makefile +1 -1
index 0275821f4ef9..d9683422aecb 100644
@@ -4,6 +4,7 @@ obj-$(CONFIG_AMD_IOMMU) += amd/
 obj-$(CONFIG_INTEL_IOMMU) += intel/
 obj-$(CONFIG_RISCV_IOMMU) += riscv/
 obj-$(CONFIG_GENERIC_PT) += generic_pt/fmt/
+obj-$(CONFIG_HYPERV) += hyperv/
 obj-$(CONFIG_IOMMU_API) += iommu.o
 obj-$(CONFIG_IOMMU_SUPPORT) += iommu-pages.o
 obj-$(CONFIG_IOMMU_API) += iommu-traces.o
@@ -30,7 +31,6 @@ obj-$(CONFIG_TEGRA_IOMMU_SMMU) += tegra-smmu.o
 obj-$(CONFIG_EXYNOS_IOMMU) += exynos-iommu.o
 obj-$(CONFIG_FSL_PAMU) += fsl_pamu.o fsl_pamu_domain.o
 obj-$(CONFIG_S390_IOMMU) += s390-iommu.o
-obj-$(CONFIG_HYPERV_IOMMU) += hyperv-iommu.o
 obj-$(CONFIG_VIRTIO_IOMMU) += virtio-iommu.o
 obj-$(CONFIG_IOMMU_SVA) += iommu-sva.o
 obj-$(CONFIG_IOMMU_IOPF) += io-pgfault.o
(quoted diff) +0 -0

b/drivers/iommu/hyperv/Makefile new file mode 100644 index 000000000000..0053e00e08e6

drivers/iommu/hyperv/Makefile line 2

Quoted 2 lines
drivers/iommu/hyperv/Makefile new file +2 -0
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_IRQ_REMAP) += hv-irq-remap.o

Should the name be x86 specific? This file will never be built for ARM because:
CONFIG_IRQ_REMAP depends on:
depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI

perhaps, hv-x86-irq-remap.c? hv-irq-remap.c sounds like a generic Hyper-V IRQ-remapping backend and may be misleading once arm64 Hyper-V IOMMU/interrupt support grows under this directory.

Quoted 51 lines
(quoted diff) +0 -0

b/drivers/iommu/hyperv/hv-irq-remap.c similarity index 99% rename from drivers/iommu/hyperv-iommu.c
rename to drivers/iommu/hyperv/hv-irq-remap.c index 479103261ae6..b34ee9589190 100644

drivers/iommu/hyperv/hv-irq-remap.c renamed from drivers/iommu/hyperv-iommu.c +1 -5
@@ -7,13 +7,11 @@
  *
  * Author : Lan Tianyu <[email protected]>
  */
-
 #include <linux/types.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/iommu.h>
 #include <linux/module.h>
-
 #include <asm/apic.h>
 #include <asm/cpu.h>
 #include <asm/hw_irq.h>
@@ -22,9 +20,7 @@
 #include <asm/hypervisor.h>
 #include <asm/mshyperv.h>
 
-#include "irq_remapping.h"
-
-#ifdef CONFIG_IRQ_REMAP
+#include "../irq_remapping.h"
 
 /*
  * According 82093AA IO-APIC spec , IO APIC has a 24-entry Interrupt
@@ -330,5 +326,3 @@ static const struct irq_domain_ops

hyperv_root_ir_domain_ops = { .alloc =
hyperv_root_irq_remapping_alloc, .free =
hyperv_root_irq_remapping_free, };

drivers/iommu/hyperv/hv-irq-remap.c renamed from drivers/iommu/hyperv-iommu.c +0 -2
-
-#endif
(quoted diff) +0 -0

b/drivers/iommu/irq_remapping.c index c2443659812a..41bf65e4ea88 100644 --- a/drivers/iommu/irq_remapping.c
+++ b/drivers/iommu/irq_remapping.c

drivers/iommu/irq_remapping.c +1 -1
@@ -108,7 +108,7 @@ int __init irq_remapping_prepare(void)
 	else if (IS_ENABLED(CONFIG_AMD_IOMMU) &&
 		 amd_iommu_irq_ops.prepare() == 0)
 		remap_ops = &amd_iommu_irq_ops;
-	else if (IS_ENABLED(CONFIG_HYPERV_IOMMU) &&
+	else if (IS_ENABLED(CONFIG_HYPERV) &&
 		 hyperv_irq_remap_ops.prepare() == 0)
 		remap_ops = &hyperv_irq_remap_ops;
 	else
author
#2 lore raw
Quoted 95 lines · Jacob Pan

Hi Mukesh,

Quoted 83 lines · On Thu, 28 May 2026 18:41:48 -0700 Mukesh R <[email protected]> wrote:

Create hyperv subdirectory under drivers/iommu in anticipation of more hyperv related files from upcoming PCI passthru and pv-IOMMU patches. Also, the current file hyperv-iommu.c actually implements irq remapping, so rename to more appropriate hv-irq-remap.c and move it under the new hyperv subdirectory. Since this file implements irq_remap_ops exposed by drivers/iommu/irq_remapping.h, it cannot be relocated to the irq directory. This is in sync with other backend directories like amd and intel there.

Lastly, this file should not be tied to CONFIG_HYPERV_IOMMU, but to CONFIG_HYPERV and CONFIG_IRQ_REMAP.

---
  MAINTAINERS                                             | 2 +-
  drivers/iommu/Kconfig                                   | 9 ---------
  drivers/iommu/Makefile                                  | 2 +-
  drivers/iommu/hyperv/Makefile                           | 2 ++
  drivers/iommu/{hyperv-iommu.c => hyperv/hv-irq-remap.c} | 8 +-------
  drivers/iommu/irq_remapping.c                           | 2 +-
  6 files changed, 6 insertions(+), 19 deletions(-)

create mode 100644 drivers/iommu/hyperv/Makefile
rename drivers/iommu/{hyperv-iommu.c => hyperv/hv-irq-remap.c} (99%)

MAINTAINERS +1 -1
index b539be153f6a..93a7105e9cef 100644
@@ -11988,7 +11988,7 @@ F:	drivers/clocksource/hyperv_timer.c
  F:	drivers/hid/hid-hyperv.c
  F:	drivers/hv/
  F:	drivers/input/serio/hyperv-keyboard.c
-F:	drivers/iommu/hyperv-iommu.c
+F:	drivers/iommu/hyperv/
  F:	drivers/net/ethernet/microsoft/
  F:	drivers/net/hyperv/
  F:	drivers/pci/controller/pci-hyperv-intf.c
drivers/iommu/Kconfig +0 -9
index f86262b11416..1becc0f20222 100644
@@ -351,15 +351,6 @@ config MTK_IOMMU_V1
 
  	  if unsure, say N here.
 
-config HYPERV_IOMMU
-	bool "Hyper-V IRQ Handling"
-	depends on HYPERV && X86
-	select IOMMU_API
-	default HYPERV
-	help
-	  Stub IOMMU driver to handle IRQs to support Hyper-V Linux
-	  guest and root partitions.
-
  config VIRTIO_IOMMU
  	tristate "Virtio IOMMU driver"
  	depends on VIRTIO
drivers/iommu/Makefile +1 -1
index 0275821f4ef9..d9683422aecb 100644
@@ -4,6 +4,7 @@ obj-$(CONFIG_AMD_IOMMU) += amd/
  obj-$(CONFIG_INTEL_IOMMU) += intel/
  obj-$(CONFIG_RISCV_IOMMU) += riscv/
  obj-$(CONFIG_GENERIC_PT) += generic_pt/fmt/
+obj-$(CONFIG_HYPERV) += hyperv/
  obj-$(CONFIG_IOMMU_API) += iommu.o
  obj-$(CONFIG_IOMMU_SUPPORT) += iommu-pages.o
  obj-$(CONFIG_IOMMU_API) += iommu-traces.o
@@ -30,7 +31,6 @@ obj-$(CONFIG_TEGRA_IOMMU_SMMU) += tegra-smmu.o
  obj-$(CONFIG_EXYNOS_IOMMU) += exynos-iommu.o
  obj-$(CONFIG_FSL_PAMU) += fsl_pamu.o fsl_pamu_domain.o
  obj-$(CONFIG_S390_IOMMU) += s390-iommu.o
-obj-$(CONFIG_HYPERV_IOMMU) += hyperv-iommu.o
  obj-$(CONFIG_VIRTIO_IOMMU) += virtio-iommu.o
  obj-$(CONFIG_IOMMU_SVA) += iommu-sva.o
  obj-$(CONFIG_IOMMU_IOPF) += io-pgfault.o
(quoted diff) +0 -0

b/drivers/iommu/hyperv/Makefile new file mode 100644 index 000000000000..0053e00e08e6

drivers/iommu/hyperv/Makefile line 2

Quoted 2 lines
drivers/iommu/hyperv/Makefile new file +2 -0
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_IRQ_REMAP) += hv-irq-remap.o

Should the name be x86 specific? This file will never be built for ARM because:
CONFIG_IRQ_REMAP depends on:
depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI

Quoted 3 lines

perhaps, hv-x86-irq-remap.c? hv-irq-remap.c sounds like a generic Hyper-V IRQ-remapping backend and may be misleading once arm64 Hyper-V IOMMU/interrupt support grows under this directory.

we could, but looking at early version of hyperv-iommu-arm.c, it looks very similar, and so if there are very few ifdefs, we could just keep one file rather than replicating bunch of code.

Thanks,
-Mukesh

Quoted 51 lines
Quoted 51 lines
(quoted diff) +0 -0

b/drivers/iommu/hyperv/hv-irq-remap.c similarity index 99% rename from drivers/iommu/hyperv-iommu.c
rename to drivers/iommu/hyperv/hv-irq-remap.c index 479103261ae6..b34ee9589190 100644

drivers/iommu/hyperv/hv-irq-remap.c renamed from drivers/iommu/hyperv-iommu.c +1 -5
@@ -7,13 +7,11 @@
   *
   * Author : Lan Tianyu <[email protected]>
   */
-
  #include <linux/types.h>
  #include <linux/interrupt.h>
  #include <linux/irq.h>
  #include <linux/iommu.h>
  #include <linux/module.h>
-
  #include <asm/apic.h>
  #include <asm/cpu.h>
  #include <asm/hw_irq.h>
@@ -22,9 +20,7 @@
  #include <asm/hypervisor.h>
  #include <asm/mshyperv.h>
 
-#include "irq_remapping.h"
-
-#ifdef CONFIG_IRQ_REMAP
+#include "../irq_remapping.h"
 
  /*
   * According 82093AA IO-APIC spec , IO APIC has a 24-entry Interrupt
@@ -330,5 +326,3 @@ static const struct irq_domain_ops

hyperv_root_ir_domain_ops = { .alloc =
hyperv_root_irq_remapping_alloc, .free =
hyperv_root_irq_remapping_free, };

drivers/iommu/hyperv/hv-irq-remap.c renamed from drivers/iommu/hyperv-iommu.c +0 -2
-
-#endif
(quoted diff) +0 -0

b/drivers/iommu/irq_remapping.c index c2443659812a..41bf65e4ea88 100644 --- a/drivers/iommu/irq_remapping.c
+++ b/drivers/iommu/irq_remapping.c

drivers/iommu/irq_remapping.c +1 -1
@@ -108,7 +108,7 @@ int __init irq_remapping_prepare(void)
  	else if (IS_ENABLED(CONFIG_AMD_IOMMU) &&
  		 amd_iommu_irq_ops.prepare() == 0)
  		remap_ops = &amd_iommu_irq_ops;
-	else if (IS_ENABLED(CONFIG_HYPERV_IOMMU) &&
+	else if (IS_ENABLED(CONFIG_HYPERV) &&
  		 hyperv_irq_remap_ops.prepare() == 0)
  		remap_ops = &hyperv_irq_remap_ops;
  	else
#3 lore raw

Hi Mukesh,

Quoted 13 lines · On Mon, 1 Jun 2026 14:23:18 -0700 Mukesh R <[email protected]> wrote:
Quoted 13 lines

drivers/iommu/hyperv/Makefile line 2

Quoted 8 lines
(quoted diff) +0 -0

b/drivers/iommu/hyperv/Makefile new file mode 100644 index 000000000000..0053e00e08e6

drivers/iommu/hyperv/Makefile new file +2 -0
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_IRQ_REMAP) += hv-irq-remap.o  

Should the name be x86 specific? This file will never be built for ARM because:
CONFIG_IRQ_REMAP depends on:
depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI

Quoted 7 lines
Quoted 3 lines

perhaps, hv-x86-irq-remap.c? hv-irq-remap.c sounds like a generic Hyper-V IRQ-remapping backend and may be misleading once arm64 Hyper-V IOMMU/interrupt support grows under this directory.

we could, but looking at early version of hyperv-iommu-arm.c, it looks very similar, and so if there are very few ifdefs, we could just keep one file rather than replicating bunch of code.

With this patch as is, how could you keep one file for both ARM and X86 where hv-irq-remap.c does not build on ARM?

author
#4 lore raw
Quoted 22 lines · Jacob Pan

Hi Mukesh,

Quoted 17 lines · On Mon, 1 Jun 2026 14:23:18 -0700 Mukesh R <[email protected]> wrote:
Quoted 16 lines

drivers/iommu/hyperv/Makefile line 2

Quoted 8 lines
(quoted diff) +0 -0

b/drivers/iommu/hyperv/Makefile new file mode 100644 index 000000000000..0053e00e08e6

drivers/iommu/hyperv/Makefile new file +2 -0
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_IRQ_REMAP) += hv-irq-remap.o

Should the name be x86 specific? This file will never be built for ARM because:
CONFIG_IRQ_REMAP depends on:

   depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI

perhaps, hv-x86-irq-remap.c? hv-irq-remap.c sounds like a generic Hyper-V IRQ-remapping backend and may be misleading once arm64 Hyper-V IOMMU/interrupt support grows under this directory.

Quoted 6 lines
Quoted 3 lines

we could, but looking at early version of hyperv-iommu-arm.c, it looks very similar, and so if there are very few ifdefs, we could just keep one file rather than replicating bunch of code.

With this patch as is, how could you keep one file for both ARM and X86 where hv-irq-remap.c does not build on ARM?

By removing the x86 restriction from kconfig once arm changes are merged in and tested by arm folks. So, arm folks do their changes, test on arm, and if very small delta, just change this file and remove x86 restriction.

author
#5 lore raw
In reply to Jacob Pan
Quoted 22 lines · Jacob Pan

Hi Mukesh,

Quoted 17 lines · On Mon, 1 Jun 2026 14:23:18 -0700 Mukesh R <[email protected]> wrote:
Quoted 16 lines

drivers/iommu/hyperv/Makefile line 2

Quoted 8 lines
(quoted diff) +0 -0

b/drivers/iommu/hyperv/Makefile new file mode 100644 index 000000000000..0053e00e08e6

drivers/iommu/hyperv/Makefile new file +2 -0
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_IRQ_REMAP) += hv-irq-remap.o

Should the name be x86 specific? This file will never be built for ARM because:
CONFIG_IRQ_REMAP depends on:

   depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI

perhaps, hv-x86-irq-remap.c? hv-irq-remap.c sounds like a generic Hyper-V IRQ-remapping backend and may be misleading once arm64 Hyper-V IOMMU/interrupt support grows under this directory.

Quoted 6 lines
Quoted 3 lines

we could, but looking at early version of hyperv-iommu-arm.c, it looks very similar, and so if there are very few ifdefs, we could just keep one file rather than replicating bunch of code.

With this patch as is, how could you keep one file for both ARM and X86 where hv-irq-remap.c does not build on ARM?

We can remove the x86 restriction, make sure it builds on arm. Then during arm patch, I can help decide whether to fork or just add ifdefs in the file. I'll submit V2 with x86 restriction removed.

Thanks,
-Mukesh