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 87DE4C87FD1 for ; Tue, 5 Aug 2025 18:44:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HavVrNFsvG4Vwyla3KaasVFCAutqAcX9mESZ2FKjwDM=; b=CJ1SwRIYEk+000/ZuWHBRFVrvx YfPF3u43jTuFZjx+F8aNLmKnKSVWS8NxLDUkOTohRz/Mn6BeMvIMyNFNbtp4i/Ujbv9+4WNoMCHsx uvSoPWoODmPlqkTf9nJhe60m/SiDvYdRByekRbOF9GxRBG0DuJ4SvDCnNpZ9erDd+I3j5mxJx7aMk /7SkCiE0x/JIDanApACEYCfYOuq2ZFHnpR5EqpciA7dDzXF2js84kpv8qY2GAE7iRrxcikfld2+yj h8CT4hJJFQvjruL2BbN89LK3DvMX+5UI406PWnQfHxOKHHHP88noXGUH7FlESewwrtPM7kVOeVnY7 PGIlOmzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1ujMeT-0000000Dakk-15Il; Tue, 05 Aug 2025 18:44:45 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1ujL8i-0000000DNge-1vHJ for linux-arm-kernel@lists.infradead.org; Tue, 05 Aug 2025 17:07:53 +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 97C91150C; Tue, 5 Aug 2025 10:07:43 -0700 (PDT) Received: from [10.1.197.43] (eglon.cambridge.arm.com [10.1.197.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7A5AB3F673; Tue, 5 Aug 2025 10:07:43 -0700 (PDT) Message-ID: Date: Tue, 5 Aug 2025 18:07:41 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 10/36] ACPI / MPAM: Parse the MPAM table To: Ben Horgan , Jonathan Cameron Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Rob Herring , Rohit Mathew , Shanker Donthineni , Zeng Heng , Lecopzer Chen , Carl Worth , shameerali.kolothum.thodi@huawei.com, D Scott Phillips OS , lcherian@marvell.com, bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com, baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , peternewman@google.com, dfustini@baylibre.com, amitsinght@marvell.com, David Hildenbrand , Rex Nie , Dave Martin , Koba Ko References: <20250711183648.30766-1-james.morse@arm.com> <20250711183648.30766-11-james.morse@arm.com> <20250716180725.0000452d@huawei.com> <84e52287-e46a-40c3-90b7-ab7e9f2c7431@arm.com> Content-Language: en-GB From: James Morse In-Reply-To: <84e52287-e46a-40c3-90b7-ab7e9f2c7431@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250805_100752_616789_AAA45F76 X-CRM114-Status: GOOD ( 17.68 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Ben, On 23/07/2025 17:39, Ben Horgan wrote: > On 7/16/25 18:07, Jonathan Cameron wrote: >> On Fri, 11 Jul 2025 18:36:22 +0000 >> James Morse wrote: >> >>> Add code to parse the arm64 specific MPAM table, looking up the cache >>> level from the PPTT and feeding the end result into the MPAM driver. >> >> Throw in a link to the spec perhaps?  Particularly useful to know which >> version this was written against when reviewing it. > As I comment below this code checks the table revision is 1 and so we can assume it was > written against version 2 of the spec. As of Monday, there is a new version hot off the > press, > https://developer.arm.com/documentation/den0065/3-0bet/?lang=en which introduces an "MMIO > size" field to allow for disabled nodes. This should be considered here to avoid > advertising msc that aren't present. Sure. Bit of an unfortunate race with the spec people there! Added as: --------------------%<-------------------- diff --git a/drivers/acpi/arm64/mpam.c b/drivers/acpi/arm64/mpam.c index 9ff5a6df9f1b..d8c6224a76f8 100644 --- a/drivers/acpi/arm64/mpam.c +++ b/drivers/acpi/arm64/mpam.c @@ -202,6 +202,9 @@ static int __init _parse_table(struct acpi_table_header *table) if (tbl_msc->reserved || tbl_msc->reserved1 || tbl_msc->reserved2) continue; + if (!tbl_msc->mmio_size) + continue; + if (decode_interface_type(tbl_msc, &iface)) continue; @@ -290,7 +293,7 @@ static struct acpi_table_header *get_table(void) if (ACPI_FAILURE(status)) return NULL; - if (table->revision != 1) + if (table->revision < 1) return NULL; return table; @@ -321,6 +324,9 @@ static int _count_msc(struct acpi_table_header *table) table_end = (char *)table + table->length; while (table_offset < table_end) { + if (!tbl_msc->mmio_size) + continue; + if (tbl_msc->length < sizeof(*tbl_msc)) return -EINVAL; --------------------%<-------------------- Amusingly, PCC also defines mmio_size==0 as disabled, so _count_msc() doesn't need to know what kind of thing this is. In principle they could change this as its beta, but a zero sized MSC should probably be treated as an error anyway. Thanks, James