Re: [Xen-devel] [RFC PATCH 01/12] libacpi: new DSDT ACPI table for Q35

2018-03-19 Thread Alexey G
On Mon, 19 Mar 2018 12:43:05 +
Roger Pau Monné  wrote:

>On Tue, Mar 13, 2018 at 04:33:46AM +1000, Alexey Gerasimenko wrote:
>> This patch adds the DSDT table for Q35 (new
>> tools/libacpi/dsdt_q35.asl file). There are not many differences
>> with dsdt.asl (for i440) at the moment, namely:
>> 
>> - BDF location of LPC Controller
>> - Minor changes related to FDC detection
>> - Addition of _OSC method to inform OSPM about PCIe features
>> supported
>> 
>> As we are still using 4 PCI router links and their corresponding
>> device/register addresses are same (offset 0x60), no need to change
>> PCI routing descriptions.
>> 
>> Also, ACPI hotplug is still used to control passed through device hot
>> (un)plug (as it was for i440).
>> 
>> Signed-off-by: Alexey Gerasimenko 
>> ---
>>  tools/libacpi/dsdt_q35.asl | 551
>> +  
>
>So this is basically a modified dupe of the current dsdt.asl? AFAICT
>there are a bunch of common bits, which ideally we want to have
>defined in a single place.
>
>Can't you factor out the common parts of the dsdt.asl into smaller
>parts an include them for both dsdt.asl and dsdt_q35.asl?
>
>I would first have a patch that extract the common parts of the
>dsdt into file(s), and then a second patch which creates a
>dsdt_q35.asl based on those common bits plus the specific q35 code.

Yes, it's a good thing that many registers have same addresses on
i440 and Q35. Some encountered common things were unexpected though --
AFAIR _S5 SLP_TYP value do not correspond to the ICH9 datasheet,
a different value used instead to trigger ACPI Soft-Off emulation.

Regarding dsdt.asl/dsdt_q35.asl -- OK, I'll split these files into
common/specific parts.

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

Re: [Xen-devel] [RFC PATCH 01/12] libacpi: new DSDT ACPI table for Q35

2018-03-19 Thread Roger Pau Monné
On Tue, Mar 13, 2018 at 04:33:46AM +1000, Alexey Gerasimenko wrote:
> This patch adds the DSDT table for Q35 (new tools/libacpi/dsdt_q35.asl
> file). There are not many differences with dsdt.asl (for i440) at the
> moment, namely:
> 
> - BDF location of LPC Controller
> - Minor changes related to FDC detection
> - Addition of _OSC method to inform OSPM about PCIe features supported
> 
> As we are still using 4 PCI router links and their corresponding
> device/register addresses are same (offset 0x60), no need to change PCI
> routing descriptions.
> 
> Also, ACPI hotplug is still used to control passed through device hot
> (un)plug (as it was for i440).
> 
> Signed-off-by: Alexey Gerasimenko 
> ---
>  tools/libacpi/dsdt_q35.asl | 551 
> +

So this is basically a modified dupe of the current dsdt.asl? AFAICT
there are a bunch of common bits, which ideally we want to have
defined in a single place.

Can't you factor out the common parts of the dsdt.asl into smaller
parts an include them for both dsdt.asl and dsdt_q35.asl?

I would first have a patch that extract the common parts of the
dsdt into file(s), and then a second patch which creates a
dsdt_q35.asl based on those common bits plus the specific q35 code.

Thanks, Roger.

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

Re: [Xen-devel] [RFC PATCH 01/12] libacpi: new DSDT ACPI table for Q35

