Skip to contentSkip to conversation

Disable PCIe ACS on older machines

PATCH In review Dr. David Alan Gilbert (git) 3 participants 10 messages Jul 30, 2019

lore
Share & tools
lore
#0 lore raw

cover Disable PCIe ACS on older machines

From: "Dr. David Alan Gilbert" <[email protected]>

PCIe ACS (Access Control services) got added in 4.0 and broke migration to and from 3.1 and earlier. Fix it here
for older machine types, at the cost of breaking that compatibility with 4.0.

Dr. David Alan Gilbert (2):
pcie_root_port: Allow ACS to be disabled
pcie_root_port: Disable ACS on older machines

 hw/core/machine.c              | 1 +
 hw/pci-bridge/pcie_root_port.c | 3 ++-
 include/hw/pci/pcie_port.h     | 2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/2 pcie_root_port: Allow ACS to be disabled

From: "Dr. David Alan Gilbert" <[email protected]>

ACS was added in 4.0 unconditionally, this breaks migration compatibility.
Allow ACS to be disabled by adding a property that's checked by pcie_root_port.

Unfortunately pcie-root-port doesn't have any instance data, so there's no where for that flag to live, so stuff it into PCIESlot.

---
 hw/pci-bridge/pcie_root_port.c | 3 ++-
 include/hw/pci/pcie_port.h     | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)
hw/pci-bridge/pcie_root_port.c +2 -1
index 09019ca05d..1d8a778709 100644
@@ -111,7 +111,7 @@ static void rp_realize(PCIDevice *d, Error **errp)
     pcie_aer_root_init(d);
     rp_aer_vector_update(d);
 
-    if (rpc->acs_offset) {
+    if (rpc->acs_offset && !s->disable_acs) {
         pcie_acs_init(d, rpc->acs_offset);
     }
     return;
@@ -145,6 +145,7 @@ static void rp_exit(PCIDevice *d)
 static Property rp_props[] = {
     DEFINE_PROP_BIT(COMPAT_PROP_PCP, PCIDevice, cap_present,
                     QEMU_PCIE_SLTCAP_PCP_BITNR, true),
+    DEFINE_PROP_BOOL("disable-acs", PCIESlot, disable_acs, false),
     DEFINE_PROP_END_OF_LIST()
 };
 
include/hw/pci/pcie_port.h +2 -0
index 09586f4641..7515430087 100644
@@ -53,6 +53,8 @@ struct PCIESlot {
     PCIExpLinkSpeed speed;
     PCIExpLinkWidth width;
 
+    /* Disable ACS (really for a pcie_root_port) */
+    bool        disable_acs;
     QLIST_ENTRY(PCIESlot) next;
 };
 
Signature · 1 line
2.21.0
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] pcie_root_port: Allow ACS to be disabled

Quoted 22 lines · On Tue, 30 Jul 2019 10:37:18 +0100 "Dr. David Alan Gilbert (git)"…

From: "Dr. David Alan Gilbert" <[email protected]>

ACS was added in 4.0 unconditionally, this breaks migration compatibility.
Allow ACS to be disabled by adding a property that's checked by pcie_root_port.

Unfortunately pcie-root-port doesn't have any instance data, so there's no where for that flag to live, so stuff it into PCIESlot.

---
 hw/pci-bridge/pcie_root_port.c | 3 ++-
 include/hw/pci/pcie_port.h     | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)
hw/pci-bridge/pcie_root_port.c +0 -0
index 09019ca05d..1d8a778709 100644

hw/pci-bridge/pcie_root_port.c static void rp_realize(PCIDevice *d, Error **errp) · line 114

Quoted 5 lines
hw/pci-bridge/pcie_root_port.c +1 -1
@@ -111,7 +111,7 @@ static void rp_realize(PCIDevice *d, Error **errp)
     pcie_aer_root_init(d);
     rp_aer_vector_update(d);
 
