Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp105491imu; Mon, 10 Dec 2018 17:10:41 -0800 (PST) X-Google-Smtp-Source: AFSGD/WRxMvoDueh9p3OzdLJRSjaA6iWgdupwJ7CN244E4UDTN3iYhhjDXUl/ardve/zDipslu8w X-Received: by 2002:a17:902:2aaa:: with SMTP id j39mr14501112plb.335.1544490641853; Mon, 10 Dec 2018 17:10:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544490641; cv=none; d=google.com; s=arc-20160816; b=rfqf20e5NpXW2+nQLOpob9+/fM7CQh2XB41fj9saoeqwJIU0aG3Z2U61waKMFhtHha /jBL6h4QtdF3hgXe4jLNr7XO3twIhiMdCxb7LcsnBmKSKbgr56eHcT0W7SJ+5Rpdl08q esn+2/QQIjICQacHZDvIJi6LzIVydasgzhrEwjptpgks4qrvss91CfktIzSKjSQLeD/z vFd5iK/tRv3c/DhIEEao+oJr1UQIAab8irJiby67IezxftWqUMajUm/+HlrJHnEngpxy Q/8jV/LHBnKVR3WDHjeOYdh5PsR4MIoFEqVmgGASbl4g71iVSSXFnYr6hifvhrsNkkcw aDzg== 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; bh=m/4rVg8wG3mCp4SAAm2vH40MPWwR2kKCsx+U7kq1Cys=; b=JHVMc/ZpyHM5vg/jiEj4T/uExMbAlLPv6HXrKUh1RZ6pjVzGAN/ieD7NCwWzkJ5S97 vCZvp0tpdJ6AAuLILqyvrjO9q9eYYopPjGGcFhx0MUkVAX0yq+2oODQpN2INQmcxtPzi +5yqEygXK930xNbPQsjkGE3uDY4vIGX+/nRHOLnz+1XkoBg2ZiTBmWaRQmyG0hC/2HcY OXR84GcFVzjCDvgWZnQUETi+8/iwcxIr5b6k1IG76L6IYpniJJNMUnQRpBX3iw28CxMc 8NuR40mTHCMXfnKWgNt1vTTXNSCbhaaE6vyItLr9EkXpQVfwaLK2Qijh8zEQVY1k6tth ClBA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f23si9853934pgv.431.2018.12.10.17.10.27; Mon, 10 Dec 2018 17:10:41 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729801AbeLKBGU (ORCPT + 99 others); Mon, 10 Dec 2018 20:06:20 -0500 Received: from mga02.intel.com ([134.134.136.20]:24704 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729605AbeLKBFz (ORCPT ); Mon, 10 Dec 2018 20:05:55 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Dec 2018 17:05:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,340,1539673200"; d="scan'208";a="117705216" Received: from unknown (HELO localhost.lm.intel.com) ([10.232.112.69]) by orsmga001.jf.intel.com with ESMTP; 10 Dec 2018 17:05:53 -0800 From: Keith Busch To: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-mm@kvack.org Cc: Greg Kroah-Hartman , Rafael Wysocki , Dave Hansen , Dan Williams , Keith Busch Subject: [PATCHv2 11/12] acpi/hmat: Register memory side cache attributes Date: Mon, 10 Dec 2018 18:03:09 -0700 Message-Id: <20181211010310.8551-12-keith.busch@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20181211010310.8551-1-keith.busch@intel.com> References: <20181211010310.8551-1-keith.busch@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Register memory side cache attributes with the memory's node if HMAT provides the side cache information table. Signed-off-by: Keith Busch --- drivers/acpi/hmat.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/acpi/hmat.c b/drivers/acpi/hmat.c index 40bc83f4b593..48d53ceb4778 100644 --- a/drivers/acpi/hmat.c +++ b/drivers/acpi/hmat.c @@ -206,6 +206,7 @@ static __init int hmat_parse_cache(union acpi_subtable_headers *header, const unsigned long end) { struct acpi_hmat_cache *cache = (void *)header; + struct node_cache_attrs cache_attrs; u32 attrs; if (cache->header.length < sizeof(*cache)) { @@ -219,6 +220,37 @@ static __init int hmat_parse_cache(union acpi_subtable_headers *header, cache->memory_PD, cache->cache_size, attrs, cache->number_of_SMBIOShandles); + cache_attrs.size = cache->cache_size; + cache_attrs.level = (attrs & ACPI_HMAT_CACHE_LEVEL) >> 4; + cache_attrs.line_size = (attrs & ACPI_HMAT_CACHE_LINE_SIZE) >> 16; + + switch ((attrs & ACPI_HMAT_CACHE_ASSOCIATIVITY) >> 8) { + case ACPI_HMAT_CA_DIRECT_MAPPED: + cache_attrs.associativity = NODE_CACHE_DIRECT_MAP; + break; + case ACPI_HMAT_CA_COMPLEX_CACHE_INDEXING: + cache_attrs.associativity = NODE_CACHE_INDEXED; + break; + case ACPI_HMAT_CA_NONE: + default: + cache_attrs.associativity = NODE_CACHE_OTHER; + break; + } + + switch ((attrs & ACPI_HMAT_WRITE_POLICY) >> 12) { + case ACPI_HMAT_CP_WB: + cache_attrs.write_policy = NODE_CACHE_WRITE_BACK; + break; + case ACPI_HMAT_CP_WT: + cache_attrs.write_policy = NODE_CACHE_WRITE_THROUGH; + break; + case ACPI_HMAT_CP_NONE: + default: + cache_attrs.write_policy = NODE_CACHE_WRITE_OTHER; + break; + } + + node_add_cache(pxm_to_node(cache->memory_PD), &cache_attrs); return 0; } -- 2.14.4