Skip to contentSkip to conversation

iommu/hyperv: Create hyperv subdirectory under iommu

PATCH In review Mukesh R 2 participants 3 messages May 26 – May 27

Subsystems (2)
lore
Share & tools
lore

Mukesh R

author
#0 lore raw

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

Create hyperv subdirectory under drivers/iommu in anticipation of more hyperv related files for 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. Lastly, this file should not be tied to CONFIG_HYPERV_IOMMU, but to CONFIG_HYPERV and CONFIG_IRQ_REMAP.

---
 MAINTAINERS                                             | 2 +-
 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 +-
 5 files changed, 6 insertions(+), 10 deletions(-)
 create mode 100644 drivers/iommu/hyperv/Makefile
 rename drivers/iommu/{hyperv-iommu.c => hyperv/hv-irq-remap.c} (99%)
MAINTAINERS +1 -1
index d1cc0e12fe1f..b651ee0c6e6b 100644
@@ -11914,7 +11914,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/hv-irq-remap.c
 F:	drivers/net/ethernet/microsoft/
 F:	drivers/net/hyperv/
 F:	drivers/pci/controller/pci-hyperv-intf.c
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
Quoted 7 lines · Mukesh R

Create hyperv subdirectory under drivers/iommu in anticipation of more hyperv related files for 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. Lastly, this file should not be tied to CONFIG_HYPERV_IOMMU, but to CONFIG_HYPERV and CONFIG_IRQ_REMAP.

Thanks for this pathch, Mukesh!

Jason raised a question about whether Hyper-V's IRQ remapping file belongs under drivers/iommu/hyperv/ at all, since unlike Intel/AMD, Hyper-V's IRQ remapping is not co-mingled with the IOMMU hardware:

	https://lore.kernel.org/all/[email protected]/

Though we don't end up moving it elsewhere (the IRQ remapping framework and its internal header, irq_remapping.h, live under drivers/iommu/, and all existing backends sit alongside them), it would be good to acknowledge this in the commit message and explain the rationale,

Quoted 37 lines
---
 MAINTAINERS                                             | 2 +-
 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 +-
 5 files changed, 6 insertions(+), 10 deletions(-)
 create mode 100644 drivers/iommu/hyperv/Makefile
 rename drivers/iommu/{hyperv-iommu.c => hyperv/hv-irq-remap.c} (99%)
MAINTAINERS +1 -1
index d1cc0e12fe1f..b651ee0c6e6b 100644
@@ -11914,7 +11914,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/hv-irq-remap.c
 F:	drivers/net/ethernet/microsoft/
 F:	drivers/net/hyperv/
 F:	drivers/pci/controller/pci-hyperv-intf.c
drivers/iommu/Makefile +1 -0
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

drivers/iommu/Makefile obj-$(CONFIG_TEGRA_IOMMU_SMMU) += tegra-smmu.o · line 33

Quoted 4 lines
drivers/iommu/Makefile +0 -1
@@ -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

Any reason why we are removing the CONFIG_HYPERV_IOMMU? You are leaving CONFIG_HYPERV_IOMMU an orphan configuration now (and also the backward compatibility issue?).

drivers/iommu/Makefile obj-$(CONFIG_TEGRA_IOMMU_SMMU) += tegra-smmu.o · line 36

Quoted 3 lines
drivers/iommu/Makefile +0 -0
 obj-$(CONFIG_VIRTIO_IOMMU) += virtio-iommu.o
 obj-$(CONFIG_IOMMU_SVA) += iommu-sva.o
 obj-$(CONFIG_IOMMU_IOPF) += io-pgfault.o

B.R.
Yu

author
#2 lore raw
Quoted 15 lines · Yu Zhang
Quoted 7 lines · Mukesh R

Create hyperv subdirectory under drivers/iommu in anticipation of more hyperv related files for 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. Lastly, this file should not be tied to CONFIG_HYPERV_IOMMU, but to CONFIG_HYPERV and CONFIG_IRQ_REMAP.

Thanks for this pathch, Mukesh!

Jason raised a question about whether Hyper-V's IRQ remapping file belongs under drivers/iommu/hyperv/ at all, since unlike Intel/AMD, Hyper-V's IRQ remapping is not co-mingled with the IOMMU hardware:

Quoted 6 lines
	https://lore.kernel.org/all/[email protected]/

Though we don't end up moving it elsewhere (the IRQ remapping framework and its internal header, irq_remapping.h, live under drivers/iommu/, and all existing backends sit alongside them), it would be good to acknowledge this in the commit message and explain the rationale,

Ok. Also, I missed the Kconfig file, will send V1.

Thanks,
-Mukesh

Quoted 53 lines
Quoted 38 lines
---
  MAINTAINERS                                             | 2 +-
  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 +-
  5 files changed, 6 insertions(+), 10 deletions(-)

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

MAINTAINERS +1 -1
index d1cc0e12fe1f..b651ee0c6e6b 100644
@@ -11914,7 +11914,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/hv-irq-remap.c
  F:	drivers/net/ethernet/microsoft/
  F:	drivers/net/hyperv/
  F:	drivers/pci/controller/pci-hyperv-intf.c
drivers/iommu/Makefile +1 -0
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

drivers/iommu/Makefile obj-$(CONFIG_TEGRA_IOMMU_SMMU) += tegra-smmu.o · line 33

Quoted 4 lines
drivers/iommu/Makefile +0 -1
@@ -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

Any reason why we are removing the CONFIG_HYPERV_IOMMU? You are leaving CONFIG_HYPERV_IOMMU an orphan configuration now (and also the backward compatibility issue?).

drivers/iommu/Makefile obj-$(CONFIG_TEGRA_IOMMU_SMMU) += tegra-smmu.o · line 36

Quoted 3 lines
drivers/iommu/Makefile +0 -0
  obj-$(CONFIG_VIRTIO_IOMMU) += virtio-iommu.o
  obj-$(CONFIG_IOMMU_SVA) += iommu-sva.o
  obj-$(CONFIG_IOMMU_IOPF) += io-pgfault.o

B.R.
Yu