2018-03-12 Thread Tian, Kevin
> From: Alexey G [mailto:x19...@gmail.com]
> Sent: Tuesday, March 13, 2018 5:20 AM
> 
> On Mon, 12 Mar 2018 16:32:27 -0400
> Konrad Rzeszutek Wilk  wrote:
> 
> >On Tue, Mar 13, 2018 at 06:10:35AM +1000, Alexey G wrote:
> >> On Mon, 12 Mar 2018 15:38:03 -0400
> >> Konrad Rzeszutek Wilk  wrote:
> >>
> >> >On Tue, Mar 13, 2018 at 04:33:46AM +1000, Alexey Gerasimenko
> >> >wrote:
> >> >> This patch adds the DSDT table for Q35 (new
> >> >> tools/libacpi/dsdt_q35.asl file). There are not many differences
> >> >> with dsdt.asl (for i440) at the moment, namely:
> >> >>
> >> >> - BDF location of LPC Controller
> >> >> - Minor changes related to FDC detection
> >> >> - Addition of _OSC method to inform OSPM about PCIe features
> >> >> supported
> >> >>
> >> >> As we are still using 4 PCI router links and their corresponding
> >> >> device/register addresses are same (offset 0x60), no need to
> >> >> change PCI routing descriptions.
> >> >>
> >> >> Also, ACPI hotplug is still used to control passed through device
> >> >> hot (un)plug (as it was for i440).
> >> >>
> >> >> Signed-off-by: Alexey Gerasimenko 
> >> >> ---
> >> >>  tools/libacpi/dsdt_q35.asl | 551
> >> >> + 1 file changed,
> 551
> >> >> insertions(+) create mode 100644 tools/libacpi/dsdt_q35.asl
> >> >>
> >> >> diff --git a/tools/libacpi/dsdt_q35.asl
> >> >> b/tools/libacpi/dsdt_q35.asl new file mode 100644
> >> >> index 00..cd02946a07
> >> >> --- /dev/null
> >> >> +++ b/tools/libacpi/dsdt_q35.asl
> >> >> @@ -0,0 +1,551 @@
> >> >>
> +/
> **
> >> >> + * DSDT for Xen with Qemu device model (for Q35 machine)
> >> >> + *
> >> >> + * Copyright (c) 2004, Intel Corporation.
> >> >> + *
> >> >> + * This program is free software; you can redistribute it and/or
> >> >> modify
> >> >> + * it under the terms of the GNU Lesser General Public License as
> >> >> published
> >> >> + * by the Free Software Foundation; version 2.1 only. with the
> >> >> special
> >> >> + * exception on linking described in file LICENSE.
> >> >
> >> >I don't see the 'LICENSE' file in Xen's directory?
> >> >
> >> >Also, your email does not seem to be coming from Intel, so I have to
> >> >ask, where did this file originally come from?
> >>
> >> It's basically Xen's dsdt.asl with some modifications related to Q35.
> >> Currently only few modifications needed, but in the future dsdt.asl
> >> and dsdt_q35.asl will diverge more from each other -- that's the
> >> reason why a separate file was forked instead applying these changes
> >> to dsdt.asl directly, for example, as #ifdef-parts.
> >
> >OK, as such you should make a seperate patch that adds this file (and
> >be completly unmodified) and make sure you CC Intel folks (Kevin, et
> >all) so they can Ack it.
> 
> Kevin -- I assume you mean Kevin Tian ? Cc'ing
> him.
> Please let me know other persons from Intel who are also responsible,
> the MAINTAINERS file doesn't tell much about Intel people
> regarding /libacpi, unfortunately.

I'm not the maintainer of libacpi (should be Jan?). But CC my
colleague (Chao Peng) here who did some study of Q35 support
before and can help review.

Thanks
Kevin

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

Re: [Xen-devel] [RFC PATCH 01/12] libacpi: new DSDT ACPI table for Q35

2018-03-12 Thread Alexey G
On Mon, 12 Mar 2018 16:32:27 -0400
Konrad Rzeszutek Wilk  wrote:

