From patchwork Thu Mar 21 09:59:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 160761 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp595966jan; Thu, 21 Mar 2019 03:01:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJGmizABitxwNM2VZ/DKg6Y7atbL922Dvgb1wVnG0Bj6fMQfz8tfTWmOm4MZF5iuGocYxV X-Received: by 2002:a17:902:8a96:: with SMTP id p22mr2593185plo.113.1553162469130; Thu, 21 Mar 2019 03:01:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553162469; cv=none; d=google.com; s=arc-20160816; b=bK1klwK8lStQTvpRnxt1bkHF4ebWuru028yceiOUYaRBF3MCIrrK/yCxE7Mpf2pR9w 27Kqlp9FSZS01sTKVWiufuUj5MNja8X03q8m3qzaHd+6jxAzyniu67fSKlAol2XxBFnr RVWUD6zVJHVzHvouI6OuAN7ZjAO88BC8iGkxv80EHMJ61PNYa5OxJiUwACet1fV5JR+c YigpMwG6+5VUdDo0CE/OdgVCgSZX5VsHqsVvRUIRrZjpKFuozbEmkOilFW5waBJzWh5V 9J0EKsKJdvfy1eUSfYIFnu2DBYf9eOLiHZvbVhuATKtWdi0EZo0AiLLAudqruKz6Ikxg K1ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=oV+nN/6TmtTzto6Wl4xvl2fcL77K2u3d1Dnvjj6uakE=; b=hfZlcAVOM+zSDkLn42thPjODicdG83pIquSBN6iaal4BA+mXyII3wXar4qmBzxhstC +2CncNmrvA0X3QFu8fM/NBR6p0FyvRPS8h9ncizKOwmlDDRMCFbbB2EjSccp582AnC9Z lYD6b0A7K8fhf6v/PZ8gTnri5LEGG7cioEmr2RHulg/zVTyjf1qwGZNL2EwEpkq8FFi7 OwMxm6ShOctDd+xi9DTZKImiPDADeewfM6XiMakimxC1dzZ8n5/9GbebatrnNcX+5e3W s3A3sMEH0KYW9AwCGxUoKLHGU+nVJ/Oa2nvU37wvz1u+k7orJsmZIlnXbSsxpbmtuh+5 GEPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=a5EjvoLN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a19si3696004pgw.244.2019.03.21.03.01.08; Thu, 21 Mar 2019 03:01:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=a5EjvoLN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728401AbfCUKBG (ORCPT + 31 others); Thu, 21 Mar 2019 06:01:06 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:51224 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728351AbfCUKBE (ORCPT ); Thu, 21 Mar 2019 06:01:04 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2LA0ndl075287; Thu, 21 Mar 2019 05:00:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1553162449; bh=oV+nN/6TmtTzto6Wl4xvl2fcL77K2u3d1Dnvjj6uakE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=a5EjvoLNQvI4XKlK+BO4qn5HkZ2wGlwUDnSN1kPj9IwONinMDaKUeattthenUb5zI 1L+lNxrK1lhiYgBlHMEYFyxmNhStz/6B+Bu5U9Hzo/2U6mOM+etfs4IPohLSbvfMHQ /Dc+42oHgqQaGASLj7VgD/Pg+woPZfRidySJTm2M= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2LA0ngj094055 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 21 Mar 2019 05:00:49 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Thu, 21 Mar 2019 05:00:48 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1713.5 via Frontend Transport; Thu, 21 Mar 2019 05:00:48 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id x2LA0KOE014903; Thu, 21 Mar 2019 05:00:46 -0500 From: Kishon Vijay Abraham I To: Murali Karicheri , Lorenzo Pieralisi , Bjorn Helgaas , Gustavo Pimentel , Marc Zyngier CC: Kishon Vijay Abraham I , Jingoo Han , , , Subject: [PATCH v5 8/8] PCI: dwc: Do not write to MSI control registers if the platform doesn't use it Date: Thu, 21 Mar 2019 15:29:27 +0530 Message-ID: <20190321095927.7058-9-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190321095927.7058-1-kishon@ti.com> References: <20190321095927.7058-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Platforms which populate msi_host_init, has it's own MSI controller logic. Writing to MSI control registers on platforms which doesn't use Designware's MSI controller logic might have side effects. To be safe, do not write to MSI control registers if the platform uses it's own MSI controller logic instead of Designware's MSI controller logic. Signed-off-by: Kishon Vijay Abraham I --- .../pci/controller/dwc/pcie-designware-host.c | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) -- 2.17.1 diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 498422397609..7e0ff7d428a9 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -626,17 +626,19 @@ void dw_pcie_setup_rc(struct pcie_port *pp) dw_pcie_setup(pci); - num_ctrls = pp->num_vectors / MAX_MSI_IRQS_PER_CTRL; - - /* Initialize IRQ Status array */ - for (ctrl = 0; ctrl < num_ctrls; ctrl++) { - pp->irq_mask[ctrl] = ~0; - dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_MASK + - (ctrl * MSI_REG_CTRL_BLOCK_SIZE), - 4, pp->irq_mask[ctrl]); - dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE + - (ctrl * MSI_REG_CTRL_BLOCK_SIZE), - 4, ~0); + if (!pp->ops->msi_host_init) { + num_ctrls = pp->num_vectors / MAX_MSI_IRQS_PER_CTRL; + + /* Initialize IRQ Status array */ + for (ctrl = 0; ctrl < num_ctrls; ctrl++) { + pp->irq_mask[ctrl] = ~0; + dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_MASK + + (ctrl * MSI_REG_CTRL_BLOCK_SIZE), + 4, pp->irq_mask[ctrl]); + dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE + + (ctrl * MSI_REG_CTRL_BLOCK_SIZE), + 4, ~0); + } } /* Setup RC BARs */