Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp35054003rwd; Mon, 10 Jul 2023 01:43:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlHUOZcwipEromKVvwq+pCLRg2wsSiPR3zhn8duh9lHwkNM8eQy4yojI7VDx7R1se+yBo/3L X-Received: by 2002:a17:907:3205:b0:993:b230:936b with SMTP id xg5-20020a170907320500b00993b230936bmr15545799ejb.6.1688978615949; Mon, 10 Jul 2023 01:43:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688978615; cv=pass; d=google.com; s=arc-20160816; b=PfJqNPlWu7NXSD8gbOA4CPanf5GBGAsoDRXV5tlAJQZlEez7e41DOVbo4a+k6oK5to SR0qIoSkkwyt67ND8sFRBhl4maaWRfF/ciMG5oX3e8zq6Mrh4A/jqzLksy+zaz1Zu9QM dsuKEFViXLWQQudKLRG/D/hINQwGVxdAAPZKHnRiVA7gTbvwB0ALzhbC31PfyDBPE7Ux kWN7JSQl8MRF+aBL13LBJbcERdkCqnjyATKSU4KsO1pedAifF2GoE3rvN+GQLCjYfdhu otdDjkZNWOcMG4LmLvGCHanek1XO2VcQme8guGFG5tM3O4pfXKwdWaPFyK0m8Y5XKMs2 avwQ== 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=n8IpbwFhQH1l1J/lAW5N7XyKT74J/Ygoorok4y/lGPJ6uaU3xx8PeA7qScC4XfnPIR EhilQYGRzLy1CwyEr2SH5mm1ubQ0UYLR51E+XPSO+jfi72Ul9sjxsZZMRlK1pL3IzMx4 55AgljqHWPzrOgpwFreaccM8eq+cL1mXhFD6KsC8XIyrJL/CU4tkcLq2/Pvbt+9Ao7nR Q0aDbjyy0EZx6kLOaB424kwU7bSGFWPrBQarmdvbPKoZerbOfioty+pEG6qOEMC+lHs9 KP3HNNjNuauk4mm4C+TzsgTre+XMdEzRZaD6wbBIUYyQFW/0uSucAkL0VMG2sguldXr7 8Etg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=KIHj7z9b; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a170906a28700b00988635d8c25si9263193ejz.603.2023.07.10.01.43.19; Mon, 10 Jul 2023 01:43:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=KIHj7z9b; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-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 S232211AbjGJIlq (ORCPT + 60 others); Mon, 10 Jul 2023 04:41:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233026AbjGJIlN (ORCPT ); Mon, 10 Jul 2023 04:41:13 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B78081BE1; Mon, 10 Jul 2023 01:40:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CzS7gk/0eVRIcFMPLvglM9i1uyn0hCv8f0cSz9vAZ2XoUo379++Cj4zur4fG/CYPsu3FNVvtmU2RWf7LVx+WC33+mQD3t2R6M7DkiZ8VqlTchbCc5z3y5iMmagsMzaaYto3KQqrSoqU1G468oAJng+KQX9RWr4yJ4dWINBtqfMaIuJzEZytkqwYsEXs7OpuQvj99Kri3ZBAbTc+1n5ZZD94hJPartW9vqfwaP217oMwZzoBYeO2ZztatDljt/vyIMEc7O7EzQEv772oxHx7nAcXiC57g0EjpWFHRlM7+qut2PxeYg0106MmMRoizZu04ty9LEVTYwR1PEfkAXRi1XQ== 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=iuJ4uJrECU7A/Kc7ew0vpKxXeXApfjnIrCi6YjGEnwMs8yIlXeTQZYjZzJvU9G99fZu1sDOVnU4+Qscr8EasQ/wzPEdRX45bvKZ/vaSpXj2tejICytOaYCOiN16C1ak8EIi968sIVOo+BNzai7/06swI5oIHgZ6nJ7sMPf33b8ZLwBCyuEKi231CKh2znYIO016TBfAsWvMwYI/26ZH9l2SzxB/9+waC2lGuunWquoYPgzq5z30ceAhvMroVaBwQbPWZahaBt02HbVo/b5waP8QJGzxJexbjnRyuZHr5Ua7DwTEkWZSnn5vOv2VoQXmF/Hahv+OSuzH3WJBhtqoEeg== 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=KIHj7z9bicSbfjZYksGMQuCyrOyj6BThcgZv42/0nfyAmJEsGS3InS2oeYI9o8NL06whXCEW+ySllN1b76EIkVwaI2+NMP9MTFSJylh0H/i4A3qiuyMayw43p984OgcSxNfcDO49JxiW7TmUTOEXiZxZySfcB6IyodsKkeuU5Rk= Received: from BY5PR16CA0028.namprd16.prod.outlook.com (2603:10b6:a03:1a0::41) by CH0PR12MB5172.namprd12.prod.outlook.com (2603:10b6:610:bb::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Mon, 10 Jul 2023 08:40:13 +0000 Received: from DM6NAM11FT027.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:1a0:cafe::f5) by BY5PR16CA0028.outlook.office365.com (2603:10b6:a03:1a0::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30 via Frontend Transport; Mon, 10 Jul 2023 08:40:13 +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 DM6NAM11FT027.mail.protection.outlook.com (10.13.172.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.19 via Frontend Transport; Mon, 10 Jul 2023 08:40:12 +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; Mon, 10 Jul 2023 03:40:03 -0500 From: Evan Quan To: , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , , , , , Evan Quan , Mario Limonciello Subject: [PATCH V6 9/9] drm/amd/pm: enable Wifi RFI mitigation feature support for SMU13.0.7 Date: Mon, 10 Jul 2023 16:36:41 +0800 Message-ID: <20230710083641.2132264-10-evan.quan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230710083641.2132264-1-evan.quan@amd.com> References: <20230710083641.2132264-1-evan.quan@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: DM6NAM11FT027:EE_|CH0PR12MB5172:EE_ X-MS-Office365-Filtering-Correlation-Id: 1403ae10-5218-4d31-6351-08db8121471d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gANj/KlIu4SSE8WWpwUeQC6tml3Dl+QzgL9ziHjR9TrU3OCRH5cmPS4alqG9AiqGyUITmZvDFNFOlJR6xZROgpyOSlcPZ/H46+EhP/IgULgC9d+V8hLByAASEfv64hLafic0aSUveilOAvnoLWWmQSYyGcLTofw7e8v2fDRX6DZgxmKyQI45HQynVD/7fyzNDQZbjboC9HaXH8WZVu4/vDjVnGOdZl+WSgk+TLTUrjMoO9gzF8+Kv2DrC8Yd2vJ9LDLBAlIiWKHJ/ev2/RIF3E0w4WLkXNYRueNgvy2yy5XfOD+OwA2M55N9Yks25XN2qOJ/f9SJghHWujjWIeDDuKD9SL6aOtbhHUe4P7xRDMTLVpPFJpAnkUYen9dHfNZCrm/lToebd1VLQftFFwwrRMyPTe4qPalR7ojpbZX8GwEHQ6KqzOkI+9NFdGffYLaEQniHlhnkZ3XpP4P8+FmjjUdtqdU8M5gQWxsJvixHz4FES3c56+lnslThV4uVR0sPddK9P8eVHE5tuC2/GvCLoGDwOWhh2kQknw9gFc3fC6URKClsgTgNBONiVg6nq5bvSEoeIzKb1g0PrQ35o7oxd847W1KFFVFfFVv7PHbjh3QpvdjwQJXn61I/3ORT8dV3jYjWHOeEl77zOfoGzM9kUB0smopsZByen8RlpBTeFiU1qUgxUisWIP2LyDzwrf9HWgm/WVLqOdCurjfKqHBnGoNQzHwj37h3Oy+xZgVHGLqb1v3Y6jUagmQKp9yosefWyMyuTTtrg2maNRiOeDp+DiTtqi/QW52viL7cPVwuRrL70ty18rQnWKNUXlQgcrZPHVmqMB0XoeOc8bAd/KR9Hg== 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)(39860400002)(136003)(376002)(396003)(451199021)(36840700001)(46966006)(40470700004)(82310400005)(6666004)(70206006)(70586007)(40460700003)(2616005)(7696005)(82740400003)(26005)(478600001)(356005)(186003)(86362001)(1076003)(36756003)(921005)(40480700001)(16526019)(81166007)(110136005)(54906003)(47076005)(41300700001)(83380400001)(316002)(44832011)(36860700001)(5660300002)(7416002)(8676002)(8936002)(426003)(2906002)(4326008)(336012)(36900700001)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 08:40:12.9288 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1403ae10-5218-4d31-6351-08db8121471d 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: DM6NAM11FT027.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5172 X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE 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-wireless@vger.kernel.org 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) -- 2.34.1