Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3489344imu; Sun, 11 Nov 2018 16:15:26 -0800 (PST) X-Google-Smtp-Source: AJdET5cWLkLFaGzIEsVc/jDGybplfstM+3Y2iX29zFSu1tcH3i5cZp9cQLFRx/7Z4upBIZCINITL X-Received: by 2002:a17:902:3064:: with SMTP id u91-v6mr17794659plb.164.1541981726143; Sun, 11 Nov 2018 16:15:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981726; cv=none; d=google.com; s=arc-20160816; b=gD5RE8lTmw7l+a0LMZK577WVo4U1OiWbTM4XRkYYeGaIyEuIAIznjx7BM7kv2yWJfd jDkd5gauEREkdvfwR0s2RGIPruNtCjLLAnOpgfy5jnTmpYPlnfnJOTofnayLgpd5jjPy Onct0GkWK2SS17hFIbxZRZ8Kb2Cd3+CiNWvJj0Y/MGiXnyI4CMU1IUf0YaPNLC66pLfE tUG96cAakWqj+/vA73ptoM9F2PuQ+TiXrixIftxAxiJz3ZHTZLniXcONfuYWVSGVfRW6 KjR4OKd0Gj3LhU27gBlKpv/LN3LI2+D6RiCs0zGKECgiydl76TeKcKppSkYmN6Djgq0X XLJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nGDT1laAkuJmbpvgD1x3LsJBW1mNkWltZYDG4gU0iX0=; b=xhHunEyRmkUTpC8uwTEdQmC/SbBGK44oBYJ6W7CTk+aXyGgCZvislKa/YXfxZq1hTJ xXBBxY8Z/Z8RU6yErGXa67gL/p8VZtXPHxeRIvNy6sHN46TikAjY6s5RID9NB9fQNhCa nKEFBDSTwfcq62vHlMY2QOzHCQpaUBncrxaICDnJef8tkZD00s7hZSKF0j6HSUOsoYnx BRVKm8r4YwLaY0Z8W5bwSLCDxMol0FB8O63qD9OXVc+Qn4R2jX9+ZwwKmu4aEVBshQRy dwlLpcw+6ieN/0Tb0vH7J9T/AwS14m+pHzgIsN6m/dMI45k54vuaqO6b6VMX1GvxLfjj kINQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CwHdJlk+; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11-v6si13525653pgs.179.2018.11.11.16.15.11; Sun, 11 Nov 2018 16:15:26 -0800 (PST) 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=CwHdJlk+; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731472AbeKLKEH (ORCPT + 99 others); Mon, 12 Nov 2018 05:04:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:60278 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730430AbeKLIRP (ORCPT ); Mon, 12 Nov 2018 03:17:15 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E25E4208A3; Sun, 11 Nov 2018 22:27:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975238; bh=3lpF9rYrDb2PCUuFszCuUwnu5YUAMVEZpareZSVjUlc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CwHdJlk+y3iD8A4UdAjcm3C7mv1ZxrTc9jd42t0Yxw7EbAUMH6lBtDc5OID5shYWm W+k+hvKluW6SrjoTRTY7j2wmQTU23sZXPf7hHCfeYH+RZNyKFWhzv4jMqq2Q7SrPyJ HWqucIkKlk4uQT2+T4eEG587xEkAhhwthtbCzB3E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vijaya Kumar K , Jeffrey Hugo , Sudeep Holla , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.19 079/361] ACPI/PPTT: Handle architecturally unknown cache types Date: Sun, 11 Nov 2018 14:17:06 -0800 Message-Id: <20181111221631.009539705@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/pptt.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) --- a/drivers/acpi/pptt.c +++ b/drivers/acpi/pptt.c @@ -338,9 +338,6 @@ static struct acpi_pptt_cache *acpi_find 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(stru 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(stru } } /* - * 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; }