Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp81272pxb; Wed, 4 Nov 2020 15:17:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJxNT8lzHJLOQH5iw5sbB7YGPJse/7XTRAySbU0CKZm1atQk9JR2RQb/4bbRz5dxt122tqBc X-Received: by 2002:aa7:d992:: with SMTP id u18mr180249eds.284.1604531863800; Wed, 04 Nov 2020 15:17:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604531863; cv=none; d=google.com; s=arc-20160816; b=DOCjUY22JRLdrwld7EQI+ZDho6ihWuGhjQ7iQuOuEwhsJJSEdcBE1FVe0PdsgEoSOa vVjn0zDh2ZA4Lr/QJDGAii6y1GY7cVeKijQmRf7y2FJGINkujGhsT845noC9Damd73C+ tPCCzTaBeqeRlP13ftlQt4t4g+L2Szw49F33s3IN+S9kgp2sessi/z0qfYFqWw9KwKXI PWPcq04crXvRtpFdhnPN7zZYxtI6iouqlt/CjmXPqAhVQ1oFcbm5BhmkVvFr9xCU0ax8 Ef2raLKcwFYDcQs6oxQrINTrlza2wsMmaEv9n9KclAdcC5lvYmJJIzWByZg2ea6Q+z1s u5YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=S1uT/ory2tJYYKprq7tpAtg+6JYjWTDzAvdKLuSxFsE=; b=cor/jQ5m1Fv2jk0LG9mINLTECmN/UJ01aD5HyxZErtoasOMgu/iKvv8neC+bpM4EKM dCTc9EWbSOhBc/BIQ+qs/5lqcAIgQC2E+Q/T4JcmJjPYW4w13x8awFE+P6HG+03fLnqE qQ+fqwSDPrL5X+pkND8ChowVsqxORdzS1OWwJPM6efCsuaXMyX3jrarZ4Hd8jVLjqNkm oUycPUxKNr1iToSH5wRYbHv6Mg6MIsFtvXj+Zqb2ubFTecVYA3KdCfLPFhhrSF/0GmuW 23fYDujFD97ktAq29SjL2gUZyY2fqWQZ1ZjK8VZrOAKt8ttKKPFxSrSxVRJ6ApGEyyie y6bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="zxQWjZ8/"; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lr26si2252344ejb.747.2020.11.04.15.17.17; Wed, 04 Nov 2020 15:17:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="zxQWjZ8/"; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732588AbgKDXOb (ORCPT + 99 others); Wed, 4 Nov 2020 18:14:31 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:52522 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732553AbgKDXOZ (ORCPT ); Wed, 4 Nov 2020 18:14:25 -0500 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1604531661; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=S1uT/ory2tJYYKprq7tpAtg+6JYjWTDzAvdKLuSxFsE=; b=zxQWjZ8/AB2Lwf78tMX7LeYKasG61OYcb90cptjPXIebDsJSwRhcNkMrSTvCJZ1yGDbEyR NXEA+Vo57Iybw8eFxlOuM68KL7Mi0R/iV8SC3tl2QcbA2cBdwTwHuTmLnaLY46yIjK0jcH WaJZ2/ttNxTf6dWOU4hw1IngCDCEAkqQpPqpP2a+7GQo7YMxgEDijLuI1udRtf9YcEv8JO 0NfuyhdFKs83wvb7TEl8omLUTe51wXqvi9Qihu6s8PkMBSwCejhj1c12Z6bu1RuWADWH29 15zj/t5AAwE3kJaF4wJ1SZWXdESIff94YI3z7nMPCgOHNZDBM5bKymokk/CZmA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1604531661; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=S1uT/ory2tJYYKprq7tpAtg+6JYjWTDzAvdKLuSxFsE=; b=dOfXSMPz5OxVxeZ5HDfZvfWqs8tGpBO9c7pDG6DteaqHiILOmLTr2FhW29AGAczpj5iDdb PrIdVoFXFH/Z+1AQ== To: Frank Wunderlich Cc: Marc Zyngier , Ryder Lee , linux-mediatek@lists.infradead.org, Frank Wunderlich , linux-kernel@vger.kernel.org, Matthias Brugger , linux-pci@vger.kernel.org, Bjorn Helgaas Subject: Re: Aw: Re: Re: [PATCH] pci: mediatek: fix warning in msi.h In-Reply-To: References: <20201031140330.83768-1-linux@fw-web.de> <878sbm9icl.fsf@nanos.tec.linutronix.de> <87lfflti8q.wl-maz@kernel.org> <1604253261.22363.0.camel@mtkswgap22> <87k0v4u4uq.wl-maz@kernel.org> <87pn4w90hm.fsf@nanos.tec.linutronix.de> <87h7q791j8.fsf@nanos.tec.linutronix.de> <877dr38kt8.fsf@nanos.tec.linutronix.de> <901c5eb8bbaa3fe53ddc8f65917e48ef@kernel.org> <87o8ke7njb.fsf@nanos.tec.linutronix.de> Date: Thu, 05 Nov 2020 00:14:20 +0100 Message-ID: <87h7q4lnoz.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Frank, On Wed, Nov 04 2020 at 17:49, Frank Wunderlich wrote: >> Von: "Thomas Gleixner" >> Any architecture which selects PCI_MSI_ARCH_FALLBACKS and does not have >> irqdomain support runs into: >> >> if (!d) >> bus->bus_flags |= PCI_BUS_FLAGS_NO_MSI; >> >> which in turn makes pci_msi_supported() return 0 and consequently makes >> pci_enable_msi[x]() fail. > > i'm not that deep into this, but just my thoughts...you are the experts :) > > checking for PCI_MSI_ARCH_FALLBACKS here does not help? > > something like this: > > #ifndef PCI_MSI_ARCH_FALLBACKS > if (!d) > bus->bus_flags |= PCI_BUS_FLAGS_NO_MSI; > #endif TBH, that's butt ugly. So after staring long enough into the PCI code I came up with a way to transport that information to the probe code. That allows a particular device to say 'I can't do MSI' and at the same time keeps the warning machinery intact which tells us that a particular host controller driver is broken. Uncompiled and untested as usual :) Thanks, tglx --- drivers/pci/controller/pcie-mediatek.c | 4 ++++ drivers/pci/probe.c | 3 +++ include/linux/pci.h | 1 + 3 files changed, 8 insertions(+) --- a/drivers/pci/controller/pcie-mediatek.c +++ b/drivers/pci/controller/pcie-mediatek.c @@ -143,6 +143,7 @@ struct mtk_pcie_port; * struct mtk_pcie_soc - differentiate between host generations * @need_fix_class_id: whether this host's class ID needed to be fixed or not * @need_fix_device_id: whether this host's device ID needed to be fixed or not + * @no_msi: Bridge has no MSI support * @device_id: device ID which this host need to be fixed * @ops: pointer to configuration access functions * @startup: pointer to controller setting functions @@ -151,6 +152,7 @@ struct mtk_pcie_port; struct mtk_pcie_soc { bool need_fix_class_id; bool need_fix_device_id; + bool no_msi; unsigned int device_id; struct pci_ops *ops; int (*startup)(struct mtk_pcie_port *port); @@ -1084,6 +1086,7 @@ static int mtk_pcie_probe(struct platfor host->ops = pcie->soc->ops; host->sysdata = pcie; + host->no_msi = pcie->soc->no_msi; err = pci_host_probe(host); if (err) @@ -1173,6 +1176,7 @@ static const struct dev_pm_ops mtk_pcie_ }; static const struct mtk_pcie_soc mtk_pcie_soc_v1 = { + .no_msi = true, .ops = &mtk_pcie_ops, .startup = mtk_pcie_startup_port, }; --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -889,6 +889,9 @@ static int pci_register_host_bridge(stru if (!bus) return -ENOMEM; + if (bridge->no_msi) + bus->bus_flags |= PCI_BUS_FLAGS_NO_MSI; + bridge->bus = bus; /* Temporarily move resources off the list */ --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -545,6 +545,7 @@ struct pci_host_bridge { unsigned int native_dpc:1; /* OS may use PCIe DPC */ unsigned int preserve_config:1; /* Preserve FW resource setup */ unsigned int size_windows:1; /* Enable root bus sizing */ + unsigned int no_msi:1; /* Bridge has no MSI support */ /* Resource alignment requirements */ resource_size_t (*align_resource)(struct pci_dev *dev,