From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wen Congyang Subject: Re: [RFC PATCH v2 03/21][SeaBIOS] acpi-dsdt: Implement functions for memory hotplug Date: Tue, 17 Jul 2012 15:23:00 +0800 Message-ID: <500512D4.8070202@cn.fujitsu.com> References: <1342002726-18258-1-git-send-email-vasilis.liaskovitis@profitbricks.com> <1342002726-18258-4-git-send-email-vasilis.liaskovitis@profitbricks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, seabios@seabios.org, avi@redhat.com, anthony@codemonkey.ws, gleb@redhat.com, imammedo@redhat.com, kevin@koconnor.net To: Vasilis Liaskovitis Return-path: Received: from cn.fujitsu.com ([222.73.24.84]:1660 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751476Ab2GQHSS (ORCPT ); Tue, 17 Jul 2012 03:18:18 -0400 In-Reply-To: <1342002726-18258-4-git-send-email-vasilis.liaskovitis@profitbricks.com> Sender: kvm-owner@vger.kernel.org List-ID: At 07/11/2012 06:31 PM, Vasilis Liaskovitis Wrote: > Extend the DSDT to include methods for handling memory hot-add and hot-remove > notifications and memory device status requests. These functions are called > from the memory device SSDT methods. > > Signed-off-by: Vasilis Liaskovitis > --- > src/acpi-dsdt.dsl | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++- > 1 files changed, 68 insertions(+), 2 deletions(-) > > diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl > index 2060686..5d3e92b 100644 > --- a/src/acpi-dsdt.dsl > +++ b/src/acpi-dsdt.dsl > @@ -737,6 +737,71 @@ DefinitionBlock ( > } > Return(One) > } > + /* Objects filled in by run-time generated SSDT */ > + External(MTFY, MethodObj) > + External(MEON, PkgObj) > + > + Method (CMST, 1, NotSerialized) { > + // _STA method - return ON status of memdevice > + // Local0 = MEON flag for this cpu > + Store(DerefOf(Index(MEON, Arg0)), Local0) > + If (Local0) { Return(0xF) } Else { Return(0x0) } > + } > + > + /* Memory hotplug notify array */ > + OperationRegion(MEST, SystemIO, 0xaf80, 32) > + Field (MEST, ByteAcc, NoLock, Preserve) > + { > + MES, 256 > + } > + > + /* Memory eject byte */ > + OperationRegion(MEMJ, SystemIO, 0xafa0, 1) > + Field (MEMJ, ByteAcc, NoLock, Preserve) > + { > + MPE, 8 > + } > + > + Method(MESC, 0) { > + // Local5 = active memdevice bitmap > + Store (MES, Local5) > + // Local2 = last read byte from bitmap > + Store (Zero, Local2) > + // Local0 = memory device iterator > + Store (Zero, Local0) > + While (LLess(Local0, SizeOf(MEON))) { > + // Local1 = MEON flag for this memory device > + Store(DerefOf(Index(MEON, Local0)), Local1) > + If (And(Local0, 0x07)) { > + // Shift down previously read bitmap byte > + ShiftRight(Local2, 1, Local2) > + } Else { > + // Read next byte from memdevice bitmap > + Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2) > + } > + // Local3 = active state for this memory device > + Store(And(Local2, 1), Local3) > + > + If (LNotEqual(Local1, Local3)) { There are two ways to hot remove a memory device: 1. dimm_del 2. echo 1 >/sys/bus/acpi/devices/PNP0C80:XX/eject In the 2nd case, we cannot hotplug this memory device again, because both Local1 and Local3 are 1. So, I think MEON flag for this meory device should be set to 0 in method _EJ0 or implement method _PS3 for memory device. Thanks Wen Congyang > + // State change - update MEON with new state > + Store(Local3, Index(MEON, Local0)) > + // Do MEM notify > + If (LEqual(Local3, 1)) { > + MTFY(Local0, 1) > + } Else { > + MTFY(Local0, 3) > + } > + } > + Increment(Local0) > + } > + Return(One) > + } > + > + Method (MPEJ, 2, NotSerialized) { > + // _EJ0 method - eject callback > + Store(Arg0, MPE) > + Sleep(200) > + } > } > > > @@ -759,8 +824,9 @@ DefinitionBlock ( > // CPU hotplug event > Return(\_SB.PRSC()) > } > - Method(_L03) { > - Return(0x01) > + Method(_E03) { > + // Memory hotplug event > + Return(\_SB.MESC()) > } > Method(_L04) { > Return(0x01) From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55652) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sr23B-0005EB-Ty for qemu-devel@nongnu.org; Tue, 17 Jul 2012 03:18:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sr23A-0001oZ-Qi for qemu-devel@nongnu.org; Tue, 17 Jul 2012 03:18:29 -0400 Received: from [222.73.24.84] (port=3460 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sr23A-0001lh-Fv for qemu-devel@nongnu.org; Tue, 17 Jul 2012 03:18:28 -0400 Message-ID: <500512D4.8070202@cn.fujitsu.com> Date: Tue, 17 Jul 2012 15:23:00 +0800 From: Wen Congyang MIME-Version: 1.0 References: <1342002726-18258-1-git-send-email-vasilis.liaskovitis@profitbricks.com> <1342002726-18258-4-git-send-email-vasilis.liaskovitis@profitbricks.com> In-Reply-To: <1342002726-18258-4-git-send-email-vasilis.liaskovitis@profitbricks.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Qemu-devel] [RFC PATCH v2 03/21][SeaBIOS] acpi-dsdt: Implement functions for memory hotplug List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vasilis Liaskovitis Cc: kvm@vger.kernel.org, gleb@redhat.com, seabios@seabios.org, qemu-devel@nongnu.org, kevin@koconnor.net, avi@redhat.com, anthony@codemonkey.ws, imammedo@redhat.com At 07/11/2012 06:31 PM, Vasilis Liaskovitis Wrote: > Extend the DSDT to include methods for handling memory hot-add and hot-remove > notifications and memory device status requests. These functions are called > from the memory device SSDT methods. > > Signed-off-by: Vasilis Liaskovitis > --- > src/acpi-dsdt.dsl | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++- > 1 files changed, 68 insertions(+), 2 deletions(-) > > diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl > index 2060686..5d3e92b 100644 > --- a/src/acpi-dsdt.dsl > +++ b/src/acpi-dsdt.dsl > @@ -737,6 +737,71 @@ DefinitionBlock ( > } > Return(One) > } > + /* Objects filled in by run-time generated SSDT */ > + External(MTFY, MethodObj) > + External(MEON, PkgObj) > + > + Method (CMST, 1, NotSerialized) { > + // _STA method - return ON status of memdevice > + // Local0 = MEON flag for this cpu > + Store(DerefOf(Index(MEON, Arg0)), Local0) > + If (Local0) { Return(0xF) } Else { Return(0x0) } > + } > + > + /* Memory hotplug notify array */ > + OperationRegion(MEST, SystemIO, 0xaf80, 32) > + Field (MEST, ByteAcc, NoLock, Preserve) > + { > + MES, 256 > + } > + > + /* Memory eject byte */ > + OperationRegion(MEMJ, SystemIO, 0xafa0, 1) > + Field (MEMJ, ByteAcc, NoLock, Preserve) > + { > + MPE, 8 > + } > + > + Method(MESC, 0) { > + // Local5 = active memdevice bitmap > + Store (MES, Local5) > + // Local2 = last read byte from bitmap > + Store (Zero, Local2) > + // Local0 = memory device iterator > + Store (Zero, Local0) > + While (LLess(Local0, SizeOf(MEON))) { > + // Local1 = MEON flag for this memory device > + Store(DerefOf(Index(MEON, Local0)), Local1) > + If (And(Local0, 0x07)) { > + // Shift down previously read bitmap byte > + ShiftRight(Local2, 1, Local2) > + } Else { > + // Read next byte from memdevice bitmap > + Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2) > + } > + // Local3 = active state for this memory device > + Store(And(Local2, 1), Local3) > + > + If (LNotEqual(Local1, Local3)) { There are two ways to hot remove a memory device: 1. dimm_del 2. echo 1 >/sys/bus/acpi/devices/PNP0C80:XX/eject In the 2nd case, we cannot hotplug this memory device again, because both Local1 and Local3 are 1. So, I think MEON flag for this meory device should be set to 0 in method _EJ0 or implement method _PS3 for memory device. Thanks Wen Congyang > + // State change - update MEON with new state > + Store(Local3, Index(MEON, Local0)) > + // Do MEM notify > + If (LEqual(Local3, 1)) { > + MTFY(Local0, 1) > + } Else { > + MTFY(Local0, 3) > + } > + } > + Increment(Local0) > + } > + Return(One) > + } > + > + Method (MPEJ, 2, NotSerialized) { > + // _EJ0 method - eject callback > + Store(Arg0, MPE) > + Sleep(200) > + } > } > > > @@ -759,8 +824,9 @@ DefinitionBlock ( > // CPU hotplug event > Return(\_SB.PRSC()) > } > - Method(_L03) { > - Return(0x01) > + Method(_E03) { > + // Memory hotplug event > + Return(\_SB.MESC()) > } > Method(_L04) { > Return(0x01)