Skip to contentSkip to conversation

ioh3420: Support ARI forwarding

PATCH Superseded Knut Omang 3 participants 7 messages Aug 20, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Knut Omang

author
#0 lore raw

PATCH 3/3 ioh3420: Support ARI forwarding

Enable the PCIe capability bit that indicates that this port is able to support and forward requests to > 8 functions for ARI capable devices.

---
 hw/pci-bridge/ioh3420.c | 7 +++++++
 1 file changed, 7 insertions(+)
hw/pci-bridge/ioh3420.c +7 -0
index 8f6c8b0..c14ea6b 100644
@@ -92,8 +92,10 @@ static void ioh3420_reset(DeviceState *qdev)
 
 static int ioh3420_initfn(PCIDevice *d)
 {
+    PCIBridge* br = PCI_BRIDGE(d);
     PCIEPort *p = PCIE_PORT(d);
     PCIESlot *s = PCIE_SLOT(d);
+    uint8_t *exp_cap;
     int rc;
     char tmp[100];
     sprintf(tmp, "pcie_port.%d", s->slot);
@@ -121,6 +123,10 @@ static int ioh3420_initfn(PCIDevice *d)
     if (rc < 0) {
         goto err_msi;
     }
+    /* Support ARI forwarding */
+    exp_cap = d->config + d->exp.exp_cap;
+    pci_word_test_and_set_mask(exp_cap + PCI_EXP_DEVCAP2, PCI_EXP_DEVCAP2_ARI);
+
     pcie_cap_deverr_init(d);
     pcie_cap_slot_init(d, s->slot);
     pcie_chassis_create(s->chassis);
@@ -151,6 +157,7 @@ err_bridge:
 static void ioh3420_exitfn(PCIDevice *d)
 {
     PCIESlot *s = PCIE_SLOT(d);
+    PCIBridge* br = PCI_BRIDGE(d);
 
     pcie_aer_exit(d);
     pcie_chassis_del_slot(s);
Signature · 1 line
1.9.0
#1 lore raw

Hi,

Quoted 11 lines

Subject: [PATCH 3/3] ioh3420: Support ARI forwarding

Enable the PCIe capability bit that indicates that this port is able to support and forward requests to > 8 functions for ARI capable devices.

---
 hw/pci-bridge/ioh3420.c | 7 +++++++
 1 file changed, 7 insertions(+)

I think you should associate patch 2/3 with patch 3/3 to one patch, otherwise after patch 2/3 building are broken.

Best regards,
-Gonglei

Quoted 38 lines
hw/pci-bridge/ioh3420.c +6 -0
index 8f6c8b0..c14ea6b 100644
@@ -92,8 +92,10 @@ static void ioh3420_reset(DeviceState *qdev)
 
 static int ioh3420_initfn(PCIDevice *d)
 {
+    PCIBridge* br = PCI_BRIDGE(d);
     PCIEPort *p = PCIE_PORT(d);
     PCIESlot *s = PCIE_SLOT(d);
+    uint8_t *exp_cap;
     int rc;
     char tmp[100];
     sprintf(tmp, "pcie_port.%d", s->slot);
@@ -121,6 +123,10 @@ static int ioh3420_initfn(PCIDevice *d)
     if (rc < 0) {
         goto err_msi;
     }
+    /* Support ARI forwarding */
+    exp_cap = d->config + d->exp.exp_cap;
+    pci_word_test_and_set_mask(exp_cap + PCI_EXP_DEVCAP2,
 PCI_EXP_DEVCAP2_ARI);
+
     pcie_cap_deverr_init(d);
     pcie_cap_slot_init(d, s->slot);
     pcie_chassis_create(s->chassis);
hw/pci-bridge/ioh3420.c +1 -1
@@ -151,6 +157,7 @@ err_bridge:
 static void ioh3420_exitfn(PCIDevice *d)
 {
     PCIESlot *s = PCIE_SLOT(d);
+    PCIBridge* br = PCI_BRIDGE(d);
 
     pcie_aer_exit(d);
     pcie_chassis_del_slot(s);
--

1.9.0

author
#2 lore raw
Quoted 14 lines · Gonglei (Arei)

Hi,

Quoted 11 lines

Subject: [PATCH 3/3] ioh3420: Support ARI forwarding

Enable the PCIe capability bit that indicates that this port is able to support and forward requests to > 8 functions for ARI capable devices.

---
 hw/pci-bridge/ioh3420.c | 7 +++++++
 1 file changed, 7 insertions(+)
Quoted 5 lines

I think you should associate patch 2/3 with patch 3/3 to one patch, otherwise after patch 2/3 building are broken.

Best regards,
-Gonglei

Thanks - just noticed - somehow I managed tp break the split of those two changes since they are independent.

Knut

Quoted 39 lines
Quoted 38 lines
hw/pci-bridge/ioh3420.c +6 -0
index 8f6c8b0..c14ea6b 100644
@@ -92,8 +92,10 @@ static void ioh3420_reset(DeviceState *qdev)
 
 static int ioh3420_initfn(PCIDevice *d)
 {
+    PCIBridge* br = PCI_BRIDGE(d);
     PCIEPort *p = PCIE_PORT(d);
     PCIESlot *s = PCIE_SLOT(d);
+    uint8_t *exp_cap;
     int rc;
     char tmp[100];
     sprintf(tmp, "pcie_port.%d", s->slot);
@@ -121,6 +123,10 @@ static int ioh3420_initfn(PCIDevice *d)
     if (rc < 0) {
         goto err_msi;
     }
+    /* Support ARI forwarding */
+    exp_cap = d->config + d->exp.exp_cap;
+    pci_word_test_and_set_mask(exp_cap + PCI_EXP_DEVCAP2,
 PCI_EXP_DEVCAP2_ARI);
+
     pcie_cap_deverr_init(d);
     pcie_cap_slot_init(d, s->slot);
     pcie_chassis_create(s->chassis);
hw/pci-bridge/ioh3420.c +1 -1
@@ -151,6 +157,7 @@ err_bridge:
 static void ioh3420_exitfn(PCIDevice *d)
 {
     PCIESlot *s = PCIE_SLOT(d);
+    PCIBridge* br = PCI_BRIDGE(d);
 
     pcie_aer_exit(d);
     pcie_chassis_del_slot(s);
--

1.9.0

#3 lore raw
In reply to Knut Omang
Quoted 24 lines · Knut Omang

Enable the PCIe capability bit that indicates that this port is able to support and forward requests to > 8 functions for ARI capable devices.

---
 hw/pci-bridge/ioh3420.c | 7 +++++++
 1 file changed, 7 insertions(+)
hw/pci-bridge/ioh3420.c +2 -0
index 8f6c8b0..c14ea6b 100644
@@ -92,8 +92,10 @@ static void ioh3420_reset(DeviceState *qdev)
 
 static int ioh3420_initfn(PCIDevice *d)
 {
+    PCIBridge* br = PCI_BRIDGE(d);
     PCIEPort *p = PCIE_PORT(d);
     PCIESlot *s = PCIE_SLOT(d);
+    uint8_t *exp_cap;
     int rc;
     char tmp[100];
     sprintf(tmp, "pcie_port.%d", s->slot);

hw/pci-bridge/ioh3420.c static int ioh3420_initfn(PCIDevice *d) · line 129

Quoted 7 lines
hw/pci-bridge/ioh3420.c +4 -0
@@ -121,6 +123,10 @@ static int ioh3420_initfn(PCIDevice *d)
     if (rc < 0) {
         goto err_msi;
     }
+    /* Support ARI forwarding */
+    exp_cap = d->config + d->exp.exp_cap;
+    pci_word_test_and_set_mask(exp_cap + PCI_EXP_DEVCAP2, PCI_EXP_DEVCAP2_ARI);
+

Hi,

I think is better to move the implementation to a function, say pcie_cap_ari_init and place it into hw/pci/pcie.c so other devices like downstream ports can use it.

Thanks,
Marcel

Quoted 11 lines
hw/pci-bridge/ioh3420.c +1 -0
     pcie_cap_deverr_init(d);
     pcie_cap_slot_init(d, s->slot);
     pcie_chassis_create(s->chassis);
@@ -151,6 +157,7 @@ err_bridge:
 static void ioh3420_exitfn(PCIDevice *d)
 {
     PCIESlot *s = PCIE_SLOT(d);
+    PCIBridge* br = PCI_BRIDGE(d);
 
     pcie_aer_exit(d);
     pcie_chassis_del_slot(s);
#4 lore raw
Quoted 17 lines
Quoted 10 lines

static int ioh3420_initfn(PCIDevice *d)
{

hw/pci-bridge/ioh3420.c +2 -0
+    PCIBridge* br = PCI_BRIDGE(d);
     PCIEPort *p = PCIE_PORT(d);
     PCIESlot *s = PCIE_SLOT(d);
+    uint8_t *exp_cap;
     int rc;
     char tmp[100];
     sprintf(tmp, "pcie_port.%d", s->slot);

hw/pci-bridge/ioh3420.c static int ioh3420_initfn(PCIDevice *d) · line 128

Quoted 6 lines
hw/pci-bridge/ioh3420.c +3 -0
@@ -121,6 +123,10 @@ static int ioh3420_initfn(PCIDevice *d)
     if (rc < 0) {
         goto err_msi;
     }
+    /* Support ARI forwarding */
+    exp_cap = d->config + d->exp.exp_cap;
+    pci_word_test_and_set_mask(exp_cap + PCI_EXP_DEVCAP2,

PCI_EXP_DEVCAP2_ARI);

Quoted 8 lines

hw/pci-bridge/ioh3420.c static int ioh3420_initfn(PCIDevice *d) · line 129

Quoted 1 line
hw/pci-bridge/ioh3420.c +1 -0
+

Hi,

I think is better to move the implementation to a function, say pcie_cap_ari_init
and place it into hw/pci/pcie.c so other devices like downstream ports can use it.

Yes, good idea. And I noticed a function ioh3420_init(), but not be called. Maybe it is useful.

Best regards,
-Gonglei

author
#5 lore raw
Quoted 20 lines · Gonglei (Arei)
Quoted 20 lines
Quoted 10 lines

static int ioh3420_initfn(PCIDevice *d)
{

hw/pci-bridge/ioh3420.c +2 -0
+    PCIBridge* br = PCI_BRIDGE(d);
     PCIEPort *p = PCIE_PORT(d);
     PCIESlot *s = PCIE_SLOT(d);
+    uint8_t *exp_cap;
     int rc;
     char tmp[100];
     sprintf(tmp, "pcie_port.%d", s->slot);

hw/pci-bridge/ioh3420.c static int ioh3420_initfn(PCIDevice *d) · line 128

Quoted 6 lines
hw/pci-bridge/ioh3420.c +3 -0
@@ -121,6 +123,10 @@ static int ioh3420_initfn(PCIDevice *d)
     if (rc < 0) {
         goto err_msi;
     }
+    /* Support ARI forwarding */
+    exp_cap = d->config + d->exp.exp_cap;
+    pci_word_test_and_set_mask(exp_cap + PCI_EXP_DEVCAP2,

PCI_EXP_DEVCAP2_ARI);

hw/pci-bridge/ioh3420.c static int ioh3420_initfn(PCIDevice *d) · line 129

Quoted 1 line
hw/pci-bridge/ioh3420.c +1 -0
+

Hi,

Quoted 7 lines
Quoted 5 lines

I think is better to move the implementation to a function, say pcie_cap_ari_init
and place it into hw/pci/pcie.c so other devices like downstream ports can use it.

Yes, good idea. And I noticed a function ioh3420_init(), but not be called. Maybe it is useful.

Yes, I noticed too - I would guess this is something left over from an earlier stage of the qdev APIs - Isaku, should I add a patch to remove it while at this?

Quoted 3 lines

Best regards,
-Gonglei

author
#6 lore raw
In reply to Marcel Apfelbaum
Quoted 34 lines · Marcel Apfelbaum
Quoted 24 lines · Knut Omang

Enable the PCIe capability bit that indicates that this port is able to support and forward requests to > 8 functions for ARI capable devices.

---
 hw/pci-bridge/ioh3420.c | 7 +++++++
 1 file changed, 7 insertions(+)
hw/pci-bridge/ioh3420.c +2 -0
index 8f6c8b0..c14ea6b 100644
@@ -92,8 +92,10 @@ static void ioh3420_reset(DeviceState *qdev)
 
 static int ioh3420_initfn(PCIDevice *d)
 {
+    PCIBridge* br = PCI_BRIDGE(d);
     PCIEPort *p = PCIE_PORT(d);
     PCIESlot *s = PCIE_SLOT(d);
+    uint8_t *exp_cap;
     int rc;
     char tmp[100];
     sprintf(tmp, "pcie_port.%d", s->slot);

hw/pci-bridge/ioh3420.c static int ioh3420_initfn(PCIDevice *d) · line 129

Quoted 7 lines
hw/pci-bridge/ioh3420.c +4 -0
@@ -121,6 +123,10 @@ static int ioh3420_initfn(PCIDevice *d)
     if (rc < 0) {
         goto err_msi;
     }
+    /* Support ARI forwarding */
+    exp_cap = d->config + d->exp.exp_cap;
+    pci_word_test_and_set_mask(exp_cap + PCI_EXP_DEVCAP2, PCI_EXP_DEVCAP2_ARI);
+

Hi,

Quoted 2 lines

I think is better to move the implementation to a function, say pcie_cap_ari_init and place it into hw/pci/pcie.c so other devices like downstream ports can use it.

Yes, definitely - I'll fix that, thanks.
Knut

Quoted 17 lines

Thanks,
Marcel

Quoted 11 lines
hw/pci-bridge/ioh3420.c +1 -0
     pcie_cap_deverr_init(d);
     pcie_cap_slot_init(d, s->slot);
     pcie_chassis_create(s->chassis);
@@ -151,6 +157,7 @@ err_bridge:
 static void ioh3420_exitfn(PCIDevice *d)
 {
     PCIESlot *s = PCIE_SLOT(d);
+    PCIBridge* br = PCI_BRIDGE(d);
 
     pcie_aer_exit(d);
     pcie_chassis_del_slot(s);