Skip to contentSkip to conversation

libacpi: report PCI slots as enabled only for hotpluggable devices

PATCH In review Igor Druzhinin 4 participants 6 messages May 22, 2019 – Aug 5, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libacpi: report PCI slots as enabled only for hotpluggable devices

DSDT for qemu-xen lacks _STA method of PCI slot object. If _STA method doesn't exist then the slot is assumed to be always present and active which in conjunction with _EJ0 method makes every device ejectable for an OS even if it's not the case.

qemu-kvm is able to dynamically add _EJ0 method only to those slots that either have hotpluggable devices or free for PCI passthrough. As Xen lacks this capability we cannot use their way.

qemu-xen-traditional DSDT has _STA method which only reports that the slot is present if there is a PCI devices hotplugged there. This is done through querying of its PCI hotplug controller. qemu-xen has similar capability that reports if device is "hotpluggable or absent" which we can use to achieve the same result.

---
 tools/libacpi/mk_dsdt.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
tools/libacpi/mk_dsdt.c +8 -1
index 2daf32c..c5ba4c0 100644
@@ -439,9 +439,10 @@ int main(int argc, char **argv)
             pop_block();
         }
     } else {
-        stmt("OperationRegion", "SEJ, SystemIO, 0xae08, 0x04");
+        stmt("OperationRegion", "SEJ, SystemIO, 0xae08, 0x08");
         push_block("Field", "SEJ, DWordAcc, NoLock, WriteAsZeros");
         indent(); printf("B0EJ, 32,\n");
+        indent(); printf("B0RM, 32,\n");
         pop_block();
 
         /* hotplug_slot */
@@ -452,6 +453,12 @@ int main(int argc, char **argv)
                     stmt("Store", "%#010x, B0EJ", 1 << slot);
                 } pop_block();
                 stmt("Name", "_SUN, %i", slot);
+                push_block("Method", "_STA, 0"); {
+                    push_block("If", "And(B0RM, ShiftLeft(1, %i))", slot);
+                    stmt("Return", "0xF");
+                    pop_block();
+                    stmt("Return", "0x0");
+                } pop_block();
             } pop_block();
         }
     }
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 22.05.19 at 20:10, <[email protected]> wrote:

DSDT for qemu-xen lacks _STA method of PCI slot object. If _STA method doesn't exist then the slot is assumed to be always present and active which in conjunction with _EJ0 method makes every device ejectable for an OS even if it's not the case.

qemu-kvm is able to dynamically add _EJ0 method only to those slots that either have hotpluggable devices or free for PCI passthrough. As Xen lacks this capability we cannot use their way.

Quoted 7 lines

qemu-xen-traditional DSDT has _STA method which only reports that the slot is present if there is a PCI devices hotplugged there. This is done through querying of its PCI hotplug controller. qemu-xen has similar capability that reports if device is "hotpluggable or absent" which we can use to achieve the same result.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 16 lines · Jan Beulich
Quoted 16 lines
Quoted 1 line
Quoted 1 line · On 22.05.19 at 20:10, <[email protected]> wrote:

DSDT for qemu-xen lacks _STA method of PCI slot object. If _STA method doesn't exist then the slot is assumed to be always present and active which in conjunction with _EJ0 method makes every device ejectable for an OS even if it's not the case.

qemu-kvm is able to dynamically add _EJ0 method only to those slots that either have hotpluggable devices or free for PCI passthrough. As Xen lacks this capability we cannot use their way.

qemu-xen-traditional DSDT has _STA method which only reports that the slot is present if there is a PCI devices hotplugged there. This is done through querying of its PCI hotplug controller. qemu-xen has similar capability that reports if device is "hotpluggable or absent" which we can use to achieve the same result.

Quoted 4 lines
Quoted 1 line

Jan, FAOD since you're the maintainer I'm expecting you to push this patch yourself.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
Quoted 18 lines
Quoted 1 line
Quoted 1 line · On 23.05.19 at 17:20, <[email protected]> wrote:
Quoted 16 lines · Jan Beulich
Quoted 16 lines
Quoted 1 line
Quoted 1 line · On 22.05.19 at 20:10, <[email protected]> wrote:

DSDT for qemu-xen lacks _STA method of PCI slot object. If _STA method doesn't exist then the slot is assumed to be always present and active which in conjunction with _EJ0 method makes every device ejectable for an OS even if it's not the case.

qemu-kvm is able to dynamically add _EJ0 method only to those slots that either have hotpluggable devices or free for PCI passthrough. As Xen lacks this capability we cannot use their way.

qemu-xen-traditional DSDT has _STA method which only reports that the slot is present if there is a PCI devices hotplugged there. This is done through querying of its PCI hotplug controller. qemu-xen has similar capability that reports if device is "hotpluggable or absent" which we can use to achieve the same result.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Jan, FAOD since you're the maintainer I'm expecting you to push this patch yourself.

Sure, I have it on my list of things to push.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw

Jan Beulich writes ("Re: [PATCH] libacpi: report PCI slots as enabled only for hotpluggable devices"):

Quoted 20 lines
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 23.05.19 at 17:20, <[email protected]> wrote:
Quoted 18 lines · Jan Beulich
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 22.05.19 at 20:10, <[email protected]> wrote:

DSDT for qemu-xen lacks _STA method of PCI slot object. If _STA method doesn't exist then the slot is assumed to be always present and active which in conjunction with _EJ0 method makes every device ejectable for an OS even if it's not the case.

qemu-kvm is able to dynamically add _EJ0 method only to those slots that either have hotpluggable devices or free for PCI passthrough. As Xen lacks this capability we cannot use their way.

qemu-xen-traditional DSDT has _STA method which only reports that the slot is present if there is a PCI devices hotplugged there. This is done through querying of its PCI hotplug controller. qemu-xen has similar capability that reports if device is "hotpluggable or absent" which we can use to achieve the same result.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Jan, FAOD since you're the maintainer I'm expecting you to push this patch yourself.

Sure, I have it on my list of things to push.

Is this a backport candidate ? It sounds like it might be a bugfix but I don't understand the risks/implications.

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw
Quoted 24 lines · Ian Jackson

Jan Beulich writes ("Re: [PATCH] libacpi: report PCI slots as enabled only for hotpluggable devices"):

Quoted 23 lines
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 23.05.19 at 17:20, <[email protected]> wrote:
Quoted 20 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 22.05.19 at 20:10, <[email protected]> wrote:

DSDT for qemu-xen lacks _STA method of PCI slot object. If _STA method doesn't exist then the slot is assumed to be always present and active which in conjunction with _EJ0 method makes every device ejectable for an OS even if it's not the case.

qemu-kvm is able to dynamically add _EJ0 method only to those slots that either have hotpluggable devices or free for PCI passthrough. As Xen lacks this capability we cannot use their way.

Quoted 7 lines

qemu-xen-traditional DSDT has _STA method which only reports that the slot is present if there is a PCI devices hotplugged there. This is done through querying of its PCI hotplug controller. qemu-xen has similar capability that reports if device is "hotpluggable or absent" which we can use to achieve the same result.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Jan, FAOD since you're the maintainer I'm expecting you to push this patch yourself.

Sure, I have it on my list of things to push.

Is this a backport candidate ? It sounds like it might be a bugfix but I don't understand the risks/implications.

I did already take the liberty of backporting this (back in June).

Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel