All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: aliguori@amazon.com, hutao@cn.fujitsu.com, jjherne@us.ibm.com,
	qemu-devel@nongnu.org, kraxel@redhat.com, stefanha@redhat.com,
	kaneshige.kenji@jp.fujitsu.com, chen.fan.fnst@cn.fujitsu.com,
	pbonzini@redhat.com, brogers@suse.com, lersek@redhat.com
Subject: Re: [Qemu-devel] [PATCH 09/11] ACPI: move PRST OperationRegion into SSDT
Date: Mon, 16 Dec 2013 23:15:16 +0100	[thread overview]
Message-ID: <20131216231516.39e7b44a@thinkpad> (raw)
In-Reply-To: <20131216195307.GA23942@redhat.com>

On Mon, 16 Dec 2013 21:53:07 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Fri, Dec 13, 2013 at 05:22:14PM +0100, Igor Mammedov wrote:
> > .. and report range used by it to OSPM via _CRS.
> > PRST is needed in SSDT since its base will depend on
> > chipset and will be dynamically set by QEMU.
> > Also move PRSC() method along with PRST since cross
> > table reference to PRST doesn't work.
> > 
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >  hw/i386/acpi-dsdt-cpu-hotplug.dsl | 39 +----------------------
> >  hw/i386/acpi-dsdt.dsl             |  2 +-
> >  hw/i386/q35-acpi-dsdt.dsl         |  2 +-
> >  hw/i386/ssdt-misc.dsl             | 65 +++++++++++++++++++++++++++++++++++++++
> >  4 files changed, 68 insertions(+), 40 deletions(-)
> > 
> > diff --git a/hw/i386/acpi-dsdt-cpu-hotplug.dsl b/hw/i386/acpi-dsdt-cpu-hotplug.dsl
> > index 995b415..f26f81b 100644
> > --- a/hw/i386/acpi-dsdt-cpu-hotplug.dsl
> > +++ b/hw/i386/acpi-dsdt-cpu-hotplug.dsl
> > @@ -20,6 +20,7 @@
> >  Scope(\_SB) {
> >      /* Objects filled in by run-time generated SSDT */
> >      External(NTFY, MethodObj)
> > +    External(\_SB.CPHD.PRSC, MethodObj)
> >      External(CPON, PkgObj)
> >  
> >      /* Methods called by run-time generated SSDT Processor objects */
> > @@ -51,42 +52,4 @@ Scope(\_SB) {
> >          // _EJ0 method - eject callback
> >          Sleep(200)
> >      }
> > -
> > -    OperationRegion(PRST, SystemIO, 0xaf00, 32)
> > -    Field(PRST, ByteAcc, NoLock, Preserve) {
> > -        PRS, 256
> > -    }
> > -    Method(PRSC, 0) {
> > -        // Local5 = active cpu bitmap
> > -        Store(PRS, Local5)
> > -        // Local2 = last read byte from bitmap
> > -        Store(Zero, Local2)
> > -        // Local0 = Processor ID / APIC ID iterator
> > -        Store(Zero, Local0)
> > -        While (LLess(Local0, SizeOf(CPON))) {
> > -            // Local1 = CPON flag for this cpu
> > -            Store(DerefOf(Index(CPON, Local0)), Local1)
> > -            If (And(Local0, 0x07)) {
> > -                // Shift down previously read bitmap byte
> > -                ShiftRight(Local2, 1, Local2)
> > -            } Else {
> > -                // Read next byte from cpu bitmap
> > -                Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2)
> > -            }
> > -            // Local3 = active state for this cpu
> > -            Store(And(Local2, 1), Local3)
> > -
> > -            If (LNotEqual(Local1, Local3)) {
> > -                // State change - update CPON with new state
> > -                Store(Local3, Index(CPON, Local0))
> > -                // Do CPU notify
> > -                If (LEqual(Local3, 1)) {
> > -                    NTFY(Local0, 1)
> > -                } Else {
> > -                    NTFY(Local0, 3)
> > -                }
> > -            }
> > -            Increment(Local0)
> > -        }
> > -    }
> >  }
> > diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
> > index 90efce0..fa9f2d4 100644
> > --- a/hw/i386/acpi-dsdt.dsl
> > +++ b/hw/i386/acpi-dsdt.dsl
> > @@ -311,7 +311,7 @@ DefinitionBlock (
> >          }
> >          Method(_E02) {
> >              // CPU hotplug event
> > -            \_SB.PRSC()
> > +            \_SB.CPHD.PRSC()
> >          }
> >          Method(_L03) {
> >          }
> > diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
> > index 22baa58..9ccc543 100644
> > --- a/hw/i386/q35-acpi-dsdt.dsl
> > +++ b/hw/i386/q35-acpi-dsdt.dsl
> > @@ -420,7 +420,7 @@ DefinitionBlock (
> >          }
> >          Method(_E02) {
> >              // CPU hotplug event
> > -            \_SB.PRSC()
> > +            \_SB.CPHD.PRSC()
> >          }
> >          Method(_L03) {
> >          }
> > diff --git a/hw/i386/ssdt-misc.dsl b/hw/i386/ssdt-misc.dsl
> > index a4484b8..ec8893c 100644
> > --- a/hw/i386/ssdt-misc.dsl
> > +++ b/hw/i386/ssdt-misc.dsl
> > @@ -116,4 +116,69 @@ DefinitionBlock ("ssdt-misc.aml", "SSDT", 0x01, "BXPC", "BXSSDTSUSP", 0x1)
> >              }
> >          }
> >      }
> > +    Scope(\_SB) {
> > +        External(NTFY, MethodObj)
> > +        External(CPON, PkgObj)
> > +
> > +        Device(CPHD) {
> > +            Name(_HID, EISAID("PNP0C08"))
> > +            Name(CPPL, 32) // cpu-gpe length
> > +            Name(CPHP, 0xaf00)
> > +
> > +            OperationRegion(PRST, SystemIO, CPHP, CPPL)
> > +            Field(PRST, ByteAcc, NoLock, Preserve) {
> > +                PRS, 256
> > +            }
> > +
> > +            Method(PRSC, 0) {
> > +                // Local5 = active cpu bitmap
> > +                Store(PRS, Local5)
> > +                // Local2 = last read byte from bitmap
> > +                Store(Zero, Local2)
> > +                // Local0 = Processor ID / APIC ID iterator
> > +                Store(Zero, Local0)
> > +                While (LLess(Local0, SizeOf(CPON))) {
> > +                    // Local1 = CPON flag for this cpu
> > +                    Store(DerefOf(Index(CPON, Local0)), Local1)
> > +                    If (And(Local0, 0x07)) {
> > +                        // Shift down previously read bitmap byte
> > +                        ShiftRight(Local2, 1, Local2)
> > +                    } Else {
> > +                        // Read next byte from cpu bitmap
> > +                        Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2)
> > +                    }
> > +                    // Local3 = active state for this cpu
> > +                    Store(And(Local2, 1), Local3)
> > +
> > +                    If (LNotEqual(Local1, Local3)) {
> > +                        // State change - update CPON with new state
> > +                        Store(Local3, Index(CPON, Local0))
> > +                        // Do CPU notify
> > +                        If (LEqual(Local3, 1)) {
> > +                            NTFY(Local0, 1)
> > +                        } Else {
> > +                            NTFY(Local0, 3)
> > +                        }
> > +                    }
> > +                    Increment(Local0)
> > +                }
> > +            }
> > +
> > +            /* Leave bit 0 cleared to avoid Windows BSOD */
> > +            Name(_STA, 0xA)
> 
> This shared the problem you yourself pointed out with
> patch 'pc: ACPI BIOS: implement memory hotplug':
> if we make device non present ospm can ignore our _CRS.
I repeat my question is there need to expose it OperationRegion as _CRS?

> 
> Can't we get a better handle on why windows crashes?
Short of installing debug build and looking at crash dump and/or reverse
engineering acpi.sys, might give a clue, I don't have any other idea.
Are there any simpler suggestions?

> 
> 
> > +
> > +            Method(_CRS, 0) {
> > +                Store(ResourceTemplate() {
> > +                    IO(Decode16, 0x00, 0x00, 0x01, 0x15, IO)
> > +                }, Local0)
> > +
> > +                CreateWordField(Local0, IO._MIN, IOMN)
> > +                CreateWordField(Local0, IO._MAX, IOMX)
> > +
> > +                Store(CPHP, IOMN)
> > +                Subtract(Add(CPHP, CPPL), 1, IOMX)
> > +                Return(Local0)
> > +            }
> > +        } // Device(CPHD)
> > +    } // Scope(\_SB)
> >  }
> > -- 
> > 1.8.3.1
> 


-- 
Regards,
  Igor

  reply	other threads:[~2013-12-16 22:15 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-13 16:22 [Qemu-devel] [PATCH 00/11] pc: CPU hotplug support for Q35 Igor Mammedov
2013-12-13 16:22 ` [Qemu-devel] [PATCH 01/11] acpi: piix4: remove not needed GPE0 mask Igor Mammedov
2013-12-19 14:16   ` Michael S. Tsirkin
2013-12-13 16:22 ` [Qemu-devel] [PATCH 02/11] acpi: factor out common pm_update_sci() into acpi core Igor Mammedov
2013-12-19 14:16   ` Michael S. Tsirkin
2013-12-13 16:22 ` [Qemu-devel] [PATCH 03/11] acpi: factor out common cpu hotplug code for PIIX4/Q35 Igor Mammedov
2013-12-19 14:14   ` Michael S. Tsirkin
2013-12-19 15:13     ` Igor Mammedov
2013-12-13 16:22 ` [Qemu-devel] [PATCH 04/11] acpi/piix4: add readonly "cpu-hotplug-io-base" property Igor Mammedov
2013-12-13 16:22 ` [Qemu-devel] [PATCH 05/11] acpi: ich9: allow guest to clear SCI rised by GPE Igor Mammedov
2013-12-19 14:16   ` Michael S. Tsirkin
2013-12-13 16:22 ` [Qemu-devel] [PATCH 06/11] acpi/ich9: add CPU hotplug handling to Q35 machine Igor Mammedov
2013-12-19 14:18   ` Michael S. Tsirkin
2013-12-19 15:17     ` Igor Mammedov
2013-12-19 15:33       ` Michael S. Tsirkin
2013-12-13 16:22 ` [Qemu-devel] [PATCH 07/11] ACPI: Q35 DSDT: fix CPU hotplug GPE0.2 handler Igor Mammedov
2013-12-13 16:22 ` [Qemu-devel] [PATCH 08/11] ACPI/DSDT-CPU: cleanup bogus comment Igor Mammedov
2013-12-13 16:22 ` [Qemu-devel] [PATCH 09/11] ACPI: move PRST OperationRegion into SSDT Igor Mammedov
2013-12-16 19:30   ` Michael S. Tsirkin
2013-12-16 20:38     ` Igor Mammedov
2013-12-16 21:13       ` Laszlo Ersek
2013-12-16 21:22         ` Laszlo Ersek
2013-12-16 21:53         ` Igor Mammedov
2013-12-17 10:39           ` Michael S. Tsirkin
2013-12-16 21:44       ` Laszlo Ersek
2013-12-16 21:59         ` Igor Mammedov
2013-12-16 22:22           ` Laszlo Ersek
2013-12-16 23:13             ` Igor Mammedov
2013-12-16 19:53   ` Michael S. Tsirkin
2013-12-16 22:15     ` Igor Mammedov [this message]
2013-12-22 14:51     ` Igor Mammedov
2013-12-23 11:26       ` Michael S. Tsirkin
2013-12-23 13:06         ` Igor Mammedov
2013-12-23 14:48           ` Michael S. Tsirkin
2013-12-23 16:24             ` Igor Mammedov
2013-12-23 16:52               ` Laszlo Ersek
2013-12-28  0:39                 ` Igor Mammedov
2013-12-23 16:55               ` Michael S. Tsirkin
2013-12-13 16:22 ` [Qemu-devel] [PATCH 10/11] ACPI: set CPU hotplug io base dynamically Igor Mammedov
2013-12-13 16:22 ` [Qemu-devel] [PATCH 11/11] ACPI: update ssdt-misc.hex.generated acpi-dsdt.hex.generated q35-acpi-dsdt.hex.generated Igor Mammedov

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=20131216231516.39e7b44a@thinkpad \
    --to=imammedo@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=brogers@suse.com \
    --cc=chen.fan.fnst@cn.fujitsu.com \
    --cc=hutao@cn.fujitsu.com \
    --cc=jjherne@us.ibm.com \
    --cc=kaneshige.kenji@jp.fujitsu.com \
    --cc=kraxel@redhat.com \
    --cc=lersek@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.