AMD/IOMMU: drop remaining guest-IOMMU bits too
PATCH 1/1 AMD/IOMMU: drop remaining guest-IOMMU bits too
With a02174c6c885 ("amd/iommu: clean up unused guest iommu related functions") having removed the sole place where d->g_iommu would be set to non-NULL, guest_iommu_add_ppr_log() will unconditionally bail the latest from its 2nd if(). With it dropped, all other stuff in the file is unused, too. Delete iommu_guest.c altogether.
Further delete struct guest{_buffer,_dev_table,_iommu{,_msi}} as well as struct mmio_reg for being unused with the unused g_iommu also dropped from struct arch_iommu.
---
I wasn't sure how far to further go with removing the body of parse_ppr_log_entry(), or perhaps even the entire function, and then further up to all PPR logging code. Hence why for now I've merely commented out the function call into the file being deleted (which of course Misra isn't going to like). Thoughts / suggestions?
I further wonder whether set_iommu_guest_translation_control() should have been invoked independent of guest-IOMMU actually being enabled. IOW that may want purging, too. Along these lines iommuv2_enabled may also want dropping, for not having any consumer left. Much like has_viommu() and then also {XEN_,}X86_EMU_IOMMU, i.e. going as far as affecting the public interface.
xen/arch/x86/include/asm/iommu.h +0 -1
@@ -52,7 +52,6 @@ struct arch_iommustruct {unsigned int paging_mode;struct page_info *root_table; -struct guest_iommu *g_iommu; } amd; }; };
xen/drivers/passthrough/amd/Makefile +0 -1
@@ -5,4 +5,3 @@ obj-y += pci_amd_iommu.o obj-bin-y += iommu_acpi.init.o obj-y += iommu_intr.o obj-y += iommu_cmd.o -obj-$(CONFIG_HVM) += iommu_guest.o
xen/drivers/passthrough/amd/iommu.h +0 -58
70 lines not on this page · raw message
xen/drivers/passthrough/amd/iommu_guest.c deleted +0 -120
120 lines not on this page · raw message
xen/drivers/passthrough/amd/iommu_init.c +1 -1
@@ -646,7 +646,7 @@ static void cf_check parse_ppr_log_entrypcidevs_unlock ();if ( pdev ) -guest_iommu_add_ppr_log (pdev->domain, entry); +/* guest_iommu_add_ppr_log(pdev->domain, entry) */ ; }static void iommu_check_ppr_log (struct amd_iommu *iommu)
Quoted 90 lines · Jan Beulich
With
a02174c6c885("amd/iommu: clean up unused guest iommu related functions") having removed the sole place whered->g_iommuwould be set to non-NULL,guest_iommu_add_ppr_log()will unconditionally bail the latest from its 2ndif(). With it dropped, all other stuff in the file is unused, too. Deleteiommu_guest.caltogether.Further delete struct guest{_buffer,_dev_table,_iommu{,_msi}} as well as struct
mmio_regfor being unused with the unusedg_iommualso dropped from structarch_iommu.Signed-off-by Jan Beulich <[email protected]>---
I wasn't sure how far to further go with removing the body ofparse_ppr_log_entry(), or perhaps even the entire function, and then further up to all PPR logging code. Hence why for now I've merely commented out the function call into the file being deleted (which of course Misra isn't going to like). Thoughts / suggestions?I further wonder whether
set_iommu_guest_translation_control()should have been invoked independent of guest-IOMMU actually being enabled. IOW that may want purging, too. Along these linesiommuv2_enabledmay also want dropping, for not having any consumer left. Much likehas_viommu()and then also {XEN_,}X86_EMU_IOMMU, i.e. going as far as affecting the public interface.xen/arch/x86/include/asm/iommu.h +0
-1@@ -52,7 +52,6 @@ struct arch_iommustruct {unsigned int paging_mode;struct page_info *root_table; -struct guest_iommu *g_iommu; } amd; }; };xen/drivers/passthrough/amd/Makefile +0
-1@@ -5,4 +5,3 @@ obj-y += pci_amd_iommu.o obj-bin-y += iommu_acpi.init.o obj-y += iommu_intr.o obj-y += iommu_cmd.o -obj-$(CONFIG_HVM) += iommu_guest.oxen/drivers/passthrough/amd/iommu.h +0
-42@@ -145,57 +145,6 @@ int iterate_ivrs_entries(int (*handler)(struct ivrs_mappings *map, uint16_t bdf)); -/* iommu tables in guest space */ -struct mmio_reg { -uint32_t lo; -uint32_t hi; -}; - -struct guest_dev_table { -struct mmio_reg reg_base; -uint32_t size; -}; - -struct guest_buffer { -struct mmio_reg reg_base; -struct mmio_reg reg_tail; -struct mmio_reg reg_head; -uint32_t size; -}; - -struct guest_iommu_msi { -uint8_t vector; -uint8_t dest; -uint8_t dest_mode; -uint8_t delivery_mode; -uint8_t trig_mode; -}; - -/* virtual IOMMU structure */ -struct guest_iommu { - -struct domain *domain; -spinlock_t lock; -bool enabled; - -struct guest_dev_table dev_table; -struct guest_buffer cmd_buffer; -struct guest_buffer event_log; -struct guest_buffer ppr_log; - -struct tasklet cmd_buffer_tasklet; - -uint64_t mmio_base;/* MMIO base address */ -
xen/drivers/passthrough/amd/iommu.h int iterate_ivrs_entries(int (*handler)( · line 148
Quoted 10 lines
xen/drivers/passthrough/amd/iommu.h +0
-9-/* MMIO regs */ -union amd_iommu_control reg_ctrl;/* MMIO offset 0018h */ -struct mmio_reg reg_status;/* MMIO offset 2020h */ -union amd_iommu_ext_features reg_ext_feature;/* MMIO offset 0030h */ - -/* guest interrupt settings */ -struct guest_iommu_msi msi; -}; -extern bool iommuv2_enabled;
I think iommuv2_enabled can also go away, since it's only used by guest_iommu_init()?
It's set in amd_iommu_prepare() and amd_iommu_init_cleanup() but only consumed by guest_iommu_init().
Thanks, Roger.
Quoted 105 lines · Roger Pau Monné
Quoted 90 lines · Jan Beulich
With
a02174c6c885("amd/iommu: clean up unused guest iommu related functions") having removed the sole place whered->g_iommuwould be set to non-NULL,guest_iommu_add_ppr_log()will unconditionally bail the latest from its 2ndif(). With it dropped, all other stuff in the file is unused, too. Deleteiommu_guest.caltogether.Further delete struct guest{_buffer,_dev_table,_iommu{,_msi}} as well as struct
mmio_regfor being unused with the unusedg_iommualso dropped from structarch_iommu.Signed-off-by Jan Beulich <[email protected]>---
I wasn't sure how far to further go with removing the body ofparse_ppr_log_entry(), or perhaps even the entire function, and then further up to all PPR logging code. Hence why for now I've merely commented out the function call into the file being deleted (which of course Misra isn't going to like). Thoughts / suggestions?I further wonder whether
set_iommu_guest_translation_control()should have been invoked independent of guest-IOMMU actually being enabled. IOW that may want purging, too. Along these linesiommuv2_enabledmay also want dropping, for not having any consumer left. Much likehas_viommu()and then also {XEN_,}X86_EMU_IOMMU, i.e. going as far as affecting the public interface.xen/arch/x86/include/asm/iommu.h +0
-1@@ -52,7 +52,6 @@ struct arch_iommustruct {unsigned int paging_mode;struct page_info *root_table; -struct guest_iommu *g_iommu; } amd; }; };xen/drivers/passthrough/amd/Makefile +0
-1@@ -5,4 +5,3 @@ obj-y += pci_amd_iommu.o obj-bin-y += iommu_acpi.init.o obj-y += iommu_intr.o obj-y += iommu_cmd.o -obj-$(CONFIG_HVM) += iommu_guest.oxen/drivers/passthrough/amd/iommu.h +0
-42@@ -145,57 +145,6 @@ int iterate_ivrs_entries(int (*handler)(struct ivrs_mappings *map, uint16_t bdf)); -/* iommu tables in guest space */ -struct mmio_reg { -uint32_t lo; -uint32_t hi; -}; - -struct guest_dev_table { -struct mmio_reg reg_base; -uint32_t size; -}; - -struct guest_buffer { -struct mmio_reg reg_base; -struct mmio_reg reg_tail; -struct mmio_reg reg_head; -uint32_t size; -}; - -struct guest_iommu_msi { -uint8_t vector; -uint8_t dest; -uint8_t dest_mode; -uint8_t delivery_mode; -uint8_t trig_mode; -}; - -/* virtual IOMMU structure */ -struct guest_iommu { - -struct domain *domain; -spinlock_t lock; -bool enabled; - -struct guest_dev_table dev_table; -struct guest_buffer cmd_buffer; -struct guest_buffer event_log; -struct guest_buffer ppr_log; - -struct tasklet cmd_buffer_tasklet; - -uint64_t mmio_base;/* MMIO base address */ -xen/drivers/passthrough/amd/iommu.h int iterate_ivrs_entries(int (*handler)( · line 148
Quoted 10 lines
xen/drivers/passthrough/amd/iommu.h +0
-9-/* MMIO regs */ -union amd_iommu_control reg_ctrl;/* MMIO offset 0018h */ -struct mmio_reg reg_status;/* MMIO offset 2020h */ -union amd_iommu_ext_features reg_ext_feature;/* MMIO offset 0030h */ - -/* guest interrupt settings */ -struct guest_iommu_msi msi; -}; -extern bool iommuv2_enabled;I think
iommuv2_enabledcan also go away, since it's only used byguest_iommu_init()?
Quoted 2 lines
It's set in
amd_iommu_prepare()andamd_iommu_init_cleanup()but only consumed byguest_iommu_init().
See the post-commit-message remarks: The main question is where to stop.
Jan
Roger Pau Monné
Acked-byQuoted 8 lines · Jan Beulich
Quoted 7 lines · Roger Pau Monné
Quoted 6 lines · Jan Beulich
With
a02174c6c885("amd/iommu: clean up unused guest iommu related functions") having removed the sole place whered->g_iommuwould be set to non-NULL,guest_iommu_add_ppr_log()will unconditionally bail the latest from its 2ndif(). With it dropped, all other stuff in the file is unused, too. Deleteiommu_guest.caltogether.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Further delete struct guest{_buffer,_dev_table,_iommu{,_msi}} as well as struct
mmio_regfor being unused with the unusedg_iommualso dropped from structarch_iommu.Signed-off-by Jan Beulich <[email protected]>
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
---
I wasn't sure how far to further go with removing the body ofparse_ppr_log_entry(), or perhaps even the entire function, and then further up to all PPR logging code. Hence why for now I've merely commented out the function call into the file being deleted (which of course Misra isn't going to like). Thoughts / suggestions?
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
I further wonder whether
set_iommu_guest_translation_control()should have been invoked independent of guest-IOMMU actually being enabled. IOW that may want purging, too. Along these linesiommuv2_enabledmay also want dropping, for not having any consumer left. Much likehas_viommu()and then also {XEN_,}X86_EMU_IOMMU, i.e. going as far as affecting the public interface.
I would drop it all. The public interface part is not stable anyway, as it's a domctl, but I would be fine if you want to keep the X86_EMU_IOMMU.
Thanks, Roger.
Quoted 9 lines · Roger Pau Monné
Quoted 8 lines · Jan Beulich
Quoted 7 lines · Roger Pau Monné
Quoted 6 lines · Jan Beulich
With
a02174c6c885("amd/iommu: clean up unused guest iommu related functions") having removed the sole place whered->g_iommuwould be set to non-NULL,guest_iommu_add_ppr_log()will unconditionally bail the latest from its 2ndif(). With it dropped, all other stuff in the file is unused, too. Deleteiommu_guest.caltogether.
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Further delete struct guest{_buffer,_dev_table,_iommu{,_msi}} as well as struct
mmio_regfor being unused with the unusedg_iommualso dropped from structarch_iommu.Signed-off-by Jan Beulich <[email protected]>Acked-by Roger Pau Monné <[email protected]>
Thanks.
Quoted 14 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
---
I wasn't sure how far to further go with removing the body ofparse_ppr_log_entry(), or perhaps even the entire function, and then further up to all PPR logging code. Hence why for now I've merely commented out the function call into the file being deleted (which of course Misra isn't going to like). Thoughts / suggestions?Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
I further wonder whether
set_iommu_guest_translation_control()should have been invoked independent of guest-IOMMU actually being enabled. IOW that may want purging, too. Along these linesiommuv2_enabledmay also want dropping, for not having any consumer left. Much likehas_viommu()and then also {XEN_,}X86_EMU_IOMMU, i.e. going as far as affecting the public interface.
Quoted 2 lines
I would drop it all. The public interface part is not stable anyway, as it's a domctl, but I would be fine if you want to keep the
X86_EMU_IOMMU.
By "all" you also mean the PPR logging code? That's where I felt I might be going too far ...
Jan
Quoted 34 lines · Jan Beulich
Quoted 9 lines · Roger Pau Monné
Quoted 8 lines · Jan Beulich
Quoted 7 lines · Roger Pau Monné
Quoted 6 lines · Jan Beulich
With
a02174c6c885("amd/iommu: clean up unused guest iommu related functions") having removed the sole place whered->g_iommuwould be set to non-NULL,guest_iommu_add_ppr_log()will unconditionally bail the latest from its 2ndif(). With it dropped, all other stuff in the file is unused, too. Deleteiommu_guest.caltogether.Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Further delete struct guest{_buffer,_dev_table,_iommu{,_msi}} as well as struct
mmio_regfor being unused with the unusedg_iommualso dropped from structarch_iommu.Signed-off-by Jan Beulich <[email protected]>Acked-by Roger Pau Monné <[email protected]>Thanks.
Quoted 14 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
---
I wasn't sure how far to further go with removing the body ofparse_ppr_log_entry(), or perhaps even the entire function, and then further up to all PPR logging code. Hence why for now I've merely commented out the function call into the file being deleted (which of course Misra isn't going to like). Thoughts / suggestions?I further wonder whether
set_iommu_guest_translation_control()should have been invoked independent of guest-IOMMU actually being enabled. IOW that may want purging, too. Along these linesiommuv2_enabledmay also want dropping, for not having any consumer left. Much likehas_viommu()and then also {XEN_,}X86_EMU_IOMMU, i.e. going as far as affecting the public interface.
Quoted 5 lines
Quoted 2 lines
I would drop it all. The public interface part is not stable anyway, as it's a domctl, but I would be fine if you want to keep the
X86_EMU_IOMMU.By "all" you also mean the PPR logging code? That's where I felt I might be going too far ...
It's up to you. I've taken a look, and the PPR logging code seems to be tied to guest IOMMU also?
Since PPR could be used for other purposes it's likely fine to leave it in, albeit I won't oppose if you want to remove it (maybe there's some purpose I'm missing).
Thanks, Roger.