Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5984972pxb; Mon, 14 Feb 2022 12:22:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJyrOnBCp6Fg046Jvmn/80yTX0UZ+ATG0B3jXUKdDVtXB/vwPyKcWjwbBW673Eot8nSg3P41 X-Received: by 2002:a17:902:724a:: with SMTP id c10mr546293pll.88.1644870159586; Mon, 14 Feb 2022 12:22:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644870159; cv=none; d=google.com; s=arc-20160816; b=W3FDUx+FGJAQ6BSrPa/OtryQp7WFDTtYlru8B8VDXGKSvF+WMUKTKzIHQUYm7wNh36 OIuFYjAgYnMg4PnGEnXBcVixBJP8CkbcOXk64oVsVj04WjhhUwezGR2TwKDVDLqqiCNy gO36dVadpMxt99zffTTHrFlmk9w3kwNARAqK5+2x6DNUIiHd2lWrVAkgjPuINLVxLUo+ 8gyuUI1Wj7Q+OB1/tbhMrA/NBFqQXrzUWVFNnAQFsiyOprhTDRCrH7EKoiUdMoQg9afl qwW4kcxHu4fj4rbBl9Yh8Tci4eKJbu1rZPy0mdBa0FR4nmDDxvxxFoBxh7DZSHDBixQZ QuSQ== 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=R7RIPkoPXSc/1DOOCvF54E3h+/ulhxVaCt4ultQGvSU=; b=K18W8+4HiwDbDau3HPOq/vPISuDev+lojTw05v1lNZqdhVrTfjuwol77yXyFErt/Ne 4LB6oYnltXgIdmTWkzWgZL3xpHk/trNRMTgjrGMo6oSdZp9sLy5RMEb/NX7C55nEZqPR l1ux7I2lOuf+KQLTY7N12AuYBf0VN83WhWYkRAJN/hr18rUZCheEkE5id6ilN5djGU+4 K7uNN5EeOjHZp9KvXSwcaNNzxC6SQlKsIMcmHTqI1zW/MCl0j6KO7QAYfLymwy4niRlM EqQLJNdFQ6U3qcnTKPk/KF+6uMF3tZLY8xxyKK6+09jhIJbYtrBmyKEZrObOUmJfvmJN 1nhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i52xX8wx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g2si653525pgc.274.2022.02.14.12.22.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 12:22:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i52xX8wx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 70A2017E35C; Mon, 14 Feb 2022 11:55:58 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344012AbiBNJv3 (ORCPT + 99 others); Mon, 14 Feb 2022 04:51:29 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245087AbiBNJrO (ORCPT ); Mon, 14 Feb 2022 04:47:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90A2DB842; Mon, 14 Feb 2022 01:40:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 77A57B80DC1; Mon, 14 Feb 2022 09:40:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A83BC340E9; Mon, 14 Feb 2022 09:40:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644831637; bh=x5AWoXV08VpQQH7H9YVUxPssIa5vUJ4VmWGDeo3vn1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i52xX8wxWpvDPTCo63QdobDOKt/se5LVM13ESpwB4K/XsaSZ7FMwkNVxFPGuc2DSK 2MNBRL5OFrEVic3p2BnGza+VPL/f2DMgFab8jsTO2pgxr6mWUSxmXkvaIdRgOevubb Up+Bc3X9zpZhjy6vts92cM0OKmkowOvH2kDVt8As= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Petlan , Robin Murphy , Lorenzo Pieralisi , Catalin Marinas Subject: [PATCH 5.10 047/116] ACPI/IORT: Check node revision for PMCG resources Date: Mon, 14 Feb 2022 10:25:46 +0100 Message-Id: <20220214092500.328287354@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092458.668376521@linuxfoundation.org> References: <20220214092458.668376521@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Robin Murphy commit da5fb9e1ad3fbf632dce735f1bdad257ca528499 upstream. 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") Cc: # 5.2.x Signed-off-by: Robin Murphy Acked-by: Lorenzo Pieralisi Link: https://lore.kernel.org/r/75628ae41c257fb73588f7bf1c4459160e04be2b.1643916258.git.robin.murphy@arm.com Signed-off-by: Catalin Marinas Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/arm64/iort.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -1454,9 +1454,17 @@ static void __init arm_smmu_v3_pmcg_init 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",