Re: [PATCH 2/2] DM: Reset the INTx pinstate when configure lintr route


Kaige Fu
 

Ping ...

-----Original Message-----
From: acrn-dev@... <acrn-dev@...> On
Behalf Of Kaige Fu
Sent: Thursday, January 2, 2020 11:33 PM
To: acrn-dev@...
Subject: [acrn-dev] [PATCH 2/2] DM: Reset the INTx pinstate when configure
lintr route

DM ACPI provides the guest with 'active low' for INTx polarity. So, the initial
pin state should be 'HIGH' to indicate that there is no interrupts asserted.

Signed-off-by: Kaige Fu <kaige.fu@...>
---
devicemodel/hw/pci/core.c | 1 +
devicemodel/hw/pci/irq.c | 9 +++++++++ devicemodel/include/irq.h | 1 +
3 files changed, 11 insertions(+)

diff --git a/devicemodel/hw/pci/core.c b/devicemodel/hw/pci/core.c index
e2545163..35c9e00d 100644
--- a/devicemodel/hw/pci/core.c
+++ b/devicemodel/hw/pci/core.c
@@ -2000,6 +2000,7 @@ pci_lintr_route(struct pci_vdev *dev)
dev->lintr.ioapic_irq = ii->ii_ioapic_irq;
dev->lintr.pirq_pin = ii->ii_pirq_pin;
pci_set_cfgdata8(dev, PCIR_INTLINE, pirq_irq(ii->ii_pirq_pin));
+ pci_reset_pinstate(dev);
}

/**
diff --git a/devicemodel/hw/pci/irq.c b/devicemodel/hw/pci/irq.c index
0ebcbe6d..ae558c6e 100644
--- a/devicemodel/hw/pci/irq.c
+++ b/devicemodel/hw/pci/irq.c
@@ -144,6 +144,15 @@ void pci_irq_deinit(struct vmctx *ctx)
pirq_cold = 1;
}

+void pci_reset_pinstate(struct pci_vdev *dev) {
+ /*
+ * DM ACPI provides the guest with 'active low' for INTx polarity. So,
the initial
+ * pin state should be 'HIGH' to indicate that there is no interrupts
asserted.
+ */
+ vm_set_gsi_irq(dev->vmctx, dev->lintr.ioapic_irq, GSI_SET_HIGH); }
+
void
pci_irq_assert(struct pci_vdev *dev)
{
diff --git a/devicemodel/include/irq.h b/devicemodel/include/irq.h index
aa644868..8a128b38 100644
--- a/devicemodel/include/irq.h
+++ b/devicemodel/include/irq.h
@@ -36,6 +36,7 @@ void pci_irq_assert(struct pci_vdev *pi);
void pci_irq_deassert(struct pci_vdev *pi);
void pci_irq_init(struct vmctx *ctx);
void pci_irq_deinit(struct vmctx *ctx);
+void pci_reset_pinstate(struct pci_vdev *pi);
void pci_irq_reserve(int irq);
void pci_irq_use(int irq);
int pirq_alloc_pin(struct pci_vdev *pi);
--
2.20.0


Join acrn-dev@lists.projectacrn.org to automatically receive all group messages.