From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:43186) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9Zbb-0004aM-Mc for qemu-devel@nongnu.org; Tue, 12 Apr 2011 05:09:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q9Zba-0006mj-Cd for qemu-devel@nongnu.org; Tue, 12 Apr 2011 05:09:51 -0400 Received: from [222.73.24.84] (port=63691 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9Zba-0006kZ-4O for qemu-devel@nongnu.org; Tue, 12 Apr 2011 05:09:50 -0400 Message-ID: <4DA41682.4010208@cn.fujitsu.com> Date: Tue, 12 Apr 2011 17:08:18 +0800 From: Wen Congyang MIME-Version: 1.0 References: <4DA3DF6B.8010308@cn.fujitsu.com> <20110412084850.GD30075@valinux.co.jp> In-Reply-To: <20110412084850.GD30075@valinux.co.jp> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Qemu-devel] [PATCH] fix acpi regression List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Isaku Yamahata Cc: blauwirbel@gmail.com, qemu-devel , Aurelien Jarno At 04/12/2011 04:48 PM, Isaku Yamahata Write: > On Tue, Apr 12, 2011 at 01:13:15PM +0800, Wen Congyang wrote: >> This bug is introduced by commit 23910d3f. > > Oh, Thanks. Good catch. I agree with the first hunk. > But what is the second hunk for? The GPE STS register is W1C. > (NULL check and 0xff masking is okay. it's a bit redundant, though) I found this bug when I hotplug a nic. I do not know about ACPI. The second hunk is the same before commit 23910d3f. I will read ACPI spec to confirm it and update this patch. Thanks > >>>From ACPI4 spec 4.7.4.1.1. > can only be cleared by software writing a "1" to its respective bit position. > > thanks, > >> >> Signed-off-by: Wen Congyang >> >> --- >> hw/acpi.c | 10 +++------- >> 1 files changed, 3 insertions(+), 7 deletions(-) >> >> diff --git a/hw/acpi.c b/hw/acpi.c >> index e372474..790bd3b 100644 >> --- a/hw/acpi.c >> +++ b/hw/acpi.c >> @@ -355,7 +355,7 @@ static uint8_t *acpi_gpe_ioport_get_ptr(ACPIGPE *gpe, uint32_t addr) >> if (addr < gpe->len / 2) { >> cur = gpe->sts + addr; >> } else if (addr < gpe->len) { >> - cur = gpe->en + addr; >> + cur = gpe->en + addr - gpe->len / 2; >> } else { >> abort(); >> } >> @@ -369,12 +369,8 @@ void acpi_gpe_ioport_writeb(ACPIGPE *gpe, uint32_t addr, uint32_t val) >> >> addr -= gpe->blk; >> cur = acpi_gpe_ioport_get_ptr(gpe, addr); >> - if (addr < gpe->len / 2) { >> - /* GPE_STS */ >> - *cur = (*cur) & ~val; >> - } else if (addr < gpe->len) { >> - /* GPE_EN */ >> - *cur = val; >> + if (cur != NULL) { >> + *cur = val & 0xff; >> } else { >> abort(); >> } >> -- >> 1.7.1 >>