From patchwork Mon Mar 15 06:53:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1453026 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=YJtyva0p; dkim-atps=neutral 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 4DzRw6259jz9sW4; Mon, 15 Mar 2021 17:53:42 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1lLh6h-0002l4-Kq; Mon, 15 Mar 2021 06:53:39 +0000 Received: from mail-pl1-f181.google.com ([209.85.214.181]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lLh6f-0002kb-35 for kernel-team@lists.ubuntu.com; Mon, 15 Mar 2021 06:53:37 +0000 Received: by mail-pl1-f181.google.com with SMTP id c16so14826713ply.0 for ; Sun, 14 Mar 2021 23:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iKs4gC6i7Zn3ffEZcOFwIk4DY28cebe+uTjeTbLdb2c=; b=YJtyva0pm77/MGL4ONTeaQGun2gXJp/bL5PJzY4X/64uHvOaQMDUHHArKaXICmKExM ek2bymko+Ih/xsQ7XZgv+k+6T+k2YsgTn46TSVRwDzSe83L3+D/o32C7vnlyomyou6+z NMvPJ1csgFUuYgbnLrd1KM+9mxKWYRUY9cIZhlrMULZWOAaqGl7Qv8YKQfqdLl5w2Iot P2qAUVof/InWIWye/tMgAxBUP0+w8BYDsTp5JxPWcgy4jQdx5VABuWFVlvEscTHkAOID F4SNbhcxP4kMlA713JQKlIQQ4H9CAoW6RMRoAERoR4P9yvr41LA6w3W0svVG6v4rcBbN 19iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=iKs4gC6i7Zn3ffEZcOFwIk4DY28cebe+uTjeTbLdb2c=; b=XOniabBHDDxIpBn5Gg7MOFk+jq7kN8fS70x0VP8bTSDKqjBW6pF8aHcFy1C3RAUPUy rSyBEC3CjiCtRlx7/X2tBhw1KjsMQTo2tpfLsVHf6VSqJ+VR2UKQ6oHWvzfXrfbaZhrP F82BGlrBIlfHu4ZfMbaSnxeNli/AV49qiYBry0rUPiajFiGqu1duqSFPOAFluOpS7M6f PC/1uP/OJTvUrJDp26KbOegQUWzCusfQTsJ0pNRLJZZ2lnfZAEYXVNiewX5IvzMApavZ m/5uQmVzJ6yLydrzS5tWTP9ohUBLNKWFlEPVdYlY+5vzczbjmD4rXOp0RK+E9GlUGYQo NHaw== X-Gm-Message-State: AOAM5314KkssnuyJlY1KPUynw5BkBAljZ+ALF6faJZE83jxaL9v8apgN Sl89mHOp2UpiaTu6Fmo1dRhrYWM6cUs= X-Google-Smtp-Source: ABdhPJzehA/mtVC+uZkRWzFn/WXV0N3P0DmB9l5STjQvXuYb3ekbxb9F6FunyofkaUjW8l5shdqdpg== X-Received: by 2002:a17:90b:1950:: with SMTP id nk16mr11190813pjb.140.1615791214701; Sun, 14 Mar 2021 23:53:34 -0700 (PDT) Received: from localhost (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id f15sm12077134pgg.84.2021.03.14.23.53.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 23:53:33 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1][SRU][OEM-5.10] UBUNTU: SAUCE: platform/x86: intel_pmc: Ignore GBE LTR on Tiger Lake platforms Date: Mon, 15 Mar 2021 14:53:28 +0800 Message-Id: <20210315065328.54680-2-acelan.kao@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210315065328.54680-1-acelan.kao@canonical.com> References: <20210315065328.54680-1-acelan.kao@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.214.181; envelope-from=acelan@gmail.com; helo=mail-pl1-f181.google.com 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: "David E. Box" BugLink: https://bugs.launchpad.net/bugs/1919116 Due to a HW limitation, the Latency Tolerance Reporting (LTR) value programmed in the Tiger Lake GBE controller is not large enough to allow the platform to enter Package C10, which in turn prevents the platform from achieving its low power target during suspend-to-idle. Ignore the GBE LTR value on Tiger Lake. LTR ignore functionality is currently performed solely by a debugfs write call. Split out the LTR code into its own function that can be called by both the debugfs writer and by this work around. Signed-off-by: David E. Box Reviewed-by: Sasha Neftin Cc: intel-wired-lan@lists.osuosl.org (cherry picked from https://patchwork.kernel.org/project/platform-driver-x86/patch/20210305190608.1834164-1-david.e.box@linux.intel.com/) Signed-off-by: Chia-Lin Kao (AceLan) --- drivers/platform/x86/intel_pmc_core.c | 55 ++++++++++++++++++++------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c index 3e5fe66333f1..38ef87cfd1cc 100644 --- a/drivers/platform/x86/intel_pmc_core.c +++ b/drivers/platform/x86/intel_pmc_core.c @@ -863,34 +863,45 @@ static int pmc_core_pll_show(struct seq_file *s, void *unused) } DEFINE_SHOW_ATTRIBUTE(pmc_core_pll); -static ssize_t pmc_core_ltr_ignore_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) +static int pmc_core_write_ltr_ignore(u32 value) { struct pmc_dev *pmcdev = &pmc; const struct pmc_reg_map *map = pmcdev->map; - u32 val, buf_size, fd; - int err; - - buf_size = count < 64 ? count : 64; - - err = kstrtou32_from_user(userbuf, buf_size, 10, &val); - if (err) - return err; + u32 fd; + int err = 0; mutex_lock(&pmcdev->lock); - if (val > map->ltr_ignore_max) { + if (fls(value) > map->ltr_ignore_max) { err = -EINVAL; goto out_unlock; } fd = pmc_core_reg_read(pmcdev, map->ltr_ignore_offset); - fd |= (1U << val); + fd |= value; pmc_core_reg_write(pmcdev, map->ltr_ignore_offset, fd); out_unlock: mutex_unlock(&pmcdev->lock); + + return err; +} + +static ssize_t pmc_core_ltr_ignore_write(struct file *file, + const char __user *userbuf, + size_t count, loff_t *ppos) +{ + u32 buf_size, val; + int err; + + buf_size = count < 64 ? count : 64; + + err = kstrtou32_from_user(userbuf, buf_size, 10, &val); + if (err) + return err; + + err = pmc_core_write_ltr_ignore(1U << val); + return err == 0 ? count : err; } @@ -1189,6 +1200,15 @@ static int quirk_xtal_ignore(const struct dmi_system_id *id) return 0; } +static int quirk_ltr_ignore(u32 val) +{ + int err; + + err = pmc_core_write_ltr_ignore(val); + + return err; +} + static const struct dmi_system_id pmc_core_dmi_table[] = { { .callback = quirk_xtal_ignore, @@ -1244,6 +1264,15 @@ static int pmc_core_probe(struct platform_device *pdev) pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit(); dmi_check_system(pmc_core_dmi_table); + /* + * On TGL, due to a hardware limitation, the GBE LTR blocks PC10 when + * a cable is attached. Tell the PMC to ignore it. + */ + if (pmcdev->map == &tgl_reg_map) { + dev_dbg(&pdev->dev, "ignoring GBE LTR\n"); + quirk_ltr_ignore(1U << 3); + } + pmc_core_dbgfs_register(pmcdev); device_initialized = true;