>On Tue, Mar 13, 2018 at 06:10:35AM +1000, Alexey G wrote:
>> On Mon, 12 Mar 2018 15:38:03 -0400
>> Konrad Rzeszutek Wilk  wrote:
>>   
>> >On Tue, Mar 13, 2018 at 04:33:46AM +1000, Alexey Gerasimenko
>> >wrote:  
>> >> This patch adds the DSDT table for Q35 (new
>> >> tools/libacpi/dsdt_q35.asl file). There are not many differences
>> >> with dsdt.asl (for i440) at the moment, namely:
>> >> 
>> >> - BDF location of LPC Controller
>> >> - Minor changes related to FDC detection
>> >> - Addition of _OSC method to inform OSPM about PCIe features
>> >> supported
>> >> 
>> >> As we are still using 4 PCI router links and their corresponding
>> >> device/register addresses are same (offset 0x60), no need to
>> >> change PCI routing descriptions.
>> >> 
>> >> Also, ACPI hotplug is still used to control passed through device
>> >> hot (un)plug (as it was for i440).
>> >> 
>> >> Signed-off-by: Alexey Gerasimenko 
>> >> ---
>> >>  tools/libacpi/dsdt_q35.asl | 551
>> >> + 1 file changed, 551
>> >> insertions(+) create mode 100644 tools/libacpi/dsdt_q35.asl
>> >> 
>> >> diff --git a/tools/libacpi/dsdt_q35.asl
>> >> b/tools/libacpi/dsdt_q35.asl new file mode 100644
>> >> index 00..cd02946a07
>> >> --- /dev/null
>> >> +++ b/tools/libacpi/dsdt_q35.asl
>> >> @@ -0,0 +1,551 @@
>> >> +/**
>> >> + * DSDT for Xen with Qemu device model (for Q35 machine)
>> >> + *
>> >> + * Copyright (c) 2004, Intel Corporation.
>> >> + *
>> >> + * This program is free software; you can redistribute it and/or
>> >> modify
>> >> + * it under the terms of the GNU Lesser General Public License as
>> >> published
>> >> + * by the Free Software Foundation; version 2.1 only. with the
>> >> special
>> >> + * exception on linking described in file LICENSE.
>> >
>> >I don't see the 'LICENSE' file in Xen's directory?
>> >
>> >Also, your email does not seem to be coming from Intel, so I have to
>> >ask, where did this file originally come from?  
>> 
>> It's basically Xen's dsdt.asl with some modifications related to Q35.
>> Currently only few modifications needed, but in the future dsdt.asl
>> and dsdt_q35.asl will diverge more from each other -- that's the
>> reason why a separate file was forked instead applying these changes
>> to dsdt.asl directly, for example, as #ifdef-parts.  
>
>OK, as such you should make a seperate patch that adds this file (and
>be completly unmodified) and make sure you CC Intel folks (Kevin, et
>all) so they can Ack it.

Kevin -- I assume you mean Kevin Tian ? Cc'ing
him.
Please let me know other persons from Intel who are also responsible,
the MAINTAINERS file doesn't tell much about Intel people
regarding /libacpi, unfortunately.

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

Re: [Xen-devel] [RFC PATCH 01/12] libacpi: new DSDT ACPI table for Q35

2018-03-12 Thread Konrad Rzeszutek Wilk
On Tue, Mar 13, 2018 at 06:10:35AM +1000, Alexey G wrote:
> On Mon, 12 Mar 2018 15:38:03 -0400
> Konrad Rzeszutek Wilk  wrote:
> 
> >On Tue, Mar 13, 2018 at 04:33:46AM +1000, Alexey Gerasimenko wrote:
> >> This patch adds the DSDT table for Q35 (new
> >> tools/libacpi/dsdt_q35.asl file). There are not many differences
> >> with dsdt.asl (for i440) at the moment, namely:
> >> 
> >> - BDF location of LPC Controller
> >> - Minor changes related to FDC detection
> >> - Addition of _OSC method to inform OSPM about PCIe features
> >> supported
> >> 
> >> As we are still using 4 PCI router links and their corresponding
> >> device/register addresses are same (offset 0x60), no need to change
> >> PCI routing descriptions.
> >> 
> >> Also, ACPI hotplug is still used to control passed through device hot
> >> (un)plug (as it was for i440).
> >> 
> >> Signed-off-by: Alexey Gerasimenko 
> >> ---
> >>  tools/libacpi/dsdt_q35.asl | 551
> >> + 1 file changed, 551
> >> insertions(+) create mode 100644 tools/libacpi/dsdt_q35.asl
> >> 
> >> diff --git a/tools/libacpi/dsdt_q35.asl b/tools/libacpi/dsdt_q35.asl
> >> new file mode 100644
> >> index 00..cd02946a07
> >> --- /dev/null
> >> +++ b/tools/libacpi/dsdt_q35.asl
> >> @@ -0,0 +1,551 @@
> >> +/**
> >> + * DSDT for Xen with Qemu device model (for Q35 machine)
> >> + *
> >> + * Copyright (c) 2004, Intel Corporation.
> >> + *
> >> + * This program is free software; you can redistribute it and/or
> >> modify
> >> + * it under the terms of the GNU Lesser General Public License as
> >> published
> >> + * by the Free Software Foundation; version 2.1 only. with the
> >> special
> >> + * exception on linking described in file LICENSE.  
> >
> >I don't see the 'LICENSE' file in Xen's directory?
> >
> >Also, your email does not seem to be coming from Intel, so I have to
> >ask, where did this file originally come from?
> 
> It's basically Xen's dsdt.asl with some modifications related to Q35.
> Currently only few modifications needed, but in the future dsdt.asl and
> dsdt_q35.asl will diverge more from each other -- that's the reason why
> a separate file was forked instead applying these changes to dsdt.asl
> directly, for example, as #ifdef-parts.

OK, as such you should make a seperate patch that adds this file (and
be completly unmodified) and make sure you CC Intel folks (Kevin, et all) so
they can Ack it.

Thank you.


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

Re: [Xen-devel] [RFC PATCH 01/12] libacpi: new DSDT ACPI table for Q35

2018-03-12 Thread Alexey G
On Mon, 12 Mar 2018 15:38:03 -0400
Konrad Rzeszutek Wilk  wrote:

>On Tue, Mar 13, 2018 at 04:33:46AM +1000, Alexey Gerasimenko wrote:
>> This patch adds the DSDT table for Q35 (new
>> tools/libacpi/dsdt_q35.asl file). There are not many differences
>> with dsdt.asl (for i440) at the moment, namely:
>> 
>> - BDF location of LPC Controller
>> - Minor changes related to FDC detection
>> - Addition of _OSC method to inform OSPM about PCIe features
>> supported
>> 
>> As we are still using 4 PCI router links and their corresponding
>> device/register addresses are same (offset 0x60), no need to change
>> PCI routing descriptions.
>> 
>> Also, ACPI hotplug is still used to control passed through device hot
>> (un)plug (as it was for i440).
>> 
>> Signed-off-by: Alexey Gerasimenko 
>> ---
>>  tools/libacpi/dsdt_q35.asl | 551
>> + 1 file changed, 551
>> insertions(+) create mode 100644 tools/libacpi/dsdt_q35.asl
>> 
>> diff --git a/tools/libacpi/dsdt_q35.asl b/tools/libacpi/dsdt_q35.asl
>> new file mode 100644
>> index 00..cd02946a07
>> --- /dev/null
>> +++ b/tools/libacpi/dsdt_q35.asl
>> @@ -0,0 +1,551 @@
>> +/**
>> + * DSDT for Xen with Qemu device model (for Q35 machine)
>> + *
>> + * Copyright (c) 2004, Intel Corporation.
>> + *
>> + * This program is free software; you can redistribute it and/or
>> modify
>> + * it under the terms of the GNU Lesser General Public License as
>> published
>> + * by the Free Software Foundation; version 2.1 only. with the
>> special
>> + * exception on linking described in file LICENSE.  
>
>I don't see the 'LICENSE' file in Xen's directory?
>
>Also, your email does not seem to be coming from Intel, so I have to
>ask, where did this file originally come from?

It's basically Xen's dsdt.asl with some modifications related to Q35.
Currently only few modifications needed, but in the future dsdt.asl and
dsdt_q35.asl will diverge more from each other -- that's the reason why
a separate file was forked instead applying these changes to dsdt.asl
directly, for example, as #ifdef-parts.

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

Re: [Xen-devel] [RFC PATCH 01/12] libacpi: new DSDT ACPI table for Q35

2018-03-12 Thread Konrad Rzeszutek Wilk
On Tue, Mar 13, 2018 at 04:33:46AM +1000, Alexey Gerasimenko wrote:
> This patch adds the DSDT table for Q35 (new tools/libacpi/dsdt_q35.asl
> file). There are not many differences with dsdt.asl (for i440) at the
> moment, namely:
> 
> - BDF location of LPC Controller
> - Minor changes related to FDC detection
> - Addition of _OSC method to inform OSPM about PCIe features supported
> 
> As we are still using 4 PCI router links and their corresponding
> device/register addresses are same (offset 0x60), no need to change PCI
> routing descriptions.
> 
> Also, ACPI hotplug is still used to control passed through device hot
> (un)plug (as it was for i440).
> 
> Signed-off-by: Alexey Gerasimenko 
> ---
>  tools/libacpi/dsdt_q35.asl | 551 
> +
>  1 file changed, 551 insertions(+)
>  create mode 100644 tools/libacpi/dsdt_q35.asl
> 
> diff --git a/tools/libacpi/dsdt_q35.asl b/tools/libacpi/dsdt_q35.asl
> new file mode 100644
> index 00..cd02946a07
> --- /dev/null
> +++ b/tools/libacpi/dsdt_q35.asl
> @@ -0,0 +1,551 @@
> +/**
> + * DSDT for Xen with Qemu device model (for Q35 machine)
> + *
> + * Copyright (c) 2004, Intel Corporation.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU Lesser General Public License as published
> + * by the Free Software Foundation; version 2.1 only. with the special
> + * exception on linking described in file LICENSE.

I don't see the 'LICENSE' file in Xen's directory?

Also, your email does not seem to be coming from Intel, so I have to ask,
where did this file originally come from?

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

[Xen-devel] [RFC PATCH 01/12] libacpi: new DSDT ACPI table for Q35

2018-03-12 Thread Alexey Gerasimenko
This patch adds the DSDT table for Q35 (new tools/libacpi/dsdt_q35.asl
file). There are not many differences with dsdt.asl (for i440) at the
moment, namely:

- BDF location of LPC Controller
- Minor changes related to FDC detection
- Addition of _OSC method to inform OSPM about PCIe features supported

As we are still using 4 PCI router links and their corresponding
device/register addresses are same (offset 0x60), no need to change PCI
routing descriptions.

Also, ACPI hotplug is still used to control passed through device hot
(un)plug (as it was for i440).

Signed-off-by: Alexey Gerasimenko 
---
 tools/libacpi/dsdt_q35.asl | 551 +
 1 file changed, 551 insertions(+)
 create mode 100644 tools/libacpi/dsdt_q35.asl

diff --git a/tools/libacpi/dsdt_q35.asl b/tools/libacpi/dsdt_q35.asl
new file mode 100644
index 00..cd02946a07
--- /dev/null
+++ b/tools/libacpi/dsdt_q35.asl
@@ -0,0 +1,551 @@
+/**
+ * DSDT for Xen with Qemu device model (for Q35 machine)
+ *
+ * Copyright (c) 2004, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+
+DefinitionBlock ("DSDT.aml", "DSDT", 2, "Xen", "HVM", 0)
+{
+Name (\PMBS, 0x0C00)
+Name (\PMLN, 0x08)
+Name (\IOB1, 0x00)
+Name (\IOL1, 0x00)
+Name (\APCB, 0xFEC0)
+Name (\APCL, 0x0001)
+Name (\PUID, 0x00)
+
+
+Scope (\_SB)
+{
+
+/* Fix HCT test for 0x400 pci memory:
+ * - need to report low 640 MB mem as motherboard resource
+ */
+   Device(MEM0)
+   {
+   Name(_HID, EISAID("PNP0C02"))
+   Name(_CRS, ResourceTemplate() {
+   QWordMemory(
+ResourceConsumer, PosDecode, MinFixed,
+MaxFixed, Cacheable, ReadWrite,
+0x,
+0x,
+0x0009,
+0x,
+0x000a)
+   })
+   }
+
+   Device (PCI0)
+   {
+   Name (_HID, EisaId ("PNP0A03"))
+   Name (_UID, 0x00)
+   Name (_ADR, 0x00)
+   Name (_BBN, 0x00)
+
+   /* _OSC, modified from ASL sample in ACPI spec */
+   Name(SUPP, 0) /* PCI _OSC Support Field value */
+   Name(CTRL, 0) /* PCI _OSC Control Field value */
+   Method(_OSC, 4) {
+   /* Create DWORD-addressable fields from the Capabilities Buffer 
*/
+   CreateDWordField(Arg3, 0, CDW1)
+
+   /* Switch by UUID.
+* Only PCI Host Bridge Device capabilities UUID used for now
+*/
+   If (LEqual(Arg0, 
ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) {
+   /* Create DWORD-addressable fields from the Capabilities 
Buffer */
+   CreateDWordField(Arg3, 4, CDW2)
+   CreateDWordField(Arg3, 8, CDW3)
+
+   /* Save Capabilities DWORD2 & 3 */
+   Store(CDW2, SUPP)
+   Store(CDW3, CTRL)
+
+   /* Validate Revision DWORD */
+   If (LNotEqual(Arg1, One)) {
+   /* Unknown revision */
+   /* Support and Control DWORDs will be returned anyway */
+   Or(CDW1, 0x08, CDW1)
+   }
+
+   /* Control field bits are:
+* bit 0PCI Express Native Hot Plug control
+* bit 1SHPC Native Hot Plug control
+* bit 2PCI Express Native Power Management Events 
control
+* bit 3PCI Express Advanced Error Reporting control
+* bit 4PCI Express Capability Structure control
+*/
+
+   /* Always allow native PME, AER (no dependencies)
+* Never allow SHPC (no SHPC controller in this system)
+* Do not allow PCIe Capability Structure control for now
+* Also, ACPI hotplug is used for now instead of PCIe
+* Native Hot Plug
+*/
+   And(CTRL, 0x0C, CTRL)
+
+   If (LNotEqual(CDW3, CTRL)) {
+   /* Some of Capabilities bits were masked */
+   Or(CDW1, 0x10, CDW1)
+   }
+   /* Update DWORD3 in the buffer */
+