From patchwork Tue Aug 26 09:52:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 4779331 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8C812C033A for ; Tue, 26 Aug 2014 09:53:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CDAD120154 for ; Tue, 26 Aug 2014 09:53:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E9D98201D5 for ; Tue, 26 Aug 2014 09:53:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754193AbaHZJw7 (ORCPT ); Tue, 26 Aug 2014 05:52:59 -0400 Received: from mga01.intel.com ([192.55.52.88]:63136 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754161AbaHZJw6 (ORCPT ); Tue, 26 Aug 2014 05:52:58 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 26 Aug 2014 02:52:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,403,1406617200"; d="scan'208";a="589933375" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.95]) by fmsmga002.fm.intel.com with SMTP; 26 Aug 2014 02:52:23 -0700 Received: by lahna (sSMTP sendmail emulation); Tue, 26 Aug 2014 12:52:21 +0300 Date: Tue, 26 Aug 2014 12:52:21 +0300 From: Mika Westerberg To: Jiang Liu Cc: Benjamin Herrenschmidt , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "Rafael J. Wysocki" , Bjorn Helgaas , Randy Dunlap , Yinghai Lu , Borislav Petkov , Grant Likely , x86@kernel.org, Prarit Bhargava , Konrad Rzeszutek Wilk , Andrew Morton , Tony Luck , Joerg Roedel , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, Ingo Molnar Subject: Re: [Bugfix] x86, irq: Fix bug in setting IOAPIC pin attributes Message-ID: <20140826095221.GO1660@lahna.fi.intel.com> References: <20140822124145.GF1660@lahna.fi.intel.com> <1409042706-11958-1-git-send-email-jiang.liu@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1409042706-11958-1-git-send-email-jiang.liu@linux.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Aug 26, 2014 at 04:45:01PM +0800, Jiang Liu wrote: > On startup, IOAPIC driver preallocates IRQ descriptors and programs > IOAPIC pins with default level and polarity attributes for all legacy > IRQs. Later legacy IRQ users may fail to set IOAPIC pin attributes > if the requested attributes conflicts with the default IOAPIC pin > attributes. So change mp_irqdomain_map() to allow the first legacy IRQ > user to reprogram IOAPIC pin with different attributes. > > Signed-off-by: Jiang Liu I tried this and now we get further in setting up the IOAPIC but it still doesn't work :-( I noticed that mp_set_gsi_attr() never programs the IOAPIC in case info->set is 0 so I added following on top of your patch. With the below patch, the system seems to work as expected. --- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 66c2700c9f83..777762a0ad09 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -3942,10 +3942,16 @@ int mp_set_gsi_attr(u32 gsi, int trigger, int polarity, int node) mutex_lock(&ioapic_mutex); if (!info->set) { + struct io_apic_irq_attr attr; + info->trigger = trigger; info->polarity = polarity; info->node = node; info->set = 1; + + /* Now program the IOAPIC with the new attributes */ + set_io_apic_irq_attr(&attr, ioapic, pin, trigger, polarity); + ret = io_apic_setup_irq_pin(gsi, node, &attr); } else if (info->trigger != trigger || info->polarity != polarity) { ret = -EBUSY; }