From patchwork Tue Aug 27 02:02:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dann frazier X-Patchwork-Id: 1153536 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46HXFS5RHPz9sMr; Tue, 27 Aug 2019 12:02:36 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1i2Qoa-00051j-OZ; Tue, 27 Aug 2019 02:02:32 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1i2QoY-000511-Q9 for kernel-team@lists.ubuntu.com; Tue, 27 Aug 2019 02:02:30 +0000 Received: from mail-io1-f71.google.com ([209.85.166.71]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1i2QoY-00036F-Cc for kernel-team@lists.ubuntu.com; Tue, 27 Aug 2019 02:02:30 +0000 Received: by mail-io1-f71.google.com with SMTP id q26so25185634ioi.10 for ; Mon, 26 Aug 2019 19:02:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GyXjsHqwLA70RhRfWh4AOD+N8LWysKIva9LBoyRTr5I=; b=Ryc5hHm8fv1JgS9hHVWHdyuTD1TRKEZ0U92b19zdmxmlFwKLxIP3q5xTMEJPE/e09A FiCrVsl72rqKP+/dtw6oEtxSZQpsz2OobGV4UPKZtbQBm8RAwu0+DSgdYxorXu+3rjmL c979Oy5YD+GN3neElQ12/0LY98W696zhnw870gslAbhI+YVp+IVp5DSVFQsg5TM+dQrg Vx/Zz/83VkydtIBlqnxtPdodUquncR+1e5glfrzOBnfV83khxXZiivXPnh2jXtwa2iJQ 7EAGQScftjufi8YdH5Myw47b4fYh9sGbP5rflPlbom684+OTraBzMgZaex/NKkZWWTzo 102A== X-Gm-Message-State: APjAAAXpkXPkJUwv3hmsQEveLiu8eT4jw4af09Zm/c3Z1WgG+pWLHGvD vxYjs9o3oCRnPACWQeyBN+Fp1MnWSsJKYTmQV4c8aiHj+2Zlie7O1JnElLtzy0V1BxouDHlXcjO xtT5fJMEk/d7OC9VkJkxggK0E5jtCjE84W8RuNRSMTQ== X-Received: by 2002:a6b:6812:: with SMTP id d18mr2937062ioc.239.1566871349249; Mon, 26 Aug 2019 19:02:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZp7/H/HOqkvn/bYfMO0QY6qgmwzBppS1zg8wYnoXVq2lB6pbXaTf4JpMYzcvslbwYQD2S4w== X-Received: by 2002:a6b:6812:: with SMTP id d18mr2937042ioc.239.1566871348993; Mon, 26 Aug 2019 19:02:28 -0700 (PDT) Received: from xps13.canonical.com (c-71-56-235-36.hsd1.co.comcast.net. [71.56.235.36]) by smtp.gmail.com with ESMTPSA id p3sm10895047iom.7.2019.08.26.19.02.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2019 19:02:28 -0700 (PDT) From: dann frazier To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/4][Eoan] ACPI/PPTT: Add function to return ACPI 6.3 Identical tokens Date: Mon, 26 Aug 2019 20:02:17 -0600 Message-Id: <20190827020219.15242-3-dann.frazier@canonical.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827020219.15242-1-dann.frazier@canonical.com> References: <20190827020219.15242-1-dann.frazier@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Jeremy Linton BugLink: https://bugs.launchpad.net/bugs/1841490 ACPI 6.3 adds a flag to indicate that child nodes are all identical cores. This is useful to authoritatively determine if a set of (possibly offline) cores are identical or not. Since the flag doesn't give us a unique id we can generate one and use it to create bitmaps of sibling nodes, or simply in a loop to determine if a subset of cores are identical. Acked-by: Rafael J. Wysocki Tested-by: Hanjun Guo Reviewed-by: Sudeep Holla Signed-off-by: Jeremy Linton Signed-off-by: Will Deacon (cherry picked from commit 56855a99f3d0d1e9f1f4e24f5851f9bf14c83296) Signed-off-by: dann frazier --- drivers/acpi/pptt.c | 26 ++++++++++++++++++++++++++ include/linux/acpi.h | 5 +++++ 2 files changed, 31 insertions(+) diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c index 05344413f1997..1e7ac0bd0d3a0 100644 --- a/drivers/acpi/pptt.c +++ b/drivers/acpi/pptt.c @@ -683,3 +683,29 @@ int find_acpi_cpu_topology_package(unsigned int cpu) return find_acpi_cpu_topology_tag(cpu, PPTT_ABORT_PACKAGE, ACPI_PPTT_PHYSICAL_PACKAGE); } + +/** + * find_acpi_cpu_topology_hetero_id() - Get a core architecture tag + * @cpu: Kernel logical CPU number + * + * Determine a unique heterogeneous tag for the given CPU. CPUs with the same + * implementation should have matching tags. + * + * The returned tag can be used to group peers with identical implementation. + * + * The search terminates when a level is found with the identical implementation + * flag set or we reach a root node. + * + * Due to limitations in the PPTT data structure, there may be rare situations + * where two cores in a heterogeneous machine may be identical, but won't have + * the same tag. + * + * Return: -ENOENT if the PPTT doesn't exist, or the CPU cannot be found. + * Otherwise returns a value which represents a group of identical cores + * similar to this CPU. + */ +int find_acpi_cpu_topology_hetero_id(unsigned int cpu) +{ + return find_acpi_cpu_topology_tag(cpu, PPTT_ABORT_PACKAGE, + ACPI_PPTT_ACPI_IDENTICAL); +} diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 872ab208c8ad8..b2c8d6f21d68f 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1306,6 +1306,7 @@ static inline int lpit_read_residency_count_address(u64 *address) #ifdef CONFIG_ACPI_PPTT int find_acpi_cpu_topology(unsigned int cpu, int level); int find_acpi_cpu_topology_package(unsigned int cpu); +int find_acpi_cpu_topology_hetero_id(unsigned int cpu); int find_acpi_cpu_cache_topology(unsigned int cpu, int level); #else static inline int find_acpi_cpu_topology(unsigned int cpu, int level) @@ -1316,6 +1317,10 @@ static inline int find_acpi_cpu_topology_package(unsigned int cpu) { return -EINVAL; } +static inline int find_acpi_cpu_topology_hetero_id(unsigned int cpu) +{ + return -EINVAL; +} static inline int find_acpi_cpu_cache_topology(unsigned int cpu, int level) { return -EINVAL;