From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B949E2BD58C for ; Fri, 15 Aug 2025 09:34:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755250445; cv=none; b=W0S2H5vEZ+IA9Nj9WlpbIyFicFJy6WOHBXJWwDgbl+dZoU73o4P0VXDxSVwDhCFzzEonPwPeo+IpJ7yys5KlQzroyo66ehB9sITEuvzyNtQ5JRhEAf3tKUN4n1RketZkHsKqSntg0MNBvfcvpVam53UNMNQXyuSwjxuBmHeXwRg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755250445; c=relaxed/simple; bh=Iv1DhKhLYSeCpbZFMYrOoWuI69gptIKRqiIGuvTTGgk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=QmEekIyBOviezxqjUesk1eDx1A31GMS1iAb1rTR+45rUI7hRyD/AuenAHKZ2GPv7exgVvGkZL5+tYfexfWGM6zN+IPCFNLCroP0lR1i6N1jZ24OQ33jhBDSvpCvQAAT7haSFdtaPhWeRK9HoInKI0e/5yvihU9MwWvvLs6cgL7M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 E49631655; Fri, 15 Aug 2025 02:33:54 -0700 (PDT) Received: from [10.1.196.46] (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C071A3F63F; Fri, 15 Aug 2025 02:33:58 -0700 (PDT) Message-ID: Date: Fri, 15 Aug 2025 10:33:57 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 10/36] ACPI / MPAM: Parse the MPAM table To: James Morse , 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-US From: Ben Horgan In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi James, On 8/5/25 18:07, James Morse wrote: > 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; > --------------------%<-------------------- This seems fine as long as any later table revisions are guaranteed to be backwards compatible. > > 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 Thanks, Ben