From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 038A5C433EF for ; Tue, 8 Feb 2022 11:11:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TiG7WTHcTgmkSiE1+ag3xa7vsLhJ1+XVMPBh50KwnlQ=; b=HxoMTyPzDbCO6C hXEclqzfFKaTMryVxRwq1xPddYXZu+FLtO5yumyMSs8VRE8CS6KAdXXgMe9JGuEBMI/N/LlF0QBc6 KJ8EhUZnYQgSM/vTvDx60rC8aspCdHGblMxuu/v69J8qQ5si1beavOKDoCCVZPfw7RaawSBhLtCU0 Pb4j6ggXwuj5kB1N3mUtlO633vOavOZcVh35vyI98jfzZ7FVsGUm6ZHrRhkuPQO2HXe5QFIWVxRi7 DxGXWj3LdznYUKTEYW0coplQ3JzRQ2NCUlqKppQBHgWm7jQVY7E1sY3+2+sHwUpXc6McxvjNJyhLs t876gXs8x5k05VMV+JIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nHOOM-00DWQZ-4T; Tue, 08 Feb 2022 11:10:38 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nHOOI-00DWPJ-SM for linux-arm-kernel@lists.infradead.org; Tue, 08 Feb 2022 11:10:36 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9E68011D4; Tue, 8 Feb 2022 03:10:33 -0800 (PST) Received: from lpieralisi (e121166-lin.cambridge.arm.com [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 800FC3F73B; Tue, 8 Feb 2022 03:10:32 -0800 (PST) Date: Tue, 8 Feb 2022 11:10:26 +0000 From: Lorenzo Pieralisi To: Robin Murphy , will@kernel.org, catalin.marinas@arm.com Cc: guohanjun@huawei.com, sudeep.holla@arm.com, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michael Petlan Subject: Re: [PATCH v2] ACPI/IORT: Check node revision for PMCG resources Message-ID: <20220208111026.GA6233@lpieralisi> References: <75628ae41c257fb73588f7bf1c4459160e04be2b.1643916258.git.robin.murphy@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <75628ae41c257fb73588f7bf1c4459160e04be2b.1643916258.git.robin.murphy@arm.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220208_031034_981726_4B479EBD X-CRM114-Status: GOOD ( 26.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Feb 03, 2022 at 07:31:24PM +0000, Robin Murphy wrote: > The original version of the IORT PMCG definition had an oversight > wherein there was no way to describe the second register page for an > implementation using the recommended RELOC_CTRS feature. Although the > spec was fixed, and the final patches merged to ACPICA and Linux written > against the new version, it seems that some old firmware based on the > original revision has survived and turned up in the wild. > > Add a check for the original PMCG definition, and avoid filling in the > second memory resource with nonsense if so. Otherwise it is likely that > something horrible will happen when the PMCG driver attempts to probe. > > Reported-by: Michael Petlan > Fixes: 24e516049360 ("ACPI/IORT: Add support for PMCG") > Signed-off-by: Robin Murphy > --- > > v2: Simpler workaround, since I realised platform_get_resource() > should happily just skip over a zero-initialised hole in the > resource array. > > drivers/acpi/arm64/iort.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) Acked-by: Lorenzo Pieralisi Should we send it to stable kernels ? I'd kindly ask Catalin/Will to pick it up please. Thanks, Lorenzo > > diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c > index 175397913be1..7092b94b2aae 100644 > --- a/drivers/acpi/arm64/iort.c > +++ b/drivers/acpi/arm64/iort.c > @@ -1371,9 +1371,17 @@ static void __init arm_smmu_v3_pmcg_init_resources(struct resource *res, > res[0].start = pmcg->page0_base_address; > res[0].end = pmcg->page0_base_address + SZ_4K - 1; > res[0].flags = IORESOURCE_MEM; > - res[1].start = pmcg->page1_base_address; > - res[1].end = pmcg->page1_base_address + SZ_4K - 1; > - res[1].flags = IORESOURCE_MEM; > + /* > + * The initial version in DEN0049C lacked a way to describe register > + * page 1, which makes it broken for most PMCG implementations; in > + * that case, just let the driver fail gracefully if it expects to > + * find a second memory resource. > + */ > + if (node->revision > 0) { > + res[1].start = pmcg->page1_base_address; > + res[1].end = pmcg->page1_base_address + SZ_4K - 1; > + res[1].flags = IORESOURCE_MEM; > + } > > if (pmcg->overflow_gsiv) > acpi_iort_register_irq(pmcg->overflow_gsiv, "overflow", > -- > 2.28.0.dirty > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel