Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1950653pxb; Thu, 16 Sep 2021 21:18:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvlxpc5S1bNJYvZQ55B41SR08LHWv0ALshAfdWHG3hLzQjajCLEEANtNdBSBHfJhD9Yb7r X-Received: by 2002:a05:6638:2493:: with SMTP id x19mr7107646jat.57.1631852315205; Thu, 16 Sep 2021 21:18:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631852315; cv=none; d=google.com; s=arc-20160816; b=n0w/Tn2g7uEHBescEPstq+ecIcnMKm4SxfzwZG8kn51U/xEqh7NIsE1skOq99HwB8N DbLKnE0m7hwHcKELmpzwLydZva/L0Lt4oIrzDwMC1Tw9gseKY4luBwQRd1ofRw34nRNT +b4S6oziCsLRf/lXhT86qzj942PAsVjG1jGhXxyPO3tVTznS2IDNR7SIvZcuveNuTeBk dws/sRq9120Yr/rGcAr0yrT/w8sDlRMJjtlYY0TzPjcS9tJj1NAMO2R/abokIW/UCdBY 16zi47mzPrqtRSTqikGYCev6DiGQYBEQCPvJnyZS1666JMFvSxupL6ClffqLXATihbbQ 95uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9uTlXVpzDLL12FQkJhkpMJLHlMCnqiXfy+RjCQ5eafk=; b=QB78sU8GxshE5jofgKdxZbOH8I4AlD3Nk+hZhC+CP5B5Exz+9J9nYy4G6eeH1C0eCQ tLFr34+MY6cJnoHDWOGhCp1f/q3ANZWkKKNPBA/KXc4B6WDkHrVEvCRAN8PeD1QvY8C0 1D90ZEWJmdiNFniM1TvYylXmqZQWoES2dTZi/FvHD+g5dhiPo/it0eRHatEgKYKqCUVX yYVUhN542llcvctzh2Ni68D+9IljPLoaFVZuxWyBwriirBZXOF3nUtNC9jbLSgLYvaOp k4mbs9FBVh8gJyhlHhfdV8+Y2sRyCyBoIC+TV7CchbXCFRbvwbbyPTcB2yvP4G0TbLNC 593Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aLZZi+vh; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g8si4526837ioq.76.2021.09.16.21.18.23; Thu, 16 Sep 2021 21:18:35 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=aLZZi+vh; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343838AbhIPRfm (ORCPT + 99 others); Thu, 16 Sep 2021 13:35:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:47062 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351070AbhIPR0k (ORCPT ); Thu, 16 Sep 2021 13:26:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 583BC61C45; Thu, 16 Sep 2021 16:44:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631810697; bh=Xd7MZANyqt8Ww7NcsQ0jrgVGIB/rsdRloUtv60kMlBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aLZZi+vhGeg5wMmIyxO/eizElzkfCqBCoePnvz7z4HVOyFC+ulFWRp6AWbkhBJXJd 4TxQe6mfmIBT1hi2WhRzRcBIjH2xCNHqvilGzD0i892nQPJA8XtcRtx0aQiDzGwrvh PiEHTSVzso7kfp9iuGBqtAdzQaybe1xZM8GpGxhY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurentiu Tudor , Sasha Levin Subject: [PATCH 5.14 203/432] bus: fsl-mc: fix mmio base address for child DPRCs Date: Thu, 16 Sep 2021 17:59:12 +0200 Message-Id: <20210916155817.692298793@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155810.813340753@linuxfoundation.org> References: <20210916155810.813340753@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Laurentiu Tudor [ Upstream commit 8990f96a012f42543005b07d9e482694192e9309 ] Some versions of the MC firmware wrongly report 0 for register base address of the DPMCP associated with child DPRC objects thus rendering them unusable. This is particularly troublesome in ACPI boot scenarios where the legacy way of extracting this base address from the device tree does not apply. Given that DPMCPs share the same base address, workaround this by using the base address extracted from the root DPRC container. Signed-off-by: Laurentiu Tudor Link: https://lore.kernel.org/r/20210715140718.8513-8-laurentiu.tudor@nxp.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/bus/fsl-mc/fsl-mc-bus.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c index ffec838450f3..32b2b6d9bde0 100644 --- a/drivers/bus/fsl-mc/fsl-mc-bus.c +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c @@ -68,6 +68,8 @@ struct fsl_mc_addr_translation_range { #define MC_FAPR_PL BIT(18) #define MC_FAPR_BMT BIT(17) +static phys_addr_t mc_portal_base_phys_addr; + /** * fsl_mc_bus_match - device to driver matching callback * @dev: the fsl-mc device to match against @@ -703,14 +705,30 @@ static int fsl_mc_device_get_mmio_regions(struct fsl_mc_device *mc_dev, * If base address is in the region_desc use it otherwise * revert to old mechanism */ - if (region_desc.base_address) + if (region_desc.base_address) { regions[i].start = region_desc.base_address + region_desc.base_offset; - else + } else { error = translate_mc_addr(mc_dev, mc_region_type, region_desc.base_offset, ®ions[i].start); + /* + * Some versions of the MC firmware wrongly report + * 0 for register base address of the DPMCP associated + * with child DPRC objects thus rendering them unusable. + * This is particularly troublesome in ACPI boot + * scenarios where the legacy way of extracting this + * base address from the device tree does not apply. + * Given that DPMCPs share the same base address, + * workaround this by using the base address extracted + * from the root DPRC container. + */ + if (is_fsl_mc_bus_dprc(mc_dev) && + regions[i].start == region_desc.base_offset) + regions[i].start += mc_portal_base_phys_addr; + } + if (error < 0) { dev_err(parent_dev, "Invalid MC offset: %#x (for %s.%d\'s region %d)\n", @@ -1126,6 +1144,8 @@ static int fsl_mc_bus_probe(struct platform_device *pdev) plat_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); mc_portal_phys_addr = plat_res->start; mc_portal_size = resource_size(plat_res); + mc_portal_base_phys_addr = mc_portal_phys_addr & ~0x3ffffff; + error = fsl_create_mc_io(&pdev->dev, mc_portal_phys_addr, mc_portal_size, NULL, FSL_MC_IO_ATOMIC_CONTEXT_PORTAL, &mc_io); -- 2.30.2