Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 828A5C43441 for ; Wed, 14 Nov 2018 22:21:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4823B2250E for ; Wed, 14 Nov 2018 22:21:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4823B2250E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-pci-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726240AbeKOI0D (ORCPT ); Thu, 15 Nov 2018 03:26:03 -0500 Received: from foss.arm.com ([217.140.101.70]:51916 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725952AbeKOI0D (ORCPT ); Thu, 15 Nov 2018 03:26:03 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E289880D; Wed, 14 Nov 2018 14:01:53 -0800 (PST) Received: from big-swifty.misterjones.org (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8E3993F5A0; Wed, 14 Nov 2018 14:01:53 -0800 (PST) Date: Wed, 14 Nov 2018 22:01:49 +0000 Message-ID: <86sh0348tu.wl-marc.zyngier@arm.com> From: Marc Zyngier To: Trent Piepho Cc: "gustavo.pimentel@synopsys.com" , "jingoohan1@gmail.com" , "faiz_abbas@ti.com" , "linux-pci@vger.kernel.org" , "lorenzo.pieralisi@arm.com" , "helgaas@google.com" , "vigneshr@ti.com" , "Joao.Pinto@synopsys.com" Subject: Re: [PATCH 0/3] PCI: designware: Fixing MSI handling flow In-Reply-To: <1542223166.30311.471.camel@impinj.com> References: <20181113225734.8026-1-marc.zyngier@arm.com> <86a7mcdlwg.wl-marc.zyngier@arm.com> <1542223166.30311.471.camel@impinj.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 EasyPG/1.0.0 Emacs/25.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Organization: ARM Ltd MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Wed, 14 Nov 2018 19:19:27 +0000, Trent Piepho wrote: > > On Wed, 2018-11-14 at 09:54 +0000, Marc Zyngier wrote: > > /* Initialize IRQ Status array */ > > - for (ctrl = 0; ctrl < num_ctrls; ctrl++) > > - dw_pcie_rd_own_conf(pp, PCIE_MSI_INTR0_ENABLE + > > + for (ctrl = 0; ctrl < num_ctrls; ctrl++) { > > + dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_MASK + > > (ctrl * MSI_REG_CTRL_BLOCK_SIZE), > > - 4, &pp->irq_status[ctrl]); > > + 4, ~0); > > + dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE + > > + (ctrl * MSI_REG_CTRL_BLOCK_SIZE), > > + 4, ~0); > > + pp->irq_status[ctrl] = 0; > > + } > > > > I tested yesterday before this patch was sent and fixed this issue > another way. I pretty sure this would work as well, though it's not > clear to me it's more correct. Given that we don't have a spec or any form of useful documentation (except for the information that Gustavo gave us), I don't think *anything* we'll write here has a remote chance of being correct. We're simply poking in the dark. > It looks to me that the previous code was using whatever MSIs were > already enabled when the driver is initialized as the set to leave > enabled. And I claim that this is a gross bug. We don't want to inherit anything at all, rather start from a fresh start. > This looks like it changing that behavior, and instead enabling all > MSIs on initialization. > > I would think the default value for a MSI should be disabled until > something enables it. Sure, that's no big deal. We can plug in the enable/disable callbacks to that effect, although we'll end-up with similar result, I'd expect. > I speculated that the previous behavior was trying to work with an MSI > enabled by the bootloader, ACPI firmware, etc. that should be left > alone. Or perhaps there was no good reason not to disable everything > on initialization and that code just got copied from somewhere else and > no one thought about it. There's certainly evidence of that in this > driver. As you said, you're speculating. Nonetheless, there is no reason to start with anything enabled the first place. M. -- Jazz is not dead, it just smell funny.