From patchwork Wed Jul 19 09:00:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evan Quan X-Patchwork-Id: 122486 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2313636vqt; Wed, 19 Jul 2023 02:35:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlGt3hrVcfHyVpAwv5RPpoFPgbp2HfkQOOW33xH9fBo1BHyCSQmLeb74aT/lyvKl7zR3rFlJ X-Received: by 2002:a17:902:e88d:b0:1b8:b442:aa97 with SMTP id w13-20020a170902e88d00b001b8b442aa97mr4468869plg.54.1689759319237; Wed, 19 Jul 2023 02:35:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689759319; cv=pass; d=google.com; s=arc-20160816; b=GBgjqMnqyKEqlIhTjgtOOnpXIEtf1TdCJl+5kKVXqA3+A3Yx0m1vNLG/jR+T4yfZcC vPt3KnjYe23Gn5NRZRhMIZGT3/2fYsOEzMjqHb/V3spAYbms6AqHKHhhaTwA6rROoZm0 evkMZ16z7o5uPG7KLeDwy5K2uV6PIt3rpw0MIFxwkitprgsa03TH9PmcfxALzTa7DztI y8WAumRjs3wCsaCLhv27DPnhKisyXIElVVZhs6E1PZFCUdLBNj8eRzS6V59uM9R4HctZ NrkLoDEKKzIFKf480bE8LvS3Oj6MOArZ1VcM+0Ihkmx3PmTVxjGfYOThad0RA9VhIBsQ fXyg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cfth29BrWZrzk+qu1CaoTQ6BbwxlunM+2D18Jm9HX9w=; fh=WpfgbTJceSODJ2RxjBwoHNUpZn2apRLDTiiS5YGrd/M=; b=oNClJ+39/gYE4RvP1bQVkZcIcJY+ldXeE6rz5DuzDhffHlQOqrTTSZ3RtMkMr9+4DY 6kj7Q6nlAvAURGLrWomDvzkdJiG5sT+NX0oRz9+gzaQ4jWnlmeBnn3hiL9/st2Dr8mON oA3UFmzFv91d4fMGRqCsfPKloglZhtqnCKtGTQGfpJ6uvR6sHvWsl3pvSjnPp03pUweW BB6oJZhw5/kZ4Jd5NokAmLpFESX7IfRw1XH16m4ThCDFiinkVdNACVeAlIlcSffsi6MN rBMEfAFiHR/7zXw7e6qP2foSOjFQ077830D4qhf+CxEGSYteyVeVmj2rDWBjyuepYkxW RcaQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="xQeh/4FS"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t3-20020a170902e84300b001b3dd62b1dbsi3241921plg.560.2023.07.19.02.35.04; Wed, 19 Jul 2023 02:35:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="xQeh/4FS"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230178AbjGSJEr (ORCPT + 99 others); Wed, 19 Jul 2023 05:04:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230003AbjGSJEU (ORCPT ); Wed, 19 Jul 2023 05:04:20 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2042.outbound.protection.outlook.com [40.107.223.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAC281FE2; Wed, 19 Jul 2023 02:03:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nfmp3KZ3p/7oyD67eBsVOkYL5hegdr5BhAZawKLyvwyPjHRebMVmzVgh0ARt+yeXwNmKtUYGuaviXi8CjCP6zhVewSFP2mzel1E3xqH2MyW6q7PO+E1JpS7P4HH+d5UCXNhzXWnfTp4+GSih6IcD3Ae1j2atYoopSD5kTgcqkOPTVKcgcW/tWlzor6Z5lyqzhSxzZplf9r+02ByxVueCPpj0Yzs1aKHX6XK22CoWOiGrM1nkoXTPFRDhtfq3jG1Dhy89TxPpqxZBR3VE0EOApBYJwbgedASWDDDncnMQCzti9b+5KXcLkqv1BIragUnCzjyrz6sq7xOFj1HvgLO7nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cfth29BrWZrzk+qu1CaoTQ6BbwxlunM+2D18Jm9HX9w=; b=n9phqOFoOSNFK+IUdlVY649T+5Nx9/PhNbMvnytwjViIzzGeZp9rcDCigINaxTGC1eC3q8EmjqG+ZLc28IdPkqR4Cy5x1gTJjhxR1Jl8+wMQ3rmAEUWn2k+DBRD2YDjZDsYU6LYR3BV6b8K19f7zAdS7yhQ1l6TTQK1M1hT30Q3VRIiXURuFm/DYRMgbeCCz6mNBHkKtq47yI4N7yvwqT1Ka3F/zsKnJeD8qLdYL0x3H/l+KEB4Ut/iWniLidVudkcj2rCQ6c8znW8pQNHyGdNyGI8oAqf66aLp2LgK2QZzREz9GhA+aAmOqJBMM/DjJxh4Nmxo9CTsUv3kBiV0n9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cfth29BrWZrzk+qu1CaoTQ6BbwxlunM+2D18Jm9HX9w=; b=xQeh/4FSjA6opcBNAVjAvkq/aYaYci6nylLcuvpt/Lqf6fOFoHqu238PM1TaroN0Io+1XoZqWPG2RUAntttWfz5X+/BhNHrQ6yHjyiU6Z8DZbU9RBkIS3L+dUZejTgB9H7IVL3k3EYQLYw+2zsTxouUgvOejg30VM9gxONMYDMk= Received: from BYAPR08CA0066.namprd08.prod.outlook.com (2603:10b6:a03:117::43) by PH7PR12MB7114.namprd12.prod.outlook.com (2603:10b6:510:1ed::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Wed, 19 Jul 2023 09:03:32 +0000 Received: from DM6NAM11FT080.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:117:cafe::fc) by BYAPR08CA0066.outlook.office365.com (2603:10b6:a03:117::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.23 via Frontend Transport; Wed, 19 Jul 2023 09:03:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT080.mail.protection.outlook.com (10.13.173.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.34 via Frontend Transport; Wed, 19 Jul 2023 09:03:31 +0000 Received: from equan-buildpc.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 19 Jul 2023 04:03:23 -0500 From: Evan Quan To: , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , , , , , Evan Quan , Mario Limonciello Subject: [PATCH V7 9/9] drm/amd/pm: enable Wifi RFI mitigation feature support for SMU13.0.7 Date: Wed, 19 Jul 2023 17:00:20 +0800 Message-ID: <20230719090020.2716892-10-evan.quan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230719090020.2716892-1-evan.quan@amd.com> References: <20230719090020.2716892-1-evan.quan@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT080:EE_|PH7PR12MB7114:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b83959f-fd73-4198-97ac-08db8837067c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: omlg3BZzMTPGeXbcFzs6uFm30/+blQRIQ6USPN1zrJm/SAdebr7sfXaAvLY6kxm2mEkKtjVHmL4XQa6LTnAThxmTRqW8OO9Ahg9n747GBAmYM4l45sodOi3h44LFwObViNaG7TXgJG/pR+gyQZSPkR93A3iw+mNECuh0KhSPLk6WrGHE+jgTEIyaaB6V5SZVYFU/aW25UoI5aBHZdaYH7t+kBrYD6SDvKOGxlDSHdKJDEiqxFhl+0VXZLaXZGrVUNgob4UDiXVLwh7Qbgbkejtm57Q3OI6ZRhkd6pLnDU+2EKE9JnHdclxgbCwvZdmcdVR70aacHimIzPgy6QxYMY4O4xiCVsmP6nHlNddY0c9B8fh0c0lN9PePPvQsYfA+6/q/a6IZrT6fp4d84sLkVIvvVC/bNJIwlL5fQWc0EawF+Yn31y5GvJXnHvqB3E4KO5IwEdJGNIk13Ran2Iha7US/ijfkZ1BZLJy8wI6NlSzTYu2NVl3OnA8R9fwnmxSGWKuBGeErdx9RSwfhnoo/1MArte7bLvyk6R7CTeK7YuDILW7Eom+aw57IlBpWmiDo4V5F8m4OyhcV0vrJe8YrkUrraNKy3RoX8KlY6RT3PmXCh49QHpa/CKSapZ8Zz3uFYGu3McpORO5pTCBBf+uKsJnwdiYqK735XFZu1K5OO9PXYwg2WJuX2Ni8TYE8uChb3muE6QFNjMAb+Qe9+3KmLf5PA3T9TFxFIPqBnLtD7GsJp2SBBvuAOXgd2pSANc8Vv2ZK0q1eWZoO0bG2HABDmDbzjfuYVaMQRfejz/H4AYg3FMkxrug+E3Zgw6+r1ikD2Cwpg4Nz4mJcD2/rKZQyZJA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(136003)(376002)(39860400002)(396003)(451199021)(82310400008)(36840700001)(46966006)(40470700004)(426003)(86362001)(36860700001)(2616005)(36756003)(316002)(4326008)(81166007)(82740400003)(83380400001)(7696005)(47076005)(16526019)(1076003)(336012)(186003)(26005)(921005)(356005)(40460700003)(54906003)(478600001)(110136005)(2906002)(5660300002)(70586007)(70206006)(40480700001)(8936002)(8676002)(7416002)(44832011)(41300700001)(36900700001)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 09:03:31.5683 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b83959f-fd73-4198-97ac-08db8837067c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT080.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7114 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771841068248732355 X-GMAIL-MSGID: 1771841068248732355 Fulfill the SMU13.0.7 support for Wifi RFI mitigation feature. Signed-off-by: Evan Quan Reviewed-by: Mario Limonciello --- .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c index bba621615abf..4a680756208b 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c @@ -126,6 +126,7 @@ static struct cmn2asic_msg_mapping smu_v13_0_7_message_map[SMU_MSG_MAX_COUNT] = MSG_MAP(AllowGpo, PPSMC_MSG_SetGpoAllow, 0), MSG_MAP(GetPptLimit, PPSMC_MSG_GetPptLimit, 0), MSG_MAP(NotifyPowerSource, PPSMC_MSG_NotifyPowerSource, 0), + MSG_MAP(EnableUCLKShadow, PPSMC_MSG_EnableUCLKShadow, 0), }; static struct cmn2asic_mapping smu_v13_0_7_clk_map[SMU_CLK_COUNT] = { @@ -206,6 +207,7 @@ static struct cmn2asic_mapping smu_v13_0_7_table_map[SMU_TABLE_COUNT] = { TAB_MAP(DRIVER_SMU_CONFIG), TAB_MAP(ACTIVITY_MONITOR_COEFF), [SMU_TABLE_COMBO_PPTABLE] = {1, TABLE_COMBO_PPTABLE}, + TAB_MAP(WIFIBAND), }; static struct cmn2asic_mapping smu_v13_0_7_pwr_src_map[SMU_POWER_SOURCE_COUNT] = { @@ -488,6 +490,9 @@ static int smu_v13_0_7_tables_init(struct smu_context *smu) AMDGPU_GEM_DOMAIN_VRAM); SMU_TABLE_INIT(tables, SMU_TABLE_COMBO_PPTABLE, MP0_MP1_DATA_REGION_SIZE_COMBOPPTABLE, PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM); + SMU_TABLE_INIT(tables, SMU_TABLE_WIFIBAND, + sizeof(WifiBandEntryTable_t), PAGE_SIZE, + AMDGPU_GEM_DOMAIN_VRAM); smu_table->metrics_table = kzalloc(sizeof(SmuMetricsExternal_t), GFP_KERNEL); if (!smu_table->metrics_table) @@ -1722,6 +1727,57 @@ static int smu_v13_0_7_set_df_cstate(struct smu_context *smu, NULL); } +static bool smu_v13_0_7_wbrf_support_check(struct smu_context *smu) +{ + return smu->smc_fw_version > 0x00524600; +} + +static int smu_v13_0_7_set_wbrf_exclusion_ranges(struct smu_context *smu, + struct exclusion_range *exclusion_ranges) +{ + WifiBandEntryTable_t wifi_bands; + int valid_entries = 0; + int ret, i; + + memset(&wifi_bands, 0, sizeof(wifi_bands)); + for (i = 0; i < ARRAY_SIZE(wifi_bands.WifiBandEntry); i++) { + if (!exclusion_ranges[i].start && + !exclusion_ranges[i].end) + break; + + /* PMFW expects the inputs to be in Mhz unit */ + wifi_bands.WifiBandEntry[valid_entries].LowFreq = + DIV_ROUND_DOWN_ULL(exclusion_ranges[i].start, HZ_IN_MHZ); + wifi_bands.WifiBandEntry[valid_entries++].HighFreq = + DIV_ROUND_UP_ULL(exclusion_ranges[i].end, HZ_IN_MHZ); + } + wifi_bands.WifiBandEntryNum = valid_entries; + + /* + * Per confirm with PMFW team, WifiBandEntryNum = 0 is a valid setting. + * Considering the scenarios below: + * - At first the wifi device adds an exclusion range e.g. (2400,2500) to + * BIOS and our driver gets notified. We will set WifiBandEntryNum = 1 + * and pass the WifiBandEntry (2400, 2500) to PMFW. + * + * - Later the wifi device removes the wifiband list added above and + * our driver gets notified again. At this time, driver will set + * WifiBandEntryNum = 0 and pass an empty WifiBandEntry list to PMFW. + * - PMFW may still need to do some uclk shadow update(e.g. switching + * from shadow clock back to primary clock) on receiving this. + */ + + ret = smu_cmn_update_table(smu, + SMU_TABLE_WIFIBAND, + 0, + (void *)(&wifi_bands), + true); + if (ret) + dev_err(smu->adev->dev, "Failed to set wifiband!"); + + return ret; +} + static const struct pptable_funcs smu_v13_0_7_ppt_funcs = { .get_allowed_feature_mask = smu_v13_0_7_get_allowed_feature_mask, .set_default_dpm_table = smu_v13_0_7_set_default_dpm_table, @@ -1787,6 +1843,9 @@ static const struct pptable_funcs smu_v13_0_7_ppt_funcs = { .set_mp1_state = smu_v13_0_7_set_mp1_state, .set_df_cstate = smu_v13_0_7_set_df_cstate, .gpo_control = smu_v13_0_gpo_control, + .is_asic_wbrf_supported = smu_v13_0_7_wbrf_support_check, + .enable_uclk_shadow = smu_v13_0_enable_uclk_shadow, + .set_wbrf_exclusion_ranges = smu_v13_0_7_set_wbrf_exclusion_ranges, }; void smu_v13_0_7_set_ppt_funcs(struct smu_context *smu)