From: Guido Guenther Subject: Re: acpi sci polarity Date: Fri, 4 Jan 2008 19:31:58 +0100 Message-ID: <20080104183158.GA14002@bogon.ms20.nix> References: <20080103181132.GA1077@bogon.ms20.nix> <20080103181415.GB1077@bogon.ms20.nix> <477D50FE.4040104@qumranet.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Avi Kivity Return-path: Content-Disposition: inline In-Reply-To: <477D50FE.4040104-atKUWr5tajBWk0Htik3J/w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Hi Avi, On Thu, Jan 03, 2008 at 11:17:50PM +0200, Avi Kivity wrote: > While pci interrupts are documented as active high, the documentation for > the piix4 pic elcr registers suggests piix4 level-triggered interrupts are > active high. So there is some inconsistency somewhere involving qemu > interrupt generation (which IIRC treats all interrupts as active high), the > ioapic (qemu doesn't implement polarity), bios setup, and the acpi dsdt. We currently specify INT10 as active high in the dsl so I added an override entry to the madt an now the OS knows about it and things work as expected - we this be o.k. until all the IRQ setup gets a revamp: >From 7950892de473d42ce57e0727594190b4bfafab14 Mon Sep 17 00:00:00 2001 From: Guido Guenther Date: Fri, 4 Jan 2008 19:26:33 +0100 Subject: [PATCH] int 10 is currently active high so add a proper interrupt override entry to the MADT so the OS knows about it. Fixes the ACPI powerbutton and should also fix the PM timer. diff --git a/bios/rombios32.c b/bios/rombios32.c index 7a96ece..99f7d23 100755 --- a/bios/rombios32.c +++ b/bios/rombios32.c @@ -1181,6 +1181,14 @@ struct madt_io_apic * lines start */ }; +struct madt_intsrcovr { + APIC_HEADER_DEF + uint8_t bus; + uint8_t source; + uint32_t gsi; + uint16_t flags; +}; + #include "acpi-dsdt.hex" static inline uint16_t cpu_to_le16(uint16_t x) @@ -1271,9 +1279,10 @@ void acpi_bios_init(void) addr = (addr + 7) & ~7; madt_addr = addr; - madt_size = sizeof(*madt) + + madt_size = sizeof(*madt) + sizeof(struct madt_processor_apic) * smp_cpus + - sizeof(struct madt_io_apic); + sizeof(struct madt_io_apic) + + sizeof(struct madt_intsrcovr); madt = (void *)(addr); addr += madt_size; @@ -1335,6 +1344,7 @@ void acpi_bios_init(void) { struct madt_processor_apic *apic; struct madt_io_apic *io_apic; + struct madt_intsrcovr *intsrcovr; memset(madt, 0, madt_size); madt->local_apic_address = cpu_to_le32(0xfee00000); @@ -1355,6 +1365,15 @@ void acpi_bios_init(void) io_apic->address = cpu_to_le32(0xfec00000); io_apic->interrupt = cpu_to_le32(0); + /* int 10 (SCI) is active high atm */ + intsrcovr = (struct madt_intsrcovr*)(io_apic + 1); + memset(intsrcovr, 0, sizeof(*intsrcovr)); + intsrcovr->type = APIC_XRUPT_OVERRIDE; + intsrcovr->length = sizeof(*intsrcovr); + intsrcovr->source = 10; + intsrcovr->gsi = 10; + intsrcovr->flags = 0xd; + acpi_build_table_header((struct acpi_table_header *)madt, "APIC", madt_size); } Cheers, -- Guido ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/