From patchwork Tue Aug 27 02:03:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dann frazier X-Patchwork-Id: 1153543 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 46HXHM34dWz9sDB; Tue, 27 Aug 2019 12:04:15 +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 1i2QqA-0005Ho-TV; Tue, 27 Aug 2019 02:04:10 +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 1i2Qq7-0005FE-4S for kernel-team@lists.ubuntu.com; Tue, 27 Aug 2019 02:04:07 +0000 Received: from mail-io1-f72.google.com ([209.85.166.72]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1i2Qq6-0003Cs-ML for kernel-team@lists.ubuntu.com; Tue, 27 Aug 2019 02:04:06 +0000 Received: by mail-io1-f72.google.com with SMTP id a13so25025934ioh.18 for ; Mon, 26 Aug 2019 19:04:06 -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=w6SkJaY34ngmKr7F2bZYQXXknkmSjNSLZqogwlJU+FY=; b=b2ViLC2GrenQ1xJ9UHzDOyTLZ71R3E5XL8qAMFWUzLUcsG6B0wmBOCJgjaKcGCkSju urF+79ahu+WHn1q64e58sr2svh6+X7PUbEfx0kjwB4+2FbDQKHYzKJVhE1+yDV9w0X+E /U+qjnODggTcGAEJ6wO7NnnYPfSX8L7cwwBdCbeXrDRohvaOQF9bTvs2QU0kVyDbG9Ae Ov85ol8WH+olEaClGhk7s2jBl/EOanDhzYz4MNXTE8uHHq0X7aICCvKcA/IuJOkTD4RC NiQksj9+v6RnlPi32eBBYI+adhpdxY9mG/ym3Wq3+5H2/mYtzmWLj9Hl/bhG3jId8VkR Wz2w== X-Gm-Message-State: APjAAAVhLy7lir6Sq29dd6JY4cF86244veugm9H8UwiHlTiheSKnJcmI Vm5Tt3aBRmNZ2YFHBHjhJgtZOHxGnEENG/Kcf3IDN+6UTWYjZdrR3C+WZhozx39NBd76VfhEtq3 0+lqTKJRG8mdM/cpqrnzG3NdXXk6JmbHSCK8osfiMDg== X-Received: by 2002:a6b:6f06:: with SMTP id k6mr29735743ioc.232.1566871445485; Mon, 26 Aug 2019 19:04:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+GAv1EC0tWtZypaBtKjQAyFX73moBzo+I9mKhy2ZpNjaRbxf3isYeivNcDKOetqiSFWQ/Ww== X-Received: by 2002:a6b:6f06:: with SMTP id k6mr29735731ioc.232.1566871445220; Mon, 26 Aug 2019 19:04:05 -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 k7sm12913721iop.88.2019.08.26.19.04.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2019 19:04:04 -0700 (PDT) From: dann frazier To: kernel-team@lists.ubuntu.com Subject: [PATCH 4/6][SRU Disco] ACPI/PPTT: Add function to return ACPI 6.3 Identical tokens Date: Mon, 26 Aug 2019 20:03:49 -0600 Message-Id: <20190827020351.15443-5-dann.frazier@canonical.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827020351.15443-1-dann.frazier@canonical.com> References: <20190827020219.15242-1-dann.frazier@canonical.com> <20190827020351.15443-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 068dc5bdc7ab2..08cacb155c08e 100644 --- a/drivers/acpi/pptt.c +++ b/drivers/acpi/pptt.c @@ -675,3 +675,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 87715f20b69a0..d4a6b6e2b3edb 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1315,6 +1315,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) @@ -1325,6 +1326,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;