-    if (rpc->acs_offset) {
+    if (rpc->acs_offset && !s->disable_acs) {

it's not like it would be used per instance,
so could we use class property and with rpc->disable_acs instead of PCIESlot?

Quoted 24 lines
hw/pci-bridge/pcie_root_port.c +1 -0
         pcie_acs_init(d, rpc->acs_offset);
     }
     return;
@@ -145,6 +145,7 @@ static void rp_exit(PCIDevice *d)
 static Property rp_props[] = {
     DEFINE_PROP_BIT(COMPAT_PROP_PCP, PCIDevice, cap_present,
                     QEMU_PCIE_SLTCAP_PCP_BITNR, true),
+    DEFINE_PROP_BOOL("disable-acs", PCIESlot, disable_acs, false),
     DEFINE_PROP_END_OF_LIST()
 };
 
include/hw/pci/pcie_port.h +2 -0
index 09586f4641..7515430087 100644
@@ -53,6 +53,8 @@ struct PCIESlot {
     PCIExpLinkSpeed speed;
     PCIExpLinkWidth width;
 
+    /* Disable ACS (really for a pcie_root_port) */
+    bool        disable_acs;
     QLIST_ENTRY(PCIESlot) next;
 };
 
#3 lore raw

Re: [Qemu-devel] [PATCH 1/2] pcie_root_port: Allow ACS to be disabled

Quoted 28 lines · * Igor Mammedov ([email protected]) wrote:
Quoted 25 lines · On Tue, 30 Jul 2019 10:37:18 +0100 "Dr. David Alan Gilbert (git)"…

From: "Dr. David Alan Gilbert" <[email protected]>

ACS was added in 4.0 unconditionally, this breaks migration compatibility.
Allow ACS to be disabled by adding a property that's checked by pcie_root_port.

Unfortunately pcie-root-port doesn't have any instance data, so there's no where for that flag to live, so stuff it into PCIESlot.

---
 hw/pci-bridge/pcie_root_port.c | 3 ++-
 include/hw/pci/pcie_port.h     | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)
hw/pci-bridge/pcie_root_port.c +0 -0
index 09019ca05d..1d8a778709 100644
@@ -111,7 +111,7 @@ static void rp_realize(PCIDevice *d, Error **errp)
     pcie_aer_root_init(d);
     rp_aer_vector_update(d);
 
Quoted 5 lines

hw/pci-bridge/pcie_root_port.c static void rp_realize(PCIDevice *d, Error **errp) · line 114

