xen/iommu: fix iommu_ops attribute
PATCH 1/1 xen/iommu: fix iommu_ops attribute
Commit 32a5ea00ec75ef53e ("IOMMU/x86: remove indirection from certain IOMMU hook accesses") declared the AMD and INTEL variants of struct iommu_ops as __initconstrel, but those are needed for system resume, too.
Fix that by modifying them to be not located in the init data segment.
--- xen/drivers/passthrough/amd/pci_amd_iommu.c | 2 +- xen/drivers/passthrough/vtd/iommu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
xen/drivers/passthrough/amd/pci_amd_iommu.c +1 -1
@@ -570,7 +570,7 @@ static void amd_dump_p2m_table(struct domain *d)amd_dump_p2m_table_level (hd->arch.root_table, hd->arch.paging_mode,0 ,0 ); } -static const struct iommu_ops __initconstrel amd_iommu_ops = { +static const struct iommu_ops amd_iommu_ops = { .init = amd_iommu_domain_init, .hwdom_init = amd_iommu_hwdom_init, .add_device = amd_iommu_add_device,
xen/drivers/passthrough/vtd/iommu.c +1 -1
@@ -2706,7 +2706,7 @@ static void vtd_dump_p2m_table(struct domain *d)vtd_dump_p2m_table_level (hd->arch.pgd_maddr,agaw_to_level (hd->arch.agaw),0 ,0 ); } -const struct iommu_ops __initconstrel intel_iommu_ops = { +const struct iommu_ops intel_iommu_ops = { .init = intel_iommu_domain_init, .hwdom_init = intel_iommu_hwdom_init, .add_device = intel_iommu_add_device,
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 8 lines · Juergen Gross
Commit
32a5ea00ec75ef53e("IOMMU/x86: remove indirection from certain IOMMU hook accesses") declared the AMD and INTEL variants of structiommu_opsas__initconstrel, but those are needed for system resume, too.Fix that by modifying them to be not located in the init data segment.
Signed-off-by Juergen Gross <[email protected]>
Huh... That suggests we are re-initialising the IOMMU subsystem from a scan, rather than from the details we found at boot.
Did you work out which path hit this during resume?
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
xen/drivers/passthrough/amd/pci_amd_iommu.c static void amd_dump_p2m_table(struct domain *d) · line 573
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 01.02.19 at 16:13, <[email protected]> wrote:
xen/drivers/passthrough/amd/pci_amd_iommu.c +1
-1@@ -570,7 +570,7 @@ static void amd_dump_p2m_table(struct domain *d)amd_dump_p2m_table_level (hd->arch.root_table, hd->arch.paging_mode,0 ,0 ); } -static const struct iommu_ops __initconstrel amd_iommu_ops = { +static const struct iommu_ops amd_iommu_ops = {
This one's not needed - there's only an __init function referencing this structure.
xen/drivers/passthrough/vtd/iommu.c static void vtd_dump_p2m_table(struct domain *d) · line 2709
Quoted 8 lines
xen/drivers/passthrough/vtd/iommu.c +1
-1@@ -2706,7 +2706,7 @@ static void vtd_dump_p2m_table(struct domain *d)vtd_dump_p2m_table_level (hd->arch.pgd_maddr,agaw_to_level (hd->arch.agaw),0 ,0 ); } -const struct iommu_ops __initconstrel intel_iommu_ops = { +const struct iommu_ops intel_iommu_ops = {
This one's indeed referenced by a non-__init function, but the fix is imo to avoid that reference from iommu_enable_x2apic_IR():
We should not overwrite the previously established (and potentially subsequently adjusted) hook pointers. So I think the assignment wants to go in a system_state dependent conditional (and there is one a few lines up, so it could move just there).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 19 lines · Jan Beulich
xen/drivers/passthrough/amd/pci_amd_iommu.c static void amd_dump_p2m_table(struct domain *d) · line 573
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 01.02.19 at 16:13, <[email protected]> wrote:
xen/drivers/passthrough/amd/pci_amd_iommu.c +1
-1@@ -570,7 +570,7 @@ static void amd_dump_p2m_table(struct domain *d)amd_dump_p2m_table_level (hd->arch.root_table, hd->arch.paging_mode,0 ,0 ); } -static const struct iommu_ops __initconstrel amd_iommu_ops = { +static const struct iommu_ops amd_iommu_ops = {This one's not needed - there's only an
__initfunction referencing this structure.Quoted 6 lines
xen/drivers/passthrough/vtd/iommu.c +0
-0@@ -2706,7 +2706,7 @@ static void vtd_dump_p2m_table(struct domain *d)vtd_dump_p2m_table_level (hd->arch.pgd_maddr,agaw_to_level (hd->arch.agaw),0 ,0 ); }
Quoted 10 lines
xen/drivers/passthrough/vtd/iommu.c static void vtd_dump_p2m_table(struct domain *d) · line 2709
Quoted 2 lines
xen/drivers/passthrough/vtd/iommu.c +1
-1-const struct iommu_ops __initconstrel intel_iommu_ops = { +const struct iommu_ops intel_iommu_ops = {This one's indeed referenced by a non-__init function, but the fix is imo to avoid that reference from
iommu_enable_x2apic_IR():
We should not overwrite the previously established (and potentially subsequently adjusted) hook pointers. So I think the assignment wants to go in asystem_statedependent conditional (and there is one a few lines up, so it could move just there).
Okay, I'll try that.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel