From patchwork Tue Aug 27 02:02:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dann frazier X-Patchwork-Id: 1153534 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 46HXFR58Dtz9sDQ; Tue, 27 Aug 2019 12:02:35 +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 1i2QoZ-000518-HJ; Tue, 27 Aug 2019 02:02:31 +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 1i2QoX-00050g-GN for kernel-team@lists.ubuntu.com; Tue, 27 Aug 2019 02:02:29 +0000 Received: from mail-io1-f69.google.com ([209.85.166.69]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1i2QoX-00036C-21 for kernel-team@lists.ubuntu.com; Tue, 27 Aug 2019 02:02:29 +0000 Received: by mail-io1-f69.google.com with SMTP id q5so25161717iof.19 for ; Mon, 26 Aug 2019 19:02:29 -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=vXn8rB8Hlt2VUQpUKTzay+0lz94auiHtBwHD0plB5BI=; b=Wphqu+euhYO1xYo2OqG5ROTGmPeH7g3k+GvGdJApuzNDhVgb1P0MSJswuIkr7GodE+ uA7MSRxkNxcU/ao2svm15FggnC/ynmEHNpKlM2uSqDXxlL4+VNbeUoXOKY9NNFQzhAy2 vXQcnfPXQgTjhXOObRgqwjyWIMWgzubzWQnYqMcftkx7GwgOiQ8Lnpkmetnge8rxSUBK ioAzoL2V2zelXYT+kSRYwajQTCu11khd7byuyNfADSY7PHNKHFMBDK81XBUnKMt3Zci8 ETal4vqhOLcsTBqHA8hDVFucPXXhy1k1VU5eprv3Md7F1goGdAZucGE9bzsHuSESwRWx spkw== X-Gm-Message-State: APjAAAWpB1DNgQq4jWESciYB0qO031Sqiy1wF5Dv5CTsJIUb4H2O5/74 QcBlT/I7u5sP5YbyhfvNfm+IXmhHveYw69whcnbrlF+tOzejsW/IrpRJfkCfW6CPVLatDF+hUlA j/zZH8hbJrtXFXukqY7woN92GrCoY/B84vLm88/oAVg== X-Received: by 2002:a02:4047:: with SMTP id n68mr21591178jaa.10.1566871347905; Mon, 26 Aug 2019 19:02:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqz0dlZQ/8gccHg6Em4x4zhwkN4GNxdtMjqBootKGQIKAYTy07OpxTzLJyHHrl/WtFFzG4cFzQ== X-Received: by 2002:a02:4047:: with SMTP id n68mr21591165jaa.10.1566871347623; Mon, 26 Aug 2019 19:02:27 -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 j18sm5741931ioo.14.2019.08.26.19.02.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2019 19:02:27 -0700 (PDT) From: dann frazier To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/4][Eoan] ACPI/PPTT: Modify node flag detection to find last IDENTICAL Date: Mon, 26 Aug 2019 20:02:16 -0600 Message-Id: <20190827020219.15242-2-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 The ACPI specification implies that the IDENTICAL flag should be set on all non leaf nodes where the children are identical. This means that we need to be searching for the last node with the identical flag set rather than the first one. Since this flag is also dependent on the table revision, we need to add a bit of extra code to verify the table revision, and the next node's state in the traversal. Since we want to avoid function pointers here, lets just special case the IDENTICAL flag. 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 ed2b664fcc8073c09394393756df3fc86977bbac) Signed-off-by: dann frazier --- drivers/acpi/pptt.c | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c index b72e6afaa8fb9..05344413f1997 100644 --- a/drivers/acpi/pptt.c +++ b/drivers/acpi/pptt.c @@ -432,17 +432,40 @@ static void cache_setup_acpi_cpu(struct acpi_table_header *table, } } +static bool flag_identical(struct acpi_table_header *table_hdr, + struct acpi_pptt_processor *cpu) +{ + struct acpi_pptt_processor *next; + + /* heterogeneous machines must use PPTT revision > 1 */ + if (table_hdr->revision < 2) + return false; + + /* Locate the last node in the tree with IDENTICAL set */ + if (cpu->flags & ACPI_PPTT_ACPI_IDENTICAL) { + next = fetch_pptt_node(table_hdr, cpu->parent); + if (!(next && next->flags & ACPI_PPTT_ACPI_IDENTICAL)) + return true; + } + + return false; +} + /* Passing level values greater than this will result in search termination */ #define PPTT_ABORT_PACKAGE 0xFF -static struct acpi_pptt_processor *acpi_find_processor_package_id(struct acpi_table_header *table_hdr, - struct acpi_pptt_processor *cpu, - int level, int flag) +static struct acpi_pptt_processor *acpi_find_processor_tag(struct acpi_table_header *table_hdr, + struct acpi_pptt_processor *cpu, + int level, int flag) { struct acpi_pptt_processor *prev_node; while (cpu && level) { - if (cpu->flags & flag) + /* special case the identical flag to find last identical */ + if (flag == ACPI_PPTT_ACPI_IDENTICAL) { + if (flag_identical(table_hdr, cpu)) + break; + } else if (cpu->flags & flag) break; pr_debug("level %d\n", level); prev_node = fetch_pptt_node(table_hdr, cpu->parent); @@ -480,8 +503,8 @@ static int topology_get_acpi_cpu_tag(struct acpi_table_header *table, cpu_node = acpi_find_processor_node(table, acpi_cpu_id); if (cpu_node) { - cpu_node = acpi_find_processor_package_id(table, cpu_node, - level, flag); + cpu_node = acpi_find_processor_tag(table, cpu_node, + level, flag); /* * As per specification if the processor structure represents * an actual processor, then ACPI processor ID must be valid.