Quoted 2 lines
hw/pci-bridge/pcie_root_port.c +1 -1
-    if (rpc->acs_offset) {
+    if (rpc->acs_offset && !s->disable_acs) {

it's not like it would be used per instance,
so could we use class property and with rpc->disable_acs instead of PCIESlot?

I'm not clear I understand how class properties help;
object_class_property_add_bool
takes a getter/setter that takes an Object * parameter; my reading of that is that it's the instance data so has the same problem.

Dave

Quoted 19 lines
Quoted 19 lines
hw/pci-bridge/pcie_root_port.c +1 -0
         pcie_acs_init(d, rpc->acs_offset);
     }
     return;
@@ -145,6 +145,7 @@ static void rp_exit(PCIDevice *d)
 static Property rp_props[] = {
     DEFINE_PROP_BIT(COMPAT_PROP_PCP, PCIDevice, cap_present,
                     QEMU_PCIE_SLTCAP_PCP_BITNR, true),
+    DEFINE_PROP_BOOL("disable-acs", PCIESlot, disable_acs, false),
     DEFINE_PROP_END_OF_LIST()
 };
 
include/hw/pci/pcie_port.h +0 -0
index 09586f4641..7515430087 100644
@@ -53,6 +53,8 @@ struct PCIESlot {
     PCIExpLinkSpeed speed;
     PCIExpLinkWidth width;
 
Quoted 6 lines

include/hw/pci/pcie_port.h struct PCIESlot { · line 60

Quoted 5 lines
include/hw/pci/pcie_port.h +2 -0
+    /* Disable ACS (really for a pcie_root_port) */
+    bool        disable_acs;
     QLIST_ENTRY(PCIESlot) next;
 };
 

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

Reviewed-by
#4 lore raw

Re: [Qemu-devel] [PATCH 1/2] pcie_root_port: Allow ACS to be disabled

Quoted 35 lines · On Tue, 30 Jul 2019 12:13:06 +0100 "Dr. David Alan Gilbert"…
Quoted 28 lines · * Igor Mammedov ([email protected]) wrote:
Quoted 25 lines · On Tue, 30 Jul 2019 10:37:18 +0100 "Dr. David Alan Gilbert (git)"…

From: "Dr. David Alan Gilbert" <[email protected]>

ACS was added in 4.0 unconditionally, this breaks migration compatibility.
Allow ACS to be disabled by adding a property that's checked by pcie_root_port.

Unfortunately pcie-root-port doesn't have any instance data, so there's no where for that flag to live, so stuff it into PCIESlot.

---
 hw/pci-bridge/pcie_root_port.c | 3 ++-
 include/hw/pci/pcie_port.h     | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)
hw/pci-bridge/pcie_root_port.c +0 -0
index 09019ca05d..1d8a778709 100644
@@ -111,7 +111,7 @@ static void rp_realize(PCIDevice *d, Error **errp)
     pcie_aer_root_init(d);
     rp_aer_vector_update(d);
 
Quoted 5 lines

hw/pci-bridge/pcie_root_port.c static void rp_realize(PCIDevice *d, Error **errp) · line 114

Quoted 2 lines
hw/pci-bridge/pcie_root_port.c +1 -1
-    if (rpc->acs_offset) {
+    if (rpc->acs_offset && !s->disable_acs) {

it's not like it would be used per instance,
so could we use class property and with rpc->disable_acs instead of PCIESlot?

Quoted 5 lines

I'm not clear I understand how class properties help;
object_class_property_add_bool
takes a getter/setter that takes an Object * parameter; my reading of that is that it's the instance data so has the same problem.

it's possible to reach class data from setter/getter, for example s390_cpu_model_class_register_props().

But it will be a bit more code than here and considering that it's only field in parent type which is reachable through root port specific property only it is also ok as is as a fix to 4.1, so if you prefer to keep it like now

Quoted 29 lines

Dave

Quoted 19 lines
Quoted 19 lines
hw/pci-bridge/pcie_root_port.c +1 -0
         pcie_acs_init(d, rpc->acs_offset);
     }
     return;
@@ -145,6 +145,7 @@ static void rp_exit(PCIDevice *d)
 static Property rp_props[] = {
     DEFINE_PROP_BIT(COMPAT_PROP_PCP, PCIDevice, cap_present,
                     QEMU_PCIE_SLTCAP_PCP_BITNR, true),
+    DEFINE_PROP_BOOL("disable-acs", PCIESlot, disable_acs, false),
     DEFINE_PROP_END_OF_LIST()
 };
 
include/hw/pci/pcie_port.h +0 -0
index 09586f4641..7515430087 100644
@@ -53,6 +53,8 @@ struct PCIESlot {
     PCIExpLinkSpeed speed;
     PCIExpLinkWidth width;
 
Quoted 6 lines

include/hw/pci/pcie_port.h struct PCIESlot { · line 60

Quoted 5 lines
include/hw/pci/pcie_port.h +2 -0
+    /* Disable ACS (really for a pcie_root_port) */
+    bool        disable_acs;
     QLIST_ENTRY(PCIESlot) next;
 };
 

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#5 lore raw

Re: [Qemu-devel] [PATCH 1/2] pcie_root_port: Allow ACS to be disabled

Quoted 38 lines · * Igor Mammedov ([email protected]) wrote:
Quoted 35 lines · On Tue, 30 Jul 2019 12:13:06 +0100 "Dr. David Alan Gilbert"…
Quoted 33 lines · * Igor Mammedov ([email protected]) wrote:
Quoted 22 lines · On Tue, 30 Jul 2019 10:37:18 +0100 "Dr. David Alan Gilbert (git)"…

From: "Dr. David Alan Gilbert" <[email protected]>

ACS was added in 4.0 unconditionally, this breaks migration compatibility.
Allow ACS to be disabled by adding a property that's checked by pcie_root_port.

Unfortunately pcie-root-port doesn't have any instance data, so there's no where for that flag to live, so stuff it into PCIESlot.

---
 hw/pci-bridge/pcie_root_port.c | 3 ++-
 include/hw/pci/pcie_port.h     | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)
hw/pci-bridge/pcie_root_port.c +0 -0
index 09019ca05d..1d8a778709 100644

hw/pci-bridge/pcie_root_port.c static void rp_realize(PCIDevice *d, Error **errp) · line 114

Quoted 5 lines
hw/pci-bridge/pcie_root_port.c +1 -1
@@ -111,7 +111,7 @@ static void rp_realize(PCIDevice *d, Error **errp)
     pcie_aer_root_init(d);
     rp_aer_vector_update(d);
 
-    if (rpc->acs_offset) {
+    if (rpc->acs_offset && !s->disable_acs) {

it's not like it would be used per instance,
so could we use class property and with rpc->disable_acs instead of PCIESlot?

Quoted 8 lines
Quoted 5 lines

I'm not clear I understand how class properties help;
object_class_property_add_bool
takes a getter/setter that takes an Object * parameter; my reading of that is that it's the instance data so has the same problem.

it's possible to reach class data from setter/getter, for example s390_cpu_model_class_register_props().

Ah OK.

Quoted 6 lines

But it will be a bit more code than here and considering that it's only field in parent type which is reachable through root port specific property only it is also ok as is as a fix to 4.1, so if you prefer to keep it like now

Thanks!

Quoted 23 lines
Quoted 23 lines

Dave

Quoted 19 lines
Quoted 19 lines
hw/pci-bridge/pcie_root_port.c +1 -0
         pcie_acs_init(d, rpc->acs_offset);
     }
     return;
@@ -145,6 +145,7 @@ static void rp_exit(PCIDevice *d)
 static Property rp_props[] = {
     DEFINE_PROP_BIT(COMPAT_PROP_PCP, PCIDevice, cap_present,
                     QEMU_PCIE_SLTCAP_PCP_BITNR, true),
+    DEFINE_PROP_BOOL("disable-acs", PCIESlot, disable_acs, false),
     DEFINE_PROP_END_OF_LIST()
 };
 
include/hw/pci/pcie_port.h +0 -0
index 09586f4641..7515430087 100644
@@ -53,6 +53,8 @@ struct PCIESlot {
     PCIExpLinkSpeed speed;
     PCIExpLinkWidth width;
 
Quoted 9 lines
Quoted 8 lines
Quoted 6 lines

include/hw/pci/pcie_port.h struct PCIESlot { · line 60

Quoted 5 lines
include/hw/pci/pcie_port.h +2 -0
+    /* Disable ACS (really for a pcie_root_port) */
+    bool        disable_acs;
     QLIST_ENTRY(PCIESlot) next;
 };
 

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

Reviewed-by on v1 1/2
#6 lore raw

Re: [Qemu-devel] [PATCH 1/2] pcie_root_port: Allow ACS to be disabled

In reply to Dr. David Alan Gilbert (git)
Quoted 7 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

ACS was added in 4.0 unconditionally, this breaks migration compatibility.
Allow ACS to be disabled by adding a property that's checked by pcie_root_port.

Quoted 5 lines

Unfortunately pcie-root-port doesn't have any instance data, so there's no where for that flag to live, so stuff it into PCIESlot.

#7 lore raw

PATCH 2/2 pcie_root_port: Disable ACS on older machines

In reply to Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

ACS got added in 4.0 unconditionally, that broke older<->4.0 migration where there was a PCIe root port.
Fix this by turning it off for 3.1 and older machines; note this fixes compatibility for older QEMUs but breaks compatibility with 4.0 for older machine types.

machine type source qemu dest qemu
3.1 3.1 4.0 broken
3.1 3.1 4.1rc2 broken
3.1 3.1 4.1+this OK ++
3.1 4.0 4.1rc2 OK
3.1 4.0 4.1+this broken --
4.0 4.0 4.1rc2 OK
4.0 4.0 4.1+this OK

So we gain and lose; the consensus seems to be treat this as a fix for older machine types.

---
 hw/core/machine.c | 1 +
 1 file changed, 1 insertion(+)
hw/core/machine.c +1 -0
index c58a8e594e..26a5f30e6d 100644
@@ -52,6 +52,7 @@ GlobalProperty hw_compat_3_1[] = {
     { "virtio-blk-device", "discard", "false" },
     { "virtio-blk-device", "write-zeroes", "false" },
     { "virtio-balloon-device", "qemu-4-0-config-size", "false" },
+    { "pcie-root-port-base", "disable-acs", "true" }, /* Added in 4.1 */
 };
 const size_t hw_compat_3_1_len = G_N_ELEMENTS(hw_compat_3_1);
 
Signature · 1 line
2.21.0
Reviewed-by on v1 2/2
#8 lore raw

Re: [Qemu-devel] [PATCH 2/2] pcie_root_port: Disable ACS on older machines

Quoted 17 lines · On Tue, 30 Jul 2019 10:37:19 +0100 "Dr. David Alan Gilbert (git)"…

From: "Dr. David Alan Gilbert" <[email protected]>

ACS got added in 4.0 unconditionally, that broke older<->4.0 migration where there was a PCIe root port.
Fix this by turning it off for 3.1 and older machines; note this fixes compatibility for older QEMUs but breaks compatibility with 4.0 for older machine types.

machine type source qemu dest qemu
3.1 3.1 4.0 broken
3.1 3.1 4.1rc2 broken
3.1 3.1 4.1+this OK ++
3.1 4.0 4.1rc2 OK
3.1 4.0 4.1+this broken --
4.0 4.0 4.1rc2 OK
4.0 4.0 4.1+this OK

Quoted 4 lines

So we gain and lose; the consensus seems to be treat this as a fix for older machine types.

Quoted 16 lines
---
 hw/core/machine.c | 1 +
 1 file changed, 1 insertion(+)
hw/core/machine.c +1 -0
index c58a8e594e..26a5f30e6d 100644
@@ -52,6 +52,7 @@ GlobalProperty hw_compat_3_1[] = {
     { "virtio-blk-device", "discard", "false" },
     { "virtio-blk-device", "write-zeroes", "false" },
     { "virtio-balloon-device", "qemu-4-0-config-size", "false" },
+    { "pcie-root-port-base", "disable-acs", "true" }, /* Added in 4.1 */
 };
 const size_t hw_compat_3_1_len = G_N_ELEMENTS(hw_compat_3_1);
 
Reviewed-by on v1 2/2
#9 lore raw

Re: [Qemu-devel] [PATCH 2/2] pcie_root_port: Disable ACS on older machines

In reply to Dr. David Alan Gilbert (git)
Quoted 17 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

ACS got added in 4.0 unconditionally, that broke older<->4.0 migration where there was a PCIe root port.
Fix this by turning it off for 3.1 and older machines; note this fixes compatibility for older QEMUs but breaks compatibility with 4.0 for older machine types.

machine type source qemu dest qemu
3.1 3.1 4.0 broken
3.1 3.1 4.1rc2 broken
3.1 3.1 4.1+this OK ++
3.1 4.0 4.1rc2 OK
3.1 4.0 4.1+this broken --
4.0 4.0 4.1rc2 OK
4.0 4.0 4.1+this OK

Quoted 5 lines

So we gain and lose; the consensus seems to be treat this as a fix for older machine types.

---