Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp445351pxb; Thu, 9 Sep 2021 04:46:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeRHEEB3WHVcKdG3CyE0SqtGA4Oi553azPEB3eKrgacY+qokVYU1j8GfFy/1qqheEjIDCC X-Received: by 2002:a17:906:3809:: with SMTP id v9mr2970783ejc.355.1631187976801; Thu, 09 Sep 2021 04:46:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631187976; cv=none; d=google.com; s=arc-20160816; b=QJ1ZEnfHZIhr9kx9O/dWqHxwZ/bgLOMcKvFZTL+uOls2fH498AXPo46CJcJihWfl4+ bblh1hnbkCUPv788Z6AJUe0GVL2pzwS85htWyAGSPKtjLNieomidvqPVZVoOeqtxcqgM cLrVlXtdqkXyXN8Iki6+MPSPnUmXgz9ufaKYTo0a5k8td2+YaL629krX/nA6ziFPgH8u vbg9yCGOCqo5Cv+mrMX2TRoYOOW8fh9NrPSMZEjpy3nQThuYE6ehCI25LC+XRWJVCpBM y+rNMA+WXBuiP1t3O76S1DVnLn9ywHMcUoxkEFTuKPpon599oDZWOvsy0PUIOl9wU+3u UeXA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9uTlXVpzDLL12FQkJhkpMJLHlMCnqiXfy+RjCQ5eafk=; b=OHVdUHg41N/O5CaRdDUWMArDgM2gXRZyJKacHVaIoDL2acMQK9RGSlaAQJ1cI82hr0 gr5eBi2PeJ3T2wG8dyVy2J1aKPDIKiVqImuoCfTjyHsv+n66MFwGR3ZOICevJLLLhHYU OgU2zAWxWR1gcFmX1mUlQk7uWUKvkuimpysHV1df1J6FupTcWX/9C/ed2W4ycrHRWwb/ aEimk7QCK+EmaU6ZsgOGHbCOS7yey4kbvZP3foZkRIUOsru4ED3/EDK7KwKORynYIo4e K1iFFxijXO2gefhQTMeboiyJVOdfg3cLRO0+t2EU78AM+TMQXoHAzo0K0DAqvdo1qWqq L1NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=n0woNcqe; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h5si1602075ede.570.2021.09.09.04.45.52; Thu, 09 Sep 2021 04:46:16 -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=@kernel.org header.s=k20201202 header.b=n0woNcqe; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237548AbhIILpf (ORCPT + 99 others); Thu, 9 Sep 2021 07:45:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:46060 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238358AbhIILnc (ORCPT ); Thu, 9 Sep 2021 07:43:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8BAF761241; Thu, 9 Sep 2021 11:42:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187729; bh=Xd7MZANyqt8Ww7NcsQ0jrgVGIB/rsdRloUtv60kMlBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n0woNcqeWDAGiVq+TanhhGXERozfl3NXG+vatYaPH9aq9pxmBA2oQmE04+ovLweUb DFrs55RUekfN7ZPqGo3VfchNW3OXjsQ+gyTbofvV94It1DyML1+vJcQdeNRw73a0hZ Cvmnz2XMfN4BOrOvSVFBsCAhy9kbjC4ylWWoTkQlfMZ2wA1LJ60y8N6OSuo+UVwKD3 l56XHjL7m/08RqHB8fhTuucSDHYqHKqvfOCaP7DdHqGUv89Mz7rfUM3ZJzcBGr1UFK 0JbvIi2TZxH0GRcvjcS+rRdi8WuVRa9H0yV5HvVahIJa6iLt6tg1/3D1KOI6PttSgb khMJv3S+iLdWQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Laurentiu Tudor , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH AUTOSEL 5.14 049/252] bus: fsl-mc: fix mmio base address for child DPRCs Date: Thu, 9 Sep 2021 07:37:43 -0400 Message-Id: <20210909114106.141462-49-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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