Skip to contentSkip to conversation

XSA-337 followup cleanup

PATCH In review Roger Pau Monne 2 participants 4 messages Sep 22, 2020

lore
Share & tools
lore
#0 lore raw

cover XSA-337 followup cleanup

Hello,

Followup patches from XSA-337 to cleanup unused code.

Thanks, Roger.

Roger Pau Monne (2):
x86/hpet: remove hpet_msi_read
x86/iommu: remove code to fetch MSI message from remap table

 xen/arch/x86/hpet.c                         | 10 ---
 xen/drivers/passthrough/amd/iommu.h         |  2 -
 xen/drivers/passthrough/amd/iommu_intr.c    | 41 -----------
 xen/drivers/passthrough/amd/pci_amd_iommu.c |  1 -
 xen/drivers/passthrough/pci.c               |  7 --
 xen/drivers/passthrough/vtd/extern.h        |  1 -
 xen/drivers/passthrough/vtd/intremap.c      | 76 ---------------------
 xen/drivers/passthrough/vtd/iommu.c         |  1 -
 xen/include/xen/iommu.h                     |  1 -
 9 files changed, 140 deletions(-)
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/2 x86/hpet: remove hpet_msi_read

It's dead code, even more now that read_msi_msg has been removed.

---
 xen/arch/x86/hpet.c | 10 ----------
 1 file changed, 10 deletions(-)
xen/arch/x86/hpet.c +0 -10
index 154c67423b..a55e68e6f7 100644
@@ -268,16 +268,6 @@ static int hpet_msi_write(struct hpet_event_channel *ch, struct msi_msg *msg)
     return 0;
 }
 
-static void __maybe_unused
-hpet_msi_read(struct hpet_event_channel *ch, struct msi_msg *msg)
-{
-    msg->data = hpet_read32(HPET_Tn_ROUTE(ch->idx));
-    msg->address_lo = hpet_read32(HPET_Tn_ROUTE(ch->idx) + 4);
-    msg->address_hi = MSI_ADDR_BASE_HI;
-    if ( iommu_intremap )
-        iommu_read_msi_from_ire(&ch->msi, msg);
-}
-
 static unsigned int hpet_msi_startup(struct irq_desc *desc)
 {
     hpet_msi_unmask(desc);
Signature · 1 line
2.28.0
#2 lore raw

PATCH 2/2 x86/iommu: remove code to fetch MSI message from remap table

In reply to Roger Pau Monne

Remove the code to compose a MSI message based on the information from the MSI registers and the data in the interrupt remapping table. Since the removal of read_msi_msg and its user there's no longer a need for such code, as the last written (untranslated) MSI message is cached internally by Xen.

---
 xen/drivers/passthrough/amd/iommu.h         |  2 -
 xen/drivers/passthrough/amd/iommu_intr.c    | 41 -----------
 xen/drivers/passthrough/amd/pci_amd_iommu.c |  1 -
 xen/drivers/passthrough/pci.c               |  7 --
 xen/drivers/passthrough/vtd/extern.h        |  1 -
 xen/drivers/passthrough/vtd/intremap.c      | 76 ---------------------
 xen/drivers/passthrough/vtd/iommu.c         |  1 -
 xen/include/xen/iommu.h                     |  1 -
 8 files changed, 130 deletions(-)
xen/drivers/passthrough/amd/iommu.h +0 -2
index e2d174f3b4..2cd87a5230 100644
@@ -277,8 +277,6 @@ unsigned int amd_iommu_read_ioapic_from_ire(
     unsigned int apic, unsigned int reg);
 int amd_iommu_msi_msg_update_ire(
     struct msi_desc *msi_desc, struct msi_msg *msg);
-void amd_iommu_read_msi_from_ire(
-    struct msi_desc *msi_desc, struct msi_msg *msg);
 int amd_setup_hpet_msi(struct msi_desc *msi_desc);
 void amd_iommu_dump_intremap_tables(unsigned char key);
 
xen/drivers/passthrough/amd/iommu_intr.c +0 -41

47 lines not on this page · raw message

xen/drivers/passthrough/amd/pci_amd_iommu.c +0 -1
index 3390c22cf3..304363f5d2 100644
@@ -572,7 +572,6 @@ static const struct iommu_ops __initconstrel _iommu_ops = {
     .update_ire_from_apic = amd_iommu_ioapic_update_ire,
     .update_ire_from_msi = amd_iommu_msi_msg_update_ire,
     .read_apic_from_ire = amd_iommu_read_ioapic_from_ire,
-    .read_msi_from_ire = amd_iommu_read_msi_from_ire,
     .setup_hpet_msi = amd_setup_hpet_msi,
     .adjust_irq_affinities = iov_adjust_irq_affinities,
     .suspend = amd_iommu_suspend,
xen/drivers/passthrough/pci.c +0 -7
index e54974bcb0..b035067975 100644
@@ -1382,13 +1382,6 @@ int iommu_update_ire_from_msi(
            ? iommu_call(&iommu_ops, update_ire_from_msi, msi_desc, msg) : 0;
 }
 
-void iommu_read_msi_from_ire(
-    struct msi_desc *msi_desc, struct msi_msg *msg)
-{
-    if ( iommu_intremap )
-        iommu_vcall(&iommu_ops, read_msi_from_ire, msi_desc, msg);
-}
-
 static int iommu_add_device(struct pci_dev *pdev)
 {
     const struct domain_iommu *hd;
xen/drivers/passthrough/vtd/extern.h +0 -1
index ada3c3098c..ad6c5f907b 100644
@@ -85,7 +85,6 @@ void io_apic_write_remap_rte(unsigned int apic,
 
 struct msi_desc;
 struct msi_msg;
-void msi_msg_read_remap_rte(struct msi_desc *, struct msi_msg *);
 int msi_msg_write_remap_rte(struct msi_desc *, struct msi_msg *);
 
 int intel_setup_hpet_msi(struct msi_desc *);
xen/drivers/passthrough/vtd/intremap.c +0 -76

88 lines not on this page · raw message

xen/drivers/passthrough/vtd/iommu.c +0 -1
index 94e0455a4d..1ee4baff36 100644
@@ -2745,7 +2745,6 @@ static struct iommu_ops __initdata vtd_ops = {
     .update_ire_from_apic = io_apic_write_remap_rte,
     .update_ire_from_msi = msi_msg_write_remap_rte,
     .read_apic_from_ire = io_apic_read_remap_rte,
-    .read_msi_from_ire = msi_msg_read_remap_rte,
     .setup_hpet_msi = intel_setup_hpet_msi,
     .adjust_irq_affinities = adjust_vtd_irq_affinities,
     .suspend = vtd_suspend,
xen/include/xen/iommu.h +0 -1
index 3272874958..fde5fdc415 100644
@@ -194,7 +194,6 @@ struct msi_desc;
 struct msi_msg;
 
 int iommu_update_ire_from_msi(struct msi_desc *msi_desc, struct msi_msg *msg);
-void iommu_read_msi_from_ire(struct msi_desc *msi_desc, struct msi_msg *msg);
 
 #define PT_IRQ_TIME_OUT MILLISECS(8)
 #endif /* HAS_PCI */
Signature · 1 line
2.28.0