Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp177652imd; Wed, 31 Oct 2018 16:53:07 -0700 (PDT) X-Google-Smtp-Source: AJdET5eFLPJuomaYKIpPLonvQinPay6RbZ61SqDIKc7qbO1x9MOd1b7VTdthpHopxH4824LjDhZJ X-Received: by 2002:a17:902:8a8c:: with SMTP id p12-v6mr5325569plo.133.1541029986941; Wed, 31 Oct 2018 16:53:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029986; cv=none; d=google.com; s=arc-20160816; b=wIIi1O4+3HkD5kJLizJ86V+Nqtdz2bOMIvpZxADbKcf5FtcY47o5rgx9K7k3kSMK0S GvxynVRTWlxOA0iyxCuLYK096rgJy2yT+dogj4BRX2ytOvUSxUxf0w+ceHD6fv4jjl1V MYE56cKF2Y0KyFE6CbUOnT6AhkHBeUP0Vp6eGe+M1yniHpTr8cLphNqFARDJOEV7mNlK 4Sljnh0QTKdkqSaMeF4qrJcBpY6klntstCefiKBK1hxIfwwTaf0OjbMcRJo9IRbb5has UzNA3ZsRfV58DP05clGEiBEn0cODsh0PUdzdiWRLC1vZO3grv7tTKOh0+CexzSjFTpFM bUGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=PoNHvZZOt3YX9CTWUT40sbBhwVpobdIALawwg4DAGYc=; b=TAXb/TxxMHa3Zg7MvGvRuCSSJqMktcEPfzybJXm+KXLxO5mMlU54YkMv2pwg/ZZnE3 0DOdISgEA9cTsoZP4qsai7+kDBzrJVu3+CMKEHMFkybhk4OcCeRZHxsV8gFvamPFz3P0 u3YETMEiOpCJ8m+UjNAKLtWS7aA+tcXwujHHy037QzEcj5o9ePI9mpSlcAr3UCGxwNxu v4f0kZ6DDm0s4EXxzru84NN403T9zWG4qFNWGDTgUzEylORN6zHgiAzPHYBy04LlwTAZ 6hlKnAgKRUAvhhsRDXrrcdWsy6UmUBg378zleEWJBN6dY3FfbYMxXRWFolLLx3cR9/Gr LhmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cjHh5zDi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id a10-v6si17061960pfi.222.2018.10.31.16.52.51; Wed, 31 Oct 2018 16:53:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cjHh5zDi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727848AbeKAIGY (ORCPT + 99 others); Thu, 1 Nov 2018 04:06:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:53124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727809AbeKAIGX (ORCPT ); Thu, 1 Nov 2018 04:06:23 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0094520838; Wed, 31 Oct 2018 23:06:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027172; bh=m0eYymLvQVdqV99aj3t6WUzgHN/QGirqZSA4T+l0rLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cjHh5zDiwcm+GU8WffNJOrmGzSFo+9WGgKK+HQrcRBLAEeJql0DYooXdGWUBQ8aXu wZ9tyvGdYG0gXA8qI6YmP4p9oFrkGTSR83zLPaDXxlQgYVWhEWOvdZqx557HTwJ3ua v6Gq8rgu9ZKRex5vPfiEI2eusaAt3nWPN3auFGGQ= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jeffrey Hugo , "Rafael J . Wysocki" , Sasha Levin Subject: [PATCH AUTOSEL 4.19 033/146] ACPI/PPTT: Handle architecturally unknown cache types Date: Wed, 31 Oct 2018 19:03:48 -0400 Message-Id: <20181031230541.28822-33-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jeffrey Hugo [ Upstream commit 59bbff3775c0951300f7b41345a54b999438f8d0 ] The type of a cache might not be specified by architectural mechanisms (ie system registers), but its type might be specified in the PPTT. In this case, we should populate the type of the cache, rather than leave it undefined. This fixes the issue where the cacheinfo driver will not populate sysfs for such caches, resulting in the information missing from utilities like lstopo and lscpu, thus degrading the user experience. Fixes: 2bd00bcd73e5 (ACPI/PPTT: Add Processor Properties Topology Table parsing) Reported-by: Vijaya Kumar K Signed-off-by: Jeffrey Hugo Reviewed-by: Sudeep Holla Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/pptt.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c index d1e26cb599bf..da031b1df6f5 100644 --- a/drivers/acpi/pptt.c +++ b/drivers/acpi/pptt.c @@ -338,9 +338,6 @@ static struct acpi_pptt_cache *acpi_find_cache_node(struct acpi_table_header *ta return found; } -/* total number of attributes checked by the properties code */ -#define PPTT_CHECKED_ATTRIBUTES 4 - /** * update_cache_properties() - Update cacheinfo for the given processor * @this_leaf: Kernel cache info structure being updated @@ -357,25 +354,15 @@ static void update_cache_properties(struct cacheinfo *this_leaf, struct acpi_pptt_cache *found_cache, struct acpi_pptt_processor *cpu_node) { - int valid_flags = 0; - this_leaf->fw_token = cpu_node; - if (found_cache->flags & ACPI_PPTT_SIZE_PROPERTY_VALID) { + if (found_cache->flags & ACPI_PPTT_SIZE_PROPERTY_VALID) this_leaf->size = found_cache->size; - valid_flags++; - } - if (found_cache->flags & ACPI_PPTT_LINE_SIZE_VALID) { + if (found_cache->flags & ACPI_PPTT_LINE_SIZE_VALID) this_leaf->coherency_line_size = found_cache->line_size; - valid_flags++; - } - if (found_cache->flags & ACPI_PPTT_NUMBER_OF_SETS_VALID) { + if (found_cache->flags & ACPI_PPTT_NUMBER_OF_SETS_VALID) this_leaf->number_of_sets = found_cache->number_of_sets; - valid_flags++; - } - if (found_cache->flags & ACPI_PPTT_ASSOCIATIVITY_VALID) { + if (found_cache->flags & ACPI_PPTT_ASSOCIATIVITY_VALID) this_leaf->ways_of_associativity = found_cache->associativity; - valid_flags++; - } if (found_cache->flags & ACPI_PPTT_WRITE_POLICY_VALID) { switch (found_cache->attributes & ACPI_PPTT_MASK_WRITE_POLICY) { case ACPI_PPTT_CACHE_POLICY_WT: @@ -402,11 +389,17 @@ static void update_cache_properties(struct cacheinfo *this_leaf, } } /* - * If the above flags are valid, and the cache type is NOCACHE - * update the cache type as well. + * If cache type is NOCACHE, then the cache hasn't been specified + * via other mechanisms. Update the type if a cache type has been + * provided. + * + * Note, we assume such caches are unified based on conventional system + * design and known examples. Significant work is required elsewhere to + * fully support data/instruction only type caches which are only + * specified in PPTT. */ if (this_leaf->type == CACHE_TYPE_NOCACHE && - valid_flags == PPTT_CHECKED_ATTRIBUTES) + found_cache->flags & ACPI_PPTT_CACHE_TYPE_VALID) this_leaf->type = CACHE_TYPE_UNIFIED; } -- 2.17.1