Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1715735pxb; Thu, 16 Sep 2021 13:47:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2qAaYl/JcpPigLs5qKDy1sgFdurkOn++4Etyg5oNH6BUUsgqjlUAIDnqoC1qhXvarlrvT X-Received: by 2002:aa7:c150:: with SMTP id r16mr8403948edp.388.1631825262039; Thu, 16 Sep 2021 13:47:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631825262; cv=none; d=google.com; s=arc-20160816; b=ztezYvB6EVexes2j/BPCpxoayQfolKodXpWpYJhBm1gHeg16ZswfQnW7LReobbpppP /k/ViiYPQ9oGLsLTiiiPp/N0i6YcfZn//ozTXuPq5EZCzQpHOUDb7Jk7sKh81UB4T4E4 BkN8GdMUUuq3DKByrfT2HFdg1lmHZ6Hyml+ZHSkM55NpHzuY9fm1UB4avAI6A1NCcXgS y/KS+W5aZPtRNgFT0PCILBwq57wp06K8vCwL8R+tc5VjegDOWIlqAD55mI5bh7+D/SxB GLpON+SHouofWExs3VSEIktjLJldRcbatrZmQJjl+cn46/hl7O3p2jHBPQLhgY8pGCOs B5cA== 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=Ubayu0pkKj8RLdFAvoon5aR5TWC41CnnDZ+YIbaPcKg=; b=eksMNBq19xyhU+uxhHiHV/dS4qM/nEghIcShAyaQF0NXVyGy4+Eyzx7Wve/4tib0/A 5rK8/kIT1T6H/fIBgwBB4VonEs81spc2VvFUchpBL7L/rTwRodNaNtRj4AJUzLT0Y9YD zmN7faGlcEweWy/Igw0SWPKSMeEL+1MsWgFXPg+JftyEqTJEqSvrKWIiro+ifoDpruPl QYl50AvHdR2a7D1uvlYXpF2FwLQY2uJFqAsrq7Vd4Q3AKtiv8JMkzbgoTsHmj/9FBg+m tzxU6rZejuHmh1BfYf4PJBOYHB7KpstiQVylxGFeYBpfTVhBdQecGekZS1/h4T55DIPT BEtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EvKRhd3a; 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 v1si4717093ejk.111.2021.09.16.13.47.17; Thu, 16 Sep 2021 13:47:42 -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=EvKRhd3a; 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 S242750AbhIPQ3b (ORCPT + 99 others); Thu, 16 Sep 2021 12:29:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:54972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241186AbhIPQPT (ORCPT ); Thu, 16 Sep 2021 12:15:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 95210613C8; Thu, 16 Sep 2021 16:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808678; bh=CprO/CsqZviOI+h8Tjvfuxh1ImMiZiWVKrMB/8yCSUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EvKRhd3aU5Iz0iZlD3olrf+v50X/MmzVY1edDoSFOJUYb+C69K2UDz/CT8i94Fy1M PfB+ZtJKnUPwauLgDfOK9JUMKJRzeqcnvdEq/L0iqUAAQM3dvXkAZ58JS6YmGVtU9q BCBZ4ymW2OP17G3Kly5W/b6R6qP73utmnnxTb5nE= 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.10 139/306] bus: fsl-mc: fix mmio base address for child DPRCs Date: Thu, 16 Sep 2021 17:58:04 +0200 Message-Id: <20210916155758.780448513@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@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 806766b1b45f..e329cdd7156c 100644 --- a/drivers/bus/fsl-mc/fsl-mc-bus.c +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c @@ -64,6 +64,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 @@ -597,14 +599,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", @@ -996,6 +1014,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