All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libacpi: report PCI slots as enabled only for hotpluggable devices
@ 2019-05-22 18:10 ` Igor Druzhinin
  0 siblings, 0 replies; 10+ messages in thread
From: Igor Druzhinin @ 2019-05-22 18:10 UTC (permalink / raw)
  To: xen-devel; +Cc: andrew.cooper3, wei.liu2, ian.jackson, jbeulich, Igor Druzhinin

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Xen-devel] [PATCH] libacpi: report PCI slots as enabled only for hotpluggable devices
@ 2019-05-22 18:10 ` Igor Druzhinin
  0 siblings, 0 replies; 10+ messages in thread
From: Igor Druzhinin @ 2019-05-22 18:10 UTC (permalink / raw)
  To: xen-devel; +Cc: andrew.cooper3, wei.liu2, ian.jackson, jbeulich, Igor Druzhinin

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] libacpi: report PCI slots as enabled only for hotpluggable devices
@ 2019-05-23  8:57   ` Jan Beulich
  0 siblings, 0 replies; 10+ messages in thread
From: Jan Beulich @ 2019-05-23  8:57 UTC (permalink / raw)
  To: Igor Druzhinin; +Cc: Andrew Cooper, Wei Liu, Ian Jackson, xen-devel

>>> On 22.05.19 at 20:10, <igor.druzhinin@citrix.com> 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.
> 
> Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Xen-devel] [PATCH] libacpi: report PCI slots as enabled only for hotpluggable devices
@ 2019-05-23  8:57   ` Jan Beulich
  0 siblings, 0 replies; 10+ messages in thread
From: Jan Beulich @ 2019-05-23  8:57 UTC (permalink / raw)
  To: Igor Druzhinin; +Cc: Andrew Cooper, Wei Liu, Ian Jackson, xen-devel

>>> On 22.05.19 at 20:10, <igor.druzhinin@citrix.com> 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.
> 
> Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] libacpi: report PCI slots as enabled only for hotpluggable devices
@ 2019-05-23 15:20     ` Wei Liu
  0 siblings, 0 replies; 10+ messages in thread
From: Wei Liu @ 2019-05-23 15:20 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Igor Druzhinin, xen-devel, Wei Liu, Ian Jackson, Andrew Cooper

On Thu, May 23, 2019 at 02:57:49AM -0600, Jan Beulich wrote:
> >>> On 22.05.19 at 20:10, <igor.druzhinin@citrix.com> 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.
> > 
> > Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
> 
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> 

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

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Xen-devel] [PATCH] libacpi: report PCI slots as enabled only for hotpluggable devices
@ 2019-05-23 15:20     ` Wei Liu
  0 siblings, 0 replies; 10+ messages in thread
From: Wei Liu @ 2019-05-23 15:20 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Igor Druzhinin, xen-devel, Wei Liu, Ian Jackson, Andrew Cooper

On Thu, May 23, 2019 at 02:57:49AM -0600, Jan Beulich wrote:
> >>> On 22.05.19 at 20:10, <igor.druzhinin@citrix.com> 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.
> > 
> > Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
> 
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> 

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

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] libacpi: report PCI slots as enabled only for hotpluggable devices
@ 2019-05-23 15:30       ` Jan Beulich
  0 siblings, 0 replies; 10+ messages in thread
From: Jan Beulich @ 2019-05-23 15:30 UTC (permalink / raw)
  To: Wei Liu; +Cc: Andrew Cooper, Ian Jackson, xen-devel, Igor Druzhinin

>>> On 23.05.19 at 17:20, <wei.liu2@citrix.com> wrote:
> On Thu, May 23, 2019 at 02:57:49AM -0600, Jan Beulich wrote:
>> >>> On 22.05.19 at 20:10, <igor.druzhinin@citrix.com> 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.
>> > 
>> > Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
>> 
>> Reviewed-by: Jan Beulich <jbeulich@suse.com>
>> 
> 
> 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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Xen-devel] [PATCH] libacpi: report PCI slots as enabled only for hotpluggable devices
@ 2019-05-23 15:30       ` Jan Beulich
  0 siblings, 0 replies; 10+ messages in thread
From: Jan Beulich @ 2019-05-23 15:30 UTC (permalink / raw)
  To: Wei Liu; +Cc: Andrew Cooper, Ian Jackson, xen-devel, Igor Druzhinin

>>> On 23.05.19 at 17:20, <wei.liu2@citrix.com> wrote:
> On Thu, May 23, 2019 at 02:57:49AM -0600, Jan Beulich wrote:
>> >>> On 22.05.19 at 20:10, <igor.druzhinin@citrix.com> 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.
>> > 
>> > Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
>> 
>> Reviewed-by: Jan Beulich <jbeulich@suse.com>
>> 
> 
> 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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Xen-devel] [PATCH] libacpi: report PCI slots as enabled only for hotpluggable devices
  2019-05-23 15:30       ` [Xen-devel] " Jan Beulich
  (?)
@ 2019-08-05 14:50       ` Ian Jackson
  2019-08-05 15:51         ` Jan Beulich
  -1 siblings, 1 reply; 10+ messages in thread
From: Ian Jackson @ 2019-08-05 14:50 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Andrew Cooper, Wei Liu, xen-devel, Igor Druzhinin

Jan Beulich writes ("Re: [PATCH] libacpi: report PCI slots as enabled only for hotpluggable devices"):
> >>> On 23.05.19 at 17:20, <wei.liu2@citrix.com> wrote:
> > On Thu, May 23, 2019 at 02:57:49AM -0600, Jan Beulich wrote:
> >> >>> On 22.05.19 at 20:10, <igor.druzhinin@citrix.com> 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.
> >> > 
> >> > Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
> >> 
> >> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> >> 
> > 
> > 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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Xen-devel] [PATCH] libacpi: report PCI slots as enabled only for hotpluggable devices
  2019-08-05 14:50       ` Ian Jackson
@ 2019-08-05 15:51         ` Jan Beulich
  0 siblings, 0 replies; 10+ messages in thread
From: Jan Beulich @ 2019-08-05 15:51 UTC (permalink / raw)
  To: Ian Jackson; +Cc: Andrew Cooper, Wei Liu, xen-devel, Igor Druzhinin

On 05.08.2019 16:50, Ian Jackson wrote:
> Jan Beulich writes ("Re: [PATCH] libacpi: report PCI slots as enabled only for hotpluggable devices"):
>>>>> On 23.05.19 at 17:20, <wei.liu2@citrix.com> wrote:
>>> On Thu, May 23, 2019 at 02:57:49AM -0600, Jan Beulich wrote:
>>>>>>> On 22.05.19 at 20:10, <igor.druzhinin@citrix.com> 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.
>>>>>
>>>>> Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
>>>>
>>>> Reviewed-by: Jan Beulich <jbeulich@suse.com>
>>>>
>>>
>>> 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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-08-05 15:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22 18:10 [PATCH] libacpi: report PCI slots as enabled only for hotpluggable devices Igor Druzhinin
2019-05-22 18:10 ` [Xen-devel] " 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.