From: Igor Druzhinin <igor.druzhinin@citrix.com> To: xen-devel@lists.xenproject.org Cc: andrew.cooper3@citrix.com, wei.liu2@citrix.com, ian.jackson@eu.citrix.com, jbeulich@suse.com, Igor Druzhinin <igor.druzhinin@citrix.com> Subject: [PATCH] libacpi: report PCI slots as enabled only for hotpluggable devices Date: Wed, 22 May 2019 19:10:34 +0100 [thread overview] Message-ID: <1558548634-25154-1-git-send-email-igor.druzhinin@citrix.com> (raw) 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. Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com> --- tools/libacpi/mk_dsdt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c index 2daf32c..c5ba4c0 100644 --- a/tools/libacpi/mk_dsdt.c +++ b/tools/libacpi/mk_dsdt.c @@ -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(); } } -- 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
WARNING: multiple messages have this Message-ID (diff)
From: Igor Druzhinin <igor.druzhinin@citrix.com> To: <xen-devel@lists.xenproject.org> Cc: andrew.cooper3@citrix.com, wei.liu2@citrix.com, ian.jackson@eu.citrix.com, jbeulich@suse.com, Igor Druzhinin <igor.druzhinin@citrix.com> Subject: [Xen-devel] [PATCH] libacpi: report PCI slots as enabled only for hotpluggable devices Date: Wed, 22 May 2019 19:10:34 +0100 [thread overview] Message-ID: <1558548634-25154-1-git-send-email-igor.druzhinin@citrix.com> (raw) Message-ID: <20190522181034.JQthaTytaDvKUpdoWl7DLKrYxGFi2TXx34aJOyfQu70@z> (raw) 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. Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com> --- tools/libacpi/mk_dsdt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c index 2daf32c..c5ba4c0 100644 --- a/tools/libacpi/mk_dsdt.c +++ b/tools/libacpi/mk_dsdt.c @@ -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(); } } -- 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
next reply other threads:[~2019-05-22 18:10 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-22 18:10 Igor Druzhinin [this message] 2019-05-22 18:10 ` [Xen-devel] [PATCH] libacpi: report PCI slots as enabled only for hotpluggable devices Igor Druzhinin 2019-05-23 8:57 ` Jan Beulich 2019-05-23 8:57 ` [Xen-devel] " Jan Beulich 2019-05-23 15:20 ` Wei Liu 2019-05-23 15:20 ` [Xen-devel] " Wei Liu 2019-05-23 15:30 ` Jan Beulich 2019-05-23 15:30 ` [Xen-devel] " Jan Beulich 2019-08-05 14:50 ` Ian Jackson 2019-08-05 15:51 ` Jan Beulich
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1558548634-25154-1-git-send-email-igor.druzhinin@citrix.com \ --to=igor.druzhinin@citrix.com \ --cc=andrew.cooper3@citrix.com \ --cc=ian.jackson@eu.citrix.com \ --cc=jbeulich@suse.com \ --cc=wei.liu2@citrix.com \ --cc=xen-devel@lists.xenproject.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).