From patchwork Mon Oct 24 11:31:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8357 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp391821wru; Mon, 24 Oct 2022 04:34:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4eO8W/mWxevrFaCix9aMboBncsdzjM92p2xx6fJ9IefCv+2K+EhnlByAf4SruKN28GUs6N X-Received: by 2002:a17:903:22c1:b0:186:5f78:44c5 with SMTP id y1-20020a17090322c100b001865f7844c5mr23870308plg.16.1666611243418; Mon, 24 Oct 2022 04:34:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611243; cv=none; d=google.com; s=arc-20160816; b=V39QCMAV3LpvDLTl1SGu8RGBJ2hv3MZybWrjkrG2ytphv1rHOUHwbxpTcuBtAECZWz drOVyV/ZwW4iFBxjZpHobd57Ezsz8Y8E/LVMnNpU2lZqRsSQTYb392SUpAycVdu7dQ4C FqbIOUoiF9YU9n8615fLo+AtDJ5Adb6v0h1EU3JBbGaj7g4hujHZDV/MxMyjiVLfzJAc boI4nA4rJQ9c5jDN8DO/8iRYm4ptV66IiFdyCWJKAPV+UygCRy/M1CLTkCJjR3yhx61b caYeK21HxTNoHd1nN/EFMjToffm9HO1wKpUEHzd8g86wuc08mHc3mzYCRgC1uxepuq7z TURQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UwXdO4AJzoO29mdB7+tRRTDunT0+BfG9R1O9Jm08440=; b=MNcoCeCoVzeOi9bY2OuQ4ONQ6eFF27p/iXc0huFkzALGOj3yV3Uly+DnyK76VHMyIr wOzH2zFj0uGiDI3ZdSaT1uqeWRbegnzlNyVjp2f068Z3Ar4QfsXI0uJ6GwZ7x1I4V2pO QtcTdycX9INcqMa4/D+t+e7H62aP1NtW5jXDpXMwRV6nRTemtpDhHO1MyMiOF8JOUS/k 0rSAdWCqtZLm3Wmp+bhGQtreNRoKVCQZ4jtS2P3dutxDGbLpNrPGQgc580z4eEZ+My+L KhMM2t2A57vg6WD8AiIIj2O+Jc30ZU6yu7N6KiugMCPrYfP0PL4btZSiPROj3xoNNQno CsdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WbIK7KWO; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l10-20020a170902f68a00b001733a212ccfsi40253114plg.330.2022.10.24.04.33.50; Mon, 24 Oct 2022 04:34:03 -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=@linuxfoundation.org header.s=korg header.b=WbIK7KWO; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229891AbiJXLcv (ORCPT + 99 others); Mon, 24 Oct 2022 07:32:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230345AbiJXLc2 (ORCPT ); Mon, 24 Oct 2022 07:32:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59EA05726D; Mon, 24 Oct 2022 04:32:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EFCA161257; Mon, 24 Oct 2022 11:32:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02CFBC433C1; Mon, 24 Oct 2022 11:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611129; bh=3OvWPyMcLqjL4YA7kf1WwcIcmYqLuyCFPIa5p8Kn9iM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WbIK7KWOhP4H7BkXLbME059EM+iCt4VnSeqNe2YJFeeX7a4LzS8pFm/zL7/1hINFF 7pARmez+bCllusFy8RqMX0jSooL4vtEiP/5b9fLRBDMs/v16/isqRkCbfuV8Bssrg6 wCKFeMB2efSgFid6BR92O3QuDy+8yGg6Mi4hZjgo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , Jani Nikula Subject: [PATCH 6.0 02/20] drm/i915/bios: Use hardcoded fp_timing size for generating LFP data pointers Date: Mon, 24 Oct 2022 13:31:04 +0200 Message-Id: <20221024112934.517947061@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568551216764732?= X-GMAIL-MSGID: =?utf-8?q?1747568551216764732?= From: Ville Syrjälä commit d3a7051841f0a4bcb1ee26a1b721c6150cc4c2b1 upstream. The current scheme for generating the LFP data table pointers (when the block including them is missing from the VBT) expects the 0xffff sequence to only appear in the fp_timing terminator entries. However some VBTs also have extra 0xffff sequences elsewhere in the LFP data. When looking for the terminators we may end up finding those extra sequeneces insted, which means we deduce the wrong size for the fp_timing table. The code then notices the inconsistent looking values and gives up on the generated data table pointers, preventing us from parsing the LFP data table entirely. Let's give up on the "search for the terminators" approach and instead just hardcode the expected size for the fp_timing table. We have enough sanity checks in place to make sure we shouldn't end up parsing total garbage even if that size should change in the future (although that seems unlikely as the fp_timing and dvo_timing tables have been declared obsolete as of VBT version 229). Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6592 Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20220818192223.29881-3-ville.syrjala@linux.intel.com Reviewed-by: Jani Nikula Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/display/intel_bios.c | 46 +++++++++++------------------- 1 file changed, 18 insertions(+), 28 deletions(-) --- a/drivers/gpu/drm/i915/display/intel_bios.c +++ b/drivers/gpu/drm/i915/display/intel_bios.c @@ -337,18 +337,6 @@ static bool fixup_lfp_data_ptrs(const vo return validate_lfp_data_ptrs(bdb, ptrs); } -static const void *find_fp_timing_terminator(const u8 *data, int size) -{ - int i; - - for (i = 0; i < size - 1; i++) { - if (data[i] == 0xff && data[i+1] == 0xff) - return &data[i]; - } - - return NULL; -} - static int make_lfp_data_ptr(struct lvds_lfp_data_ptr_table *table, int table_size, int total_size) { @@ -372,11 +360,22 @@ static void next_lfp_data_ptr(struct lvd static void *generate_lfp_data_ptrs(struct drm_i915_private *i915, const void *bdb) { - int i, size, table_size, block_size, offset; - const void *t0, *t1, *block; + int i, size, table_size, block_size, offset, fp_timing_size; struct bdb_lvds_lfp_data_ptrs *ptrs; + const void *block; void *ptrs_block; + /* + * The hardcoded fp_timing_size is only valid for + * modernish VBTs. All older VBTs definitely should + * include block 41 and thus we don't need to + * generate one. + */ + if (i915->vbt.version < 155) + return NULL; + + fp_timing_size = 38; + block = find_raw_section(bdb, BDB_LVDS_LFP_DATA); if (!block) return NULL; @@ -385,17 +384,8 @@ static void *generate_lfp_data_ptrs(stru block_size = get_blocksize(block); - size = block_size; - t0 = find_fp_timing_terminator(block, size); - if (!t0) - return NULL; - - size -= t0 - block - 2; - t1 = find_fp_timing_terminator(t0 + 2, size); - if (!t1) - return NULL; - - size = t1 - t0; + size = fp_timing_size + sizeof(struct lvds_dvo_timing) + + sizeof(struct lvds_pnp_id); if (size * 16 > block_size) return NULL; @@ -413,7 +403,7 @@ static void *generate_lfp_data_ptrs(stru table_size = sizeof(struct lvds_dvo_timing); size = make_lfp_data_ptr(&ptrs->ptr[0].dvo_timing, table_size, size); - table_size = t0 - block + 2; + table_size = fp_timing_size; size = make_lfp_data_ptr(&ptrs->ptr[0].fp_timing, table_size, size); if (ptrs->ptr[0].fp_timing.table_size) @@ -428,14 +418,14 @@ static void *generate_lfp_data_ptrs(stru return NULL; } - size = t1 - t0; + size = fp_timing_size + sizeof(struct lvds_dvo_timing) + + sizeof(struct lvds_pnp_id); for (i = 1; i < 16; i++) { next_lfp_data_ptr(&ptrs->ptr[i].fp_timing, &ptrs->ptr[i-1].fp_timing, size); next_lfp_data_ptr(&ptrs->ptr[i].dvo_timing, &ptrs->ptr[i-1].dvo_timing, size); next_lfp_data_ptr(&ptrs->ptr[i].panel_pnp_id, &ptrs->ptr[i-1].panel_pnp_id, size); } - size = t1 - t0; table_size = sizeof(struct lvds_lfp_panel_name); if (16 * (size + table_size) <= block_size) { From patchwork Mon Oct 24 11:31:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8366 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp392380wru; Mon, 24 Oct 2022 04:35:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7MsUvDto4Am8aT4kXNxo6ALibpUcnAL0kNb+xDcuK9/s/iNBqXfNw9voqz5ss9LoZk4kNu X-Received: by 2002:a17:906:9b86:b0:73d:72cf:72af with SMTP id dd6-20020a1709069b8600b0073d72cf72afmr26836292ejc.440.1666611310578; Mon, 24 Oct 2022 04:35:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611310; cv=none; d=google.com; s=arc-20160816; b=GEoikOneOYYQom0TvZOvxBYRi3MJr1iro3I2Btrfn0MGRns+AaioOCi8VgsetJhlOW I3j8bgkkq36w3b9JT0zg7yA452Rs2aqmIclsI+a2/RvJGJVgYOWQpnonLOhj7A6VEyIn vsGtAlFvoSrjsGlnlvh0nk8TrezOboyNrzdEaK4D5BNYHROF4LXtGB8pjZzKkv6NaUu0 g5PsEXwkJ21MKRaeznMvNJVRCnof/dxXKCxWf0MRDRyh7aT11mMGLyMdfqDH4qVuFZVq Z/SuMg8P4J3vnp5OwRgUcr3VT+YUqV/x5a8LP70z1vQiDKtTUxb+9ExTpLOotb+L5W5u k3aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QnoK9OFL8k3+PgZW7IKC8zNd6JIbjpv1ILA5Jn20CdI=; b=D3J7kWhHK3CckclwKh01QPmKJDJ3eKDpY8ZvZG4fdMGPDbD0MyAFPqVBsUYdC0anXP 6o4UXi+GnnPUz5QzYVPJLGwjHx6CT9OQRn3NRpJuS6L6IHk1fjgEmsKfitSTTp1eKCjn UN+T+DQCuGN46MrCisd0oVrg7+lQe/CvOW1cWfh+E3xMXwhAZioH3yGY4aPsnSUeWXkx 9S8WMYoOhvpfISt0+EXihLb0tP4itf0AOXxyQeOvVErOs4RLPvYbh1UIYsgH4zoF2uwu JLcVSudONXgZ9HGAM2QPKlDt43/AIIBcoKqM+D3LsvDB1IzXi2l9BdMAZff9hF4zYVvY 4ocw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JlUlJ7UP; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh40-20020a1709076ea800b0073db353cb25si26888393ejc.869.2022.10.24.04.34.45; Mon, 24 Oct 2022 04:35:10 -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=@linuxfoundation.org header.s=korg header.b=JlUlJ7UP; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230360AbiJXLcr (ORCPT + 99 others); Mon, 24 Oct 2022 07:32:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230318AbiJXLcX (ORCPT ); Mon, 24 Oct 2022 07:32:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11C26550B9; Mon, 24 Oct 2022 04:32:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C9347B81133; Mon, 24 Oct 2022 11:32:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37FBFC433D6; Mon, 24 Oct 2022 11:32:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611134; bh=UjehT5YJLDsyySDHKVN1z6J5noOu+leeNjyGkzg8UE8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JlUlJ7UPfvgfLqVVexmtPUuaIA0/S2Psnd0rSzsOPPxM6A8uQaVOEWUiaRf9ApOZR t1Q8HDzIUJFKNSysJdZFfovYFG+27C04NkbDBiG3OknEKJqVFg2uDNFBorOzgnawGD rxiz3LoGeeU+gl/62705xAMrFReLuK2+PYyPifdY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Basavaraj Natikar , Linus Walleij , Mario Limonciello Subject: [PATCH 6.0 03/20] pinctrl: amd: change dev_warn to dev_dbg for additional feature support Date: Mon, 24 Oct 2022 13:31:05 +0200 Message-Id: <20221024112934.560703191@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568621614788552?= X-GMAIL-MSGID: =?utf-8?q?1747568621614788552?= From: Basavaraj Natikar commit 3160b37e5cb695e866e06c3fdbc385846b569294 upstream. Use dev_dbg instead of dev_warn for additional support of pinmux feature. Signed-off-by: Basavaraj Natikar Link: https://lore.kernel.org/r/20220830110525.1933198-1-Basavaraj.Natikar@amd.com Signed-off-by: Linus Walleij Cc: Mario Limonciello Signed-off-by: Greg Kroah-Hartman --- drivers/pinctrl/pinctrl-amd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/pinctrl/pinctrl-amd.c +++ b/drivers/pinctrl/pinctrl-amd.c @@ -1051,13 +1051,13 @@ static void amd_get_iomux_res(struct amd index = device_property_match_string(dev, "pinctrl-resource-names", "iomux"); if (index < 0) { - dev_warn(dev, "failed to get iomux index\n"); + dev_dbg(dev, "iomux not supported\n"); goto out_no_pinmux; } gpio_dev->iomux_base = devm_platform_ioremap_resource(gpio_dev->pdev, index); if (IS_ERR(gpio_dev->iomux_base)) { - dev_warn(dev, "Failed to get iomux %d io resource\n", index); + dev_dbg(dev, "iomux not supported %d io resource\n", index); goto out_no_pinmux; } From patchwork Mon Oct 24 11:31:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8368 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp392614wru; Mon, 24 Oct 2022 04:35:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5sZXowRq54OGxbBO72Zr7f6912FQZWaRYkm/SeUD9o6Ia0y9E4tZ7qQNnpLCpqnoZU4xLa X-Received: by 2002:aa7:cd61:0:b0:461:de5e:ba3b with SMTP id ca1-20020aa7cd61000000b00461de5eba3bmr2270726edb.74.1666611342763; Mon, 24 Oct 2022 04:35:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611342; cv=none; d=google.com; s=arc-20160816; b=ByTZq/DGzbsFbM6u8/X+yAKjW7lIfHO9eG2+rb4LsvqEwn82SO/HoW1r/FH/4XNHxp 7Qe92dUfPKL1XkOtFqUE++K/wDx7R+444UxM2VGcYl+V47MnqWxtq+BGfJJLq3X8pan2 7/MK+cafCy8QDjNwnxTfJkOWElolYJWlFGACwwozknNlTHlzM/UnIiU2wi3fmbMRigyz mJWIQoCsj5SYrFh8ENEAezv4f05OxVP25v+Ip9ZYDZbS04F2EWhWZqZuFqAosV2QqHJe EJvTRzrPZhgy/oVjDkjNVTZ3pgkX2mwT4eeMMvlW+30D9C4BgulNjUQ2/1M+8kM5HAS4 3lBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dq3XG/a/CLvH3FYJFfhp+ezWONPbYji/+vU5WI6WYyU=; b=SHKsrwSr5fWKCLsQAvJryEfOwqrbUEGr5V9WzIbI7XKWcuPx9pA7dkVYt1MeqYr4T7 /go3xdeeV994Ryf/TEGnmMoqItF/IElaGOZLTS9TQOuvNNc2OBxCWCVlAy0OA3RHB0ny afc9xDU6KjtDSuZtubk5WEb35tyhg2OhF2rcgt0aWLzIB1jTJTEANYbpFo/vX1vynO7K 7NQd9N9+Q0ZZ50MLGTQmu4JooZ78MpwGH+NBHNoTMIt8BteElMBOqMAJWRVgjq3KGtR3 ulQyYucOTzy1Qex67dB17YyXk0IDBZK1HUmHh3FnZlNS/5gUx9xU9VPbEh/DNXdqorXU /4uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MDWNg7ap; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k25-20020aa7c059000000b0044f1b7b8713si24146549edo.281.2022.10.24.04.35.18; Mon, 24 Oct 2022 04:35:42 -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=@linuxfoundation.org header.s=korg header.b=MDWNg7ap; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230236AbiJXLdF (ORCPT + 99 others); Mon, 24 Oct 2022 07:33:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230301AbiJXLcg (ORCPT ); Mon, 24 Oct 2022 07:32:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFABD6068F; Mon, 24 Oct 2022 04:32:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B1AE161251; Mon, 24 Oct 2022 11:32:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8121C433D6; Mon, 24 Oct 2022 11:32:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611137; bh=nInlbStH9a5FQ1hxPfb1aIWblv3RMo5lp/f/c/5RMyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MDWNg7apRfJPOnTX6yzSJszcqk5EkYrL+IQ4lrRsmrxO1HwPdT4eK/VFBt6/1BoBw QN6c1Y9oSaS62mpPmpO2rlWJAopO2GEVleE0o4qPcBXdxt916lZDOEUSTE20dS3ddC syXZRCV4nP7/EpUhvRT7wCBRPROogjsiscHkaR2g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" , Chen Yu Subject: [PATCH 6.0 04/20] thermal: intel_powerclamp: Use first online CPU as control_cpu Date: Mon, 24 Oct 2022 13:31:06 +0200 Message-Id: <20221024112934.600700322@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568655279769275?= X-GMAIL-MSGID: =?utf-8?q?1747568655279769275?= From: Rafael J. Wysocki commit 4bb7f6c2781e46fc5bd00475a66df2ea30ef330d upstream. Commit 68b99e94a4a2 ("thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash") fixed an issue related to using smp_processor_id() in preemptible context by replacing it with a pair of get_cpu()/put_cpu(), but what is needed there really is any online CPU and not necessarily the one currently running the code. Arguably, getting the one that's running the code in there is confusing. For this reason, simply give the control CPU role to the first online one which automatically will be CPU0 if it is online, so one check can be dropped from the code for an added benefit. Link: https://lore.kernel.org/linux-pm/20221011113646.GA12080@duo.ucw.cz/ Fixes: 68b99e94a4a2 ("thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash") Signed-off-by: Rafael J. Wysocki Reviewed-by: Chen Yu Signed-off-by: Greg Kroah-Hartman --- drivers/thermal/intel/intel_powerclamp.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/drivers/thermal/intel/intel_powerclamp.c +++ b/drivers/thermal/intel/intel_powerclamp.c @@ -531,11 +531,7 @@ static int start_power_clamp(void) cpus_read_lock(); /* prefer BSP */ - control_cpu = 0; - if (!cpu_online(control_cpu)) { - control_cpu = get_cpu(); - put_cpu(); - } + control_cpu = cpumask_first(cpu_online_mask); clamping = true; schedule_delayed_work(&poll_pkg_cstate_work, 0); From patchwork Mon Oct 24 11:31:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8369 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp392639wru; Mon, 24 Oct 2022 04:35:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4UJiv88pAhfES5/MU/KbvrnlabWPbkcIGBsE/OEDPRT3mh+3cdfHt+u1hjJ1RieA8jL7I5 X-Received: by 2002:a63:1861:0:b0:462:4961:9a8f with SMTP id 33-20020a631861000000b0046249619a8fmr28219438pgy.372.1666611348812; Mon, 24 Oct 2022 04:35:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611348; cv=none; d=google.com; s=arc-20160816; b=UOIpFpgTVJ9hpm2+log5QRg9fJSdFhUFH/+M9HPjXx8jW0G3SzZvLgISrR1vDbVv0j CtrYZlw/BgvJneM5EMhTwlGQ/Qpd/DMMngu6wjsGx6wDNWKhO+AAfxH/hJ2TCQm8+9iU 5EjW7UrW0ZfSlsWj0jgJqJyD7Tr3xLwZOAT85splzxv3eT6x11Ht/Mwj0s+njYLkAdKB DIDUXZtzduPfhjabhfnEeXRxC6K2IOVVNb0zneMPBS9aMxgju2zR6Si/6lge2oKTtYf5 ukyE/hnFm2fyzE+Lm/j66syfgTMMl/4B42zxyAQS4EnnwCry1mj/t9qEzXsd3uRx3763 QRdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=maX5YDzb2TU5F7jNzZEuECzFn0KDrCvEWjVDLfbsWVE=; b=x/IML8z5viapDjK1zAs6kKFz4fCVrRAsfzZxOBA2rzpeN0zNAXk+KMhb3DvPQObbjY tsl3WiwFKXWJ2a0zaYJcgMioForvb4akxWdgvysSR2h6D+PZxqSOldDXqvifvIJBLqMT EC6EcAo0NJk10zcvAeS5KXrXJ++iQ6QLyNqV0uIdHwmZ/i89vKj3l7urKwFpK0GQ/C1O zvsQl8NMJykg6IEvy0+wTu8pKG/AFaaO47z4MKIHY90CdQQhLabMRmFQy+XAGdlyZupu 2rSr7MJn9gmJNoEdjbnHF8JBrhgWuO+AuPqJ5JOSe6Qi6n8mX9GTrHNKxxldXNN8DNlJ iHUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xu4Yt9bh; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h71-20020a63834a000000b0046efd063864si3507780pge.109.2022.10.24.04.35.35; Mon, 24 Oct 2022 04:35:48 -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=@linuxfoundation.org header.s=korg header.b=Xu4Yt9bh; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229542AbiJXLdY (ORCPT + 99 others); Mon, 24 Oct 2022 07:33:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229904AbiJXLci (ORCPT ); Mon, 24 Oct 2022 07:32:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51F866173F; Mon, 24 Oct 2022 04:32:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5B2FE6125A; Mon, 24 Oct 2022 11:32:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C1EFC433C1; Mon, 24 Oct 2022 11:32:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611139; bh=ls/FY9lIc8Kn+4qnUhrnD5jdUO7ASdakq191rkjNnn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xu4Yt9bh+wGUtgjjFC+/H9HxJuAVvvixqq7HBKJW5TjjMzRVjgyOPRNQ/XHmFcVgh B1Ri1K3OWKnZTD4SsFSnlBeSYUGqymDsa+m+g597aXe1k69XlJVt/XzmdC0E3DfYiY JzlfsJ9OjD7KSurg7cP/piqqL+2LyYUDABkYAyro= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 05/20] io_uring/net: fail zc send when unsupported by socket Date: Mon, 24 Oct 2022 13:31:07 +0200 Message-Id: <20221024112934.634360980@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568661623201530?= X-GMAIL-MSGID: =?utf-8?q?1747568661623201530?= From: Pavel Begunkov commit edf81438799ccead7122948446d7e44b083e788d upstream. If a protocol doesn't support zerocopy it will silently fall back to copying. This type of behaviour has always been a source of troubles so it's better to fail such requests instead. Cc: # 6.0 Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/2db3c7f16bb6efab4b04569cd16e6242b40c5cb3.1666346426.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/net.c | 2 ++ 1 file changed, 2 insertions(+) --- a/io_uring/net.c +++ b/io_uring/net.c @@ -1001,6 +1001,8 @@ int io_send_zc(struct io_kiocb *req, uns sock = sock_from_file(req->file); if (unlikely(!sock)) return -ENOTSOCK; + if (!test_bit(SOCK_SUPPORT_ZC, &sock->flags)) + return -EOPNOTSUPP; msg.msg_name = NULL; msg.msg_control = NULL; From patchwork Mon Oct 24 11:31:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8359 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp391897wru; Mon, 24 Oct 2022 04:34:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4vUR2KS5HhGEvG2z0fO7KspogpWngm5hoDIvS2cLajdukJbzkSp0jBNzxt7J/bOiErHa70 X-Received: by 2002:a05:6a02:47:b0:46e:ea48:9543 with SMTP id az7-20020a056a02004700b0046eea489543mr8304159pgb.6.1666611252888; Mon, 24 Oct 2022 04:34:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611252; cv=none; d=google.com; s=arc-20160816; b=DoeOyjPTPY10e5h0CFeJqpFoQrynafiilM8d9sQsZgwRPOibv5Fss1+QGCqcBTFvpe ouP0ZrjaAxPYQSvrJ4n5Ho1PMCHrJXZ2zxTNTD9twIZ2CBdTliWEJsQSh4vTyOeiCaxj KUTSK/0ehk+7v91AwO7avXU4tW/310Nq+clKCMcvyzEa415MGQKivdYZSnnP4iSxBfN1 aHetJ4paEX7qJpJcMFR7wfmZvW05Ozyt5daiobftZeXmvi9Pww9ncUy2zgrElvNVFIe6 04o0ydat2dO1aQllC0x7XlbzmShpgHvQf8bkSIC9VCBbtIMrSVFMthuSIh7z0eaQyWy6 fM1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eogU5n7fO6aW2CeKTrpb9w+1VbMIkfA5d9dN6SBK66Q=; b=cOV7vHt5NWrWiO9NBxNpZafAP07Q4fjnRox3G1SksCHjL6TvkhdwRg4zabP0W7o9JA tRByngE6YT2MN55RtvxK84weV0UmPKXlo6epGKzJW3OxRVN4MH3r+ylbvEWo23Yd6Q0a gweOkDLNhpyAvQS7PeMsJ592JTMSva4q1LUmEJlh/FzxqHzubzjE/Ca5U71Y0yk0bkuP 1OuKGGObMylqMXrSC5h4oZlh0Hd3sBqqN8LqNru9kD7kWU+yXOBSWnPlsq9Ymiey+vfT qH+zyTh2mT7ldfXCAI61FQS94JruCgh14Dbs7bqaYEMBhlzOmcL/QqX8fn75JX4GZ6Bl BYlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YFE4f4z3; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 5-20020a631145000000b004428327e6dfsi35683115pgr.174.2022.10.24.04.33.59; Mon, 24 Oct 2022 04:34:12 -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=@linuxfoundation.org header.s=korg header.b=YFE4f4z3; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230302AbiJXLdR (ORCPT + 99 others); Mon, 24 Oct 2022 07:33:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230312AbiJXLch (ORCPT ); Mon, 24 Oct 2022 07:32:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D25C550BC; Mon, 24 Oct 2022 04:32:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B64E0B81144; Mon, 24 Oct 2022 11:32:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10C28C433D6; Mon, 24 Oct 2022 11:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611142; bh=ANMp6hiyB/8WBsFZyh1qIrbFk27cX/q2qOwTak6f1TY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YFE4f4z3kvEh6m/8qyTwGapyG64QVKXpkvumgx3yhcr5w8ikLIBz3LaSlcwOx7l9D FN9TpmC6N425hMxpoJPsJpKfYmXGJYdl7ob5/OUWV+u5UQw1DDjnHINh6XbpZ4RySs 2e9PT378GmIWiDXAMEHEF4L0OVpT+Y9NzX8Bce7o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roderick Colenbrander , Benjamin Tissoires Subject: [PATCH 6.0 06/20] HID: playstation: stop DualSense output work on remove. Date: Mon, 24 Oct 2022 13:31:08 +0200 Message-Id: <20221024112934.685810726@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568561337633497?= X-GMAIL-MSGID: =?utf-8?q?1747568561337633497?= From: Roderick Colenbrander commit 182934a1e93b17f4edf71f4fcc8d19b19a6fe67a upstream. Ensure we don't schedule any new output work on removal and wait for any existing work to complete. If we don't do this e.g. rumble work can get queued during deletion and we trigger a kernel crash. Signed-off-by: Roderick Colenbrander CC: stable@vger.kernel.org Signed-off-by: Benjamin Tissoires Link: https://lore.kernel.org/r/20221010212313.78275-2-roderick.colenbrander@sony.com Signed-off-by: Greg Kroah-Hartman --- drivers/hid/hid-playstation.c | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) --- a/drivers/hid/hid-playstation.c +++ b/drivers/hid/hid-playstation.c @@ -46,6 +46,7 @@ struct ps_device { uint32_t fw_version; int (*parse_report)(struct ps_device *dev, struct hid_report *report, u8 *data, int size); + void (*remove)(struct ps_device *dev); }; /* Calibration data for playstation motion sensors. */ @@ -174,6 +175,7 @@ struct dualsense { struct led_classdev player_leds[5]; struct work_struct output_worker; + bool output_worker_initialized; void *output_report_dmabuf; uint8_t output_seq; /* Sequence number for output report. */ }; @@ -299,6 +301,7 @@ static const struct {int x; int y; } ps_ {0, 0}, }; +static inline void dualsense_schedule_work(struct dualsense *ds); static void dualsense_set_lightbar(struct dualsense *ds, uint8_t red, uint8_t green, uint8_t blue); /* @@ -792,6 +795,7 @@ err_free: return ret; } + static int dualsense_get_firmware_info(struct dualsense *ds) { uint8_t *buf; @@ -881,7 +885,7 @@ static int dualsense_player_led_set_brig ds->update_player_leds = true; spin_unlock_irqrestore(&ds->base.lock, flags); - schedule_work(&ds->output_worker); + dualsense_schedule_work(ds); return 0; } @@ -925,6 +929,16 @@ static void dualsense_init_output_report } } +static inline void dualsense_schedule_work(struct dualsense *ds) +{ + unsigned long flags; + + spin_lock_irqsave(&ds->base.lock, flags); + if (ds->output_worker_initialized) + schedule_work(&ds->output_worker); + spin_unlock_irqrestore(&ds->base.lock, flags); +} + /* * Helper function to send DualSense output reports. Applies a CRC at the end of a report * for Bluetooth reports. @@ -1085,7 +1099,7 @@ static int dualsense_parse_report(struct spin_unlock_irqrestore(&ps_dev->lock, flags); /* Schedule updating of microphone state at hardware level. */ - schedule_work(&ds->output_worker); + dualsense_schedule_work(ds); } ds->last_btn_mic_state = btn_mic_state; @@ -1200,10 +1214,22 @@ static int dualsense_play_effect(struct ds->motor_right = effect->u.rumble.weak_magnitude / 256; spin_unlock_irqrestore(&ds->base.lock, flags); - schedule_work(&ds->output_worker); + dualsense_schedule_work(ds); return 0; } +static void dualsense_remove(struct ps_device *ps_dev) +{ + struct dualsense *ds = container_of(ps_dev, struct dualsense, base); + unsigned long flags; + + spin_lock_irqsave(&ds->base.lock, flags); + ds->output_worker_initialized = false; + spin_unlock_irqrestore(&ds->base.lock, flags); + + cancel_work_sync(&ds->output_worker); +} + static int dualsense_reset_leds(struct dualsense *ds) { struct dualsense_output_report report; @@ -1240,7 +1266,7 @@ static void dualsense_set_lightbar(struc ds->lightbar_blue = blue; spin_unlock_irqrestore(&ds->base.lock, flags); - schedule_work(&ds->output_worker); + dualsense_schedule_work(ds); } static void dualsense_set_player_leds(struct dualsense *ds) @@ -1263,7 +1289,7 @@ static void dualsense_set_player_leds(st ds->update_player_leds = true; ds->player_leds_state = player_ids[player_id]; - schedule_work(&ds->output_worker); + dualsense_schedule_work(ds); } static struct ps_device *dualsense_create(struct hid_device *hdev) @@ -1302,7 +1328,9 @@ static struct ps_device *dualsense_creat ps_dev->battery_capacity = 100; /* initial value until parse_report. */ ps_dev->battery_status = POWER_SUPPLY_STATUS_UNKNOWN; ps_dev->parse_report = dualsense_parse_report; + ps_dev->remove = dualsense_remove; INIT_WORK(&ds->output_worker, dualsense_output_worker); + ds->output_worker_initialized = true; hid_set_drvdata(hdev, ds); max_output_report_size = sizeof(struct dualsense_output_report_bt); @@ -1470,6 +1498,9 @@ static void ps_remove(struct hid_device ps_devices_list_remove(dev); ps_device_release_player_id(dev); + if (dev->remove) + dev->remove(dev); + hid_hw_close(hdev); hid_hw_stop(hdev); } From patchwork Mon Oct 24 11:31:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8360 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp392092wru; Mon, 24 Oct 2022 04:34:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4FCnaRnxAurr9j95fshu8wR+alg9YjeecZ9xCG9fV9KNujx0cwK3zx4I7dbieA4cvUYx4+ X-Received: by 2002:a17:903:41ca:b0:186:a68e:c06d with SMTP id u10-20020a17090341ca00b00186a68ec06dmr5130509ple.61.1666611276638; Mon, 24 Oct 2022 04:34:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611276; cv=none; d=google.com; s=arc-20160816; b=gU5GPpFrW5x0hrrnFC4DuVXHEa4bOpCmM2iJx6ewJgbO86cfXi1GxEKkV/d7ZtCwxF L3IIj0JwygvZpMN5VRCyyCd02EIcQEY0aTy+jEyTBOFZXyMlIN9JG8Zk2PyU55drKwkz WktJn2x0k9E6eGRVW0Qzx/71YSDrSIN7Uce/4Dp6+I1ylTfKL4EIHmxWvG8DXbxbm/Kd yCxCm+ARmBl+XPNKtfsXjdK1fBgHAgEBNCuRlCRun8gwAqcev+Fotc+wgcLznB751eG7 xallI8wpAZYvH+x1fx0W2TQQWsvEifNwr9hd2lL6w8XXqyuDoqp+BuWCmjMtxtLlOV9c dSxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EPrw8z6el89wn+XhTzoKo/AWaysCiXf+94hnEd+cTxw=; b=KT6faZx7JiwIQ6xk19f7ts6NMry2x08wKk6LJQaTTcBCRK6W6dmULr+uijT8sheY/c O5iakXESYZ7xvgOfKleQFPOIg/CbcbNKY9YFqOsFETn0UW9ioKPlwS969BidUAeF6Z0c 3Iw9kcDuwdSU6vX6wFYr00kqyD+L2ALlYOcgVHWqvuEKa6TNVWDzFLWpm4a6+x5l8YY4 zP64oCXd5wxd7k0gPnEjWBe+HVD5F0MuMSNrdHxI65L/jQ3C95j04Ruxb8Q2Wtmtw9HU iKwf7Z4lLatkKC7dGbSsTrgooG780BCf/qpimJwaCv7txQsY2j03OZNUHytbS1shy2tN SwVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xGD64d69; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mu15-20020a17090b388f00b0020c8e9efc7bsi9615341pjb.47.2022.10.24.04.34.22; Mon, 24 Oct 2022 04:34:36 -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=@linuxfoundation.org header.s=korg header.b=xGD64d69; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230381AbiJXLdj (ORCPT + 99 others); Mon, 24 Oct 2022 07:33:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230386AbiJXLco (ORCPT ); Mon, 24 Oct 2022 07:32:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55B9257566; Mon, 24 Oct 2022 04:32:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5D64AB81141; Mon, 24 Oct 2022 11:32:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A953AC433C1; Mon, 24 Oct 2022 11:32:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611145; bh=KewVzdkDE/IMXnwzEyL8hV5FTZmJHOyqSi6AKVE3M4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xGD64d6961VldCdS6WSxQTSM0NXCtLHKyNTjmQ0B+ACAsTAmuNiEWkQZme1Ruq0Na zxFEnZskvTLKNvgrf7P+I/8eSAhgJeyBlMzzw0nG+cOcwFrcHQ1QPBjnk65DAfHMFT ta/SJhnrTZ5+CnsIT2oO4uWQC7iZVnNEPvC7/J0w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roderick Colenbrander , Benjamin Tissoires Subject: [PATCH 6.0 07/20] HID: playstation: add initial DualSense Edge controller support Date: Mon, 24 Oct 2022 13:31:09 +0200 Message-Id: <20221024112934.735209336@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568585795029219?= X-GMAIL-MSGID: =?utf-8?q?1747568585795029219?= From: Roderick Colenbrander commit b8a968efab301743fd659b5649c5d7d3e30e63a6 upstream. Provide initial support for the DualSense Edge controller. The brings support up to the level of the original DualSense, but won't yet provide support for new features (e.g. reprogrammable buttons). Signed-off-by: Roderick Colenbrander CC: stable@vger.kernel.org Signed-off-by: Benjamin Tissoires Link: https://lore.kernel.org/r/20221010212313.78275-3-roderick.colenbrander@sony.com Signed-off-by: Greg Kroah-Hartman --- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-playstation.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -1142,6 +1142,7 @@ #define USB_DEVICE_ID_SONY_PS4_CONTROLLER_2 0x09cc #define USB_DEVICE_ID_SONY_PS4_CONTROLLER_DONGLE 0x0ba0 #define USB_DEVICE_ID_SONY_PS5_CONTROLLER 0x0ce6 +#define USB_DEVICE_ID_SONY_PS5_CONTROLLER_2 0x0df2 #define USB_DEVICE_ID_SONY_MOTION_CONTROLLER 0x03d5 #define USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER 0x042f #define USB_DEVICE_ID_SONY_BUZZ_CONTROLLER 0x0002 --- a/drivers/hid/hid-playstation.c +++ b/drivers/hid/hid-playstation.c @@ -1467,7 +1467,8 @@ static int ps_probe(struct hid_device *h goto err_stop; } - if (hdev->product == USB_DEVICE_ID_SONY_PS5_CONTROLLER) { + if (hdev->product == USB_DEVICE_ID_SONY_PS5_CONTROLLER || + hdev->product == USB_DEVICE_ID_SONY_PS5_CONTROLLER_2) { dev = dualsense_create(hdev); if (IS_ERR(dev)) { hid_err(hdev, "Failed to create dualsense.\n"); @@ -1508,6 +1509,8 @@ static void ps_remove(struct hid_device static const struct hid_device_id ps_devices[] = { { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS5_CONTROLLER) }, { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS5_CONTROLLER) }, + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS5_CONTROLLER_2) }, + { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS5_CONTROLLER_2) }, { } }; MODULE_DEVICE_TABLE(hid, ps_devices); From patchwork Mon Oct 24 11:31:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8361 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp392226wru; Mon, 24 Oct 2022 04:34:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7eaypGIYWGLrtQKwWl0zGPyny95lPvNJdADB8H7oZPjeQaLdVwxCNF/A/FRcmEBDpm9x7p X-Received: by 2002:a17:902:c40b:b0:17f:9636:9014 with SMTP id k11-20020a170902c40b00b0017f96369014mr32496790plk.150.1666611291874; Mon, 24 Oct 2022 04:34:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611291; cv=none; d=google.com; s=arc-20160816; b=fCqQBhncfxOliNni5Pn76dhZDqEe8qWly5fxB8zVHgXaC5B6Xl+cB1iSRiMiLQ/jgC r39R8XyS58Qp/xDlnHbYKywwGc/r2ReDMdaH/P27FdXD7SLPDll3fenFwOwqEeoo0ddJ fkoEDoQGug01WgtjZNShGVsIDvyak8yjykV/S++1bWH50Xh+ErvJa9tSCiEWtvdfCVGi Y1WlNNL1DmZ86qhGdZCirBnJondg1U0z6hZiC1uQ7n4mTELRaeZrdVWT83YIxI0iPijs vjCMMoSkckZRoUXlthaty3FWjmp2QQbmPSsn7JZg0lNZgD/hZFRyGrbNQMtsSff6CpxC T9aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OtVcI89N9KGY5HFgJRUhtOfsKEFqBbWg6zRX7f8J5pU=; b=PTtaI7o9Q02JVcAztiz2hI1Fvk6Omsupu/yIDoX6MeRk1BSwqjTsNFQt896ZKVWuKP 1PU1CqwmDo3wDV7TyMQ6WXputE8ML4mNUuJqnSOS8EZZKtWbjxgHXFcDeVwSvgo99jz+ 2DJkhXjkNKriYEIHlFZ7DnbJe717VmiDosUwmf++aan2mZDJbLlJ8aEWtLnpBEz0P4vL T4+uRlxXiczelwoNLLaRsOQZJirzHe4Qo+JD9hHUaGWtKl6nkEw+VRNvOrRoVRyEfTGs FMANb8uPlnMbXafJTJdCOnoya3XVIKt0qOd4FG828nuyjaUpaJWzilf3PKK3mSWc4+XP tpUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G6pUeuDB; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f32-20020a635560000000b0045b00922ba5si36903510pgm.871.2022.10.24.04.34.38; Mon, 24 Oct 2022 04:34:51 -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=@linuxfoundation.org header.s=korg header.b=G6pUeuDB; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230072AbiJXLdn (ORCPT + 99 others); Mon, 24 Oct 2022 07:33:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230357AbiJXLcq (ORCPT ); Mon, 24 Oct 2022 07:32:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC78563D03; Mon, 24 Oct 2022 04:32:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 20BE0B81133; Mon, 24 Oct 2022 11:32:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55457C433D6; Mon, 24 Oct 2022 11:32:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611147; bh=lmA2M8bscm+/EI8CH4eNhJyaj0shg8stUorn666SD8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G6pUeuDBZKi3zSZKvdL5WBJl/gi4EMJlHs5JT4z6mbqK8HAlvxtOxIg42v5sVofQQ fRRnijGRWmvzYJEVkArqbJhXGeKXikGxWyPVkex7rpz9raWFSZLbXcnWPGIobq/2Ej vTxW5C7jzkFrNOT6aPB4HpJW6Fs7FNKAONdsW7zY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jakub Kicinski , Jens Axboe Subject: [PATCH 6.0 08/20] net: flag sockets supporting msghdr originated zerocopy Date: Mon, 24 Oct 2022 13:31:10 +0200 Message-Id: <20221024112934.784075701@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568602002730821?= X-GMAIL-MSGID: =?utf-8?q?1747568602002730821?= From: Pavel Begunkov commit e993ffe3da4bcddea0536b03be1031bf35cd8d85 upstream. We need an efficient way in io_uring to check whether a socket supports zerocopy with msghdr provided ubuf_info. Add a new flag into the struct socket flags fields. Cc: # 6.0 Signed-off-by: Pavel Begunkov Acked-by: Jakub Kicinski Link: https://lore.kernel.org/r/3dafafab822b1c66308bb58a0ac738b1e3f53f74.1666346426.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- include/linux/net.h | 1 + net/ipv4/tcp.c | 1 + net/ipv4/udp.c | 1 + 3 files changed, 3 insertions(+) --- a/include/linux/net.h +++ b/include/linux/net.h @@ -41,6 +41,7 @@ struct net; #define SOCK_NOSPACE 2 #define SOCK_PASSCRED 3 #define SOCK_PASSSEC 4 +#define SOCK_SUPPORT_ZC 5 #ifndef ARCH_HAS_SOCKET_TYPES /** --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -457,6 +457,7 @@ void tcp_init_sock(struct sock *sk) WRITE_ONCE(sk->sk_sndbuf, READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[1])); WRITE_ONCE(sk->sk_rcvbuf, READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[1])); + set_bit(SOCK_SUPPORT_ZC, &sk->sk_socket->flags); sk_sockets_allocated_inc(sk); } EXPORT_SYMBOL(tcp_init_sock); --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -1620,6 +1620,7 @@ int udp_init_sock(struct sock *sk) { skb_queue_head_init(&udp_sk(sk)->reader_queue); sk->sk_destruct = udp_destruct_sock; + set_bit(SOCK_SUPPORT_ZC, &sk->sk_socket->flags); return 0; } EXPORT_SYMBOL_GPL(udp_init_sock); From patchwork Mon Oct 24 11:31:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8362 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp392248wru; Mon, 24 Oct 2022 04:34:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6JWFmtc2Q+/bXVPcJcAblcBmb+/LDFcvy1eZUfjNYHcFHcVzlvXRbIe/K/RFnupQR1lCwu X-Received: by 2002:a17:90a:e10:b0:211:9e6a:a099 with SMTP id v16-20020a17090a0e1000b002119e6aa099mr26895750pje.27.1666611294460; Mon, 24 Oct 2022 04:34:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611294; cv=none; d=google.com; s=arc-20160816; b=f/hIjUx2hq/KwQvLA5plx0kQxx8A02gEweNfTQhMVV1nxYzHECstERCObe90pTp3T0 nlXLy4NzvPTljEzzi5XwcmY425HFsi48YLGYbI8e73Dq0dN+IQD5gEK/2vf46j/2ZPek ZN0VIyIlwR8l5xtODrT3UQS7hTpaYtHJwf4nyXIM0rAM1p4ZHYxaoVJmNT9W/2/w7dcj Jchlxe8Bvq9yBGfdgzRy9XXmXxOKaqz2F8VCyEN1gPZmiCMolT7URLqOFvORDro4hVZM J3dWqedNtWuJNTX+wRMhKG5Wkh5H1c3t8Tz8+HTNVolqMZ0jyBT3ssCmzNSwaO94rzQD 1QIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Rxi5wQMHFDCfDoqoiPzh2ZKzF+CkucYWZw+cBP+ADEY=; b=DIIaarX7F/0HoFutFbB6p23psGz0f5BLkiClN25ERma91dpmfMRG5Lb9c3cnp4MY8V OYEqoD1977NiFlercVj3BeTaR9821zzPiuK8V2FgEf7SELGCbza29LagwClWoThF55mB iZhKSoqT9B8+LLLHBubLyj6kDR3hGT8lVOpY8n0uJYAp0CqaaCH+toJcE3odEsseSDBx /MkUzCozrZ1xBBeGVt1ZyJ7Sq+BE1CubWI8vhLha6JbpojVRqSBHCCG6H2np8bcGfHHO QchvYzP4P7M+0XJriDKNd/nRHpgwwqklvUh2Yvolob27QRHqn0P+csskcz8dV8lZ2x+6 4RDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SwrOAyZx; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w18-20020a056a0014d200b00542deddc4e0si35197390pfu.46.2022.10.24.04.34.40; Mon, 24 Oct 2022 04:34:54 -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=@linuxfoundation.org header.s=korg header.b=SwrOAyZx; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229974AbiJXLdr (ORCPT + 99 others); Mon, 24 Oct 2022 07:33:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230353AbiJXLcq (ORCPT ); Mon, 24 Oct 2022 07:32:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C539A5C9EE; Mon, 24 Oct 2022 04:32:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DEB1A61259; Mon, 24 Oct 2022 11:32:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0D27C433C1; Mon, 24 Oct 2022 11:32:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611150; bh=rsXY7MlL90l2tYjwIfEorWd85y0jhMH3uOXqrnAp2YM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SwrOAyZx/oEI3Di8ApVEhL2DCmPNqkv/IOZkj2mSRhf/AyA2bK9o4zsUhZvd8OWkZ 3TJMoTrijfNSxhlA8mx7bnVtIzNHInxQ32tIroAzSADgqG9wTM7P4Gvm30CpTC8x3K 0do68CAMWbq3mQ6c+0hke5xUwcGBlPG5Uu4zN3YM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evan Quan , Hawking Zhang , Lijo Lazar , Alex Deucher Subject: [PATCH 6.0 09/20] drm/amd/pm: fulfill SMU13.0.7 cstate control interface Date: Mon, 24 Oct 2022 13:31:11 +0200 Message-Id: <20221024112934.822526084@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568604650306612?= X-GMAIL-MSGID: =?utf-8?q?1747568604650306612?= From: Evan Quan commit ba2f09960e75accf757ed12b4ef61409dcc97df8 upstream. Fulfill the functionality for cstate control. Signed-off-by: Evan Quan Reviewed-by: Hawking Zhang Reviewed-by: Lijo Lazar Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org # 6.0.x Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- 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 @@ -121,6 +121,7 @@ static struct cmn2asic_msg_mapping smu_v MSG_MAP(Mode1Reset, PPSMC_MSG_Mode1Reset, 0), MSG_MAP(PrepareMp1ForUnload, PPSMC_MSG_PrepareMp1ForUnload, 0), MSG_MAP(SetMGpuFanBoostLimitRpm, PPSMC_MSG_SetMGpuFanBoostLimitRpm, 0), + MSG_MAP(DFCstateControl, PPSMC_MSG_SetExternalClientDfCstateAllow, 0), }; static struct cmn2asic_mapping smu_v13_0_7_clk_map[SMU_CLK_COUNT] = { @@ -1587,6 +1588,16 @@ static bool smu_v13_0_7_is_mode1_reset_s return true; } + +static int smu_v13_0_7_set_df_cstate(struct smu_context *smu, + enum pp_df_cstate state) +{ + return smu_cmn_send_smc_msg_with_param(smu, + SMU_MSG_DFCstateControl, + state, + NULL); +} + 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, @@ -1649,6 +1660,7 @@ static const struct pptable_funcs smu_v1 .mode1_reset_is_support = smu_v13_0_7_is_mode1_reset_supported, .mode1_reset = smu_v13_0_mode1_reset, .set_mp1_state = smu_v13_0_7_set_mp1_state, + .set_df_cstate = smu_v13_0_7_set_df_cstate, }; void smu_v13_0_7_set_ppt_funcs(struct smu_context *smu) From patchwork Mon Oct 24 11:31:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8351 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp391633wru; Mon, 24 Oct 2022 04:33:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7L2WZErS7k6xRcHcm94tKwaqEuYf/EDbD2Rt5Joae/dEWJ33JqA7FoqzCsBeT1lLxEVVNN X-Received: by 2002:a17:902:70c4:b0:17c:f9fe:3200 with SMTP id l4-20020a17090270c400b0017cf9fe3200mr33297702plt.1.1666611215862; Mon, 24 Oct 2022 04:33:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611215; cv=none; d=google.com; s=arc-20160816; b=vQiPQ8Q2M6WMma4vOHHubmcon0lwrgLiIewQqmLuDo0FuBRxyNhAQeeV9Nd5ijC3nP vFgZr3MRuMSQ0x3BKdeL1DDSmNk7s4n+FdYDM6ovw6npfBsLJTfHRaeyYh5SoI3A0yVR NPTO3brbj3H7QqVCR5FRhuJUg4dlFRLjsIhMpbMYfTpJYVN33ZxEpxHtsRgaI3RCJE9s W9dZR1zKowK6JT1gKnHOFJa2iZkfDQRYh4wxuzgSrXehvIvfQTtSIQkA5jUPYsYLoXyZ 14J4YP3wXb1QVMxWVtifIXGPb64MD4uRBrJhvk9ipvC4nNm97fGiwV570gk3blaimE5g w24w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=plCYhO63sthJyhbh9/pwmrO/cY9IY+zPjIJS6V1BWGI=; b=pW66z+D5FUYixCOdY7PKpR5mGSxK12rnzYWmYQvJAMzIUivEgxSD6wboqOxBPMU2xr eZ5/S5A5x2/X/UsJ2Rm3wphIlk74L5p9rUSaupDo3shs5GSEFJ2EO2G1qg+/C93bOGpW OSqwLT9MQupulhSJ2QJ98MWFvPD/46obGzOK+bE5lcVEIiCD44Q21oYwCELrUEaByef3 kfkwWAEbPhdqoASKAKlGODT0b0oBbyMnsjcf9YcU4rNrvFhfCngSASQAlzvc1lZ9sWZq l4PFg0y9Dst5zC1warWFo5NwPmuQs7ykf9oCgDTyBygy/nN4lgJDvueyvFtyTj3exYK+ lNGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="xU8/CKyF"; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f32-20020a635560000000b0045b00922ba5si36903510pgm.871.2022.10.24.04.33.21; Mon, 24 Oct 2022 04:33:35 -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=@linuxfoundation.org header.s=korg header.b="xU8/CKyF"; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230248AbiJXLbs (ORCPT + 99 others); Mon, 24 Oct 2022 07:31:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbiJXLbq (ORCPT ); Mon, 24 Oct 2022 07:31:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0A56550B9; Mon, 24 Oct 2022 04:31:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5467EB81141; Mon, 24 Oct 2022 11:31:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B232DC433D6; Mon, 24 Oct 2022 11:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611103; bh=IEETuX4R+dpSD+TEwta3OzbvGu+p4Sl2EFd1G8lCODM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xU8/CKyFxT1jUZ3CyenRTfgFeOE3wbLQ1SvKZL9nXDDJVQOn43fWxykd0HyfIrBto AIv6jGiE7D6yG/1ryDSIyGV3YF2HtxGANZ0HtQYigMaBwfrGDmvc7dHo5Lf3AL5XIC KoDr46t8vsFqa66HkPcce9v+CN3tIojZSMd1VUMg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tim Huang , Mario Limonciello , Alex Deucher Subject: [PATCH 6.0 10/20] drm/amd/pm: add SMU IP v13.0.4 IF version define to V7 Date: Mon, 24 Oct 2022 13:31:12 +0200 Message-Id: <20221024112934.861911080@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568522167039390?= X-GMAIL-MSGID: =?utf-8?q?1747568522167039390?= From: Tim Huang commit 31c261a7ffb8d5bba8144e2d43db304f2bc7e81a upstream. The pmfw has changed the driver interface version, so keep same with the fw. Signed-off-by: Tim Huang Reviewed-by: Mario Limonciello Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org # 6.0.x Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h +++ b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h @@ -28,7 +28,7 @@ #define SMU13_DRIVER_IF_VERSION_INV 0xFFFFFFFF #define SMU13_DRIVER_IF_VERSION_YELLOW_CARP 0x04 #define SMU13_DRIVER_IF_VERSION_ALDE 0x08 -#define SMU13_DRIVER_IF_VERSION_SMU_V13_0_4 0x05 +#define SMU13_DRIVER_IF_VERSION_SMU_V13_0_4 0x07 #define SMU13_DRIVER_IF_VERSION_SMU_V13_0_5 0x04 #define SMU13_DRIVER_IF_VERSION_SMU_V13_0_0 0x30 #define SMU13_DRIVER_IF_VERSION_SMU_V13_0_7 0x2C From patchwork Mon Oct 24 11:31:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8352 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp391640wru; Mon, 24 Oct 2022 04:33:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4F29VWOYPxVPCg4M0RWchhnbrEZN4f1vS2gO8MJtNWrHu7kMYNxkFqFTUdDOKUksxr8a76 X-Received: by 2002:a17:90a:6347:b0:212:fe4a:c363 with SMTP id v7-20020a17090a634700b00212fe4ac363mr8132388pjs.176.1666611217083; Mon, 24 Oct 2022 04:33:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611217; cv=none; d=google.com; s=arc-20160816; b=vycuF3Scmh0ZvOA+Zhy8PX8/hJupf6+cNlLwjJwBerLOTTSCqTcSFdeQx58AgIFuX2 h/j0O50onuoKM8/ycbqDZ3EBj1p6km91e6VUWkosBqLzIh8gPZRYq2M6iTilNeHUlefG RbleAEhoT375MSAp33+7ZTwEOPCu/7wI0v9L1aXn5gdnfOaTCbRkPlH3J8BbUgx371JU RTpAlVCRprQo4ougem7MkauyDiT/5qj6Id1b2356fXd2Ip8/KWqU/Wt282OPqRIsivQf damFv2VgRPBG5unQ5FwX/J4Gzmk6txORae4J+jXGa5mKoSATg3kxQGico2vrrPL4M7QL C80A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+p2KtFQMCiKw+S0O5Tbmo747glGvtPZzVGp5+Rnii6M=; b=julWILlnM3AyleBeAeazwVfFGbMf9gxULxEs/yz70U+kEo0kdQSzFb184KML9OAYTU gxgqsJB21iFVXAhpfEM7TgIfsYO2HugbYeWADXF3nJzgRTRFW099ZBWbWAnqOcfquRmc 2kbb9OSXjm2P1ZPSZi9YsRv8jTdcT7/B7VvL0jGt1GI8RnyJRoqzfgZEmMRkj4h7hoCm pM0z7SwLheNZg1uEAyuqKN3x24Pu3Gyn6Y86tNaSoD7BiDSyz2BCC6wTI81cVsF78f2V MCofqTLhmNw3DIW1G36PV2TwQXT7mkTtZYl6Eh6RGb+VIclKipK1dR5hw6pUduU7PGj+ vPpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N3AUODOS; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w8-20020a634908000000b0045f702aaec0si35276298pga.158.2022.10.24.04.33.24; Mon, 24 Oct 2022 04:33:37 -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=@linuxfoundation.org header.s=korg header.b=N3AUODOS; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230090AbiJXLbw (ORCPT + 99 others); Mon, 24 Oct 2022 07:31:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230259AbiJXLbt (ORCPT ); Mon, 24 Oct 2022 07:31:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 500DC55C58; Mon, 24 Oct 2022 04:31:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 01F1DB8113A; Mon, 24 Oct 2022 11:31:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51AD2C433C1; Mon, 24 Oct 2022 11:31:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611105; bh=fCOJG6u/PwN900egkfC9xg+Is3FCL/e8k21sKERtIMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N3AUODOSzfm2i6+P6zM3a4cMGG0dA9t2/2qFvMjNVJRQlRSiT4u8uq5EEm8NAVKuF SCF+/BdbCfJOA5IjKBZRPBVN16l3BvKLB2SGFZw9rkX5eGs1fZjgOYJ5lexDq3wDuc ypumWyWW9HD5IhGAUSpNE+KyfgHBMij01PBXwDHs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evan Quan , Hawking Zhang , Lijo Lazar , Alex Deucher Subject: [PATCH 6.0 11/20] drm/amd/pm: disable cstate feature for gpu reset scenario Date: Mon, 24 Oct 2022 13:31:13 +0200 Message-Id: <20221024112934.902288047@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568523807647095?= X-GMAIL-MSGID: =?utf-8?q?1747568523807647095?= From: Evan Quan commit 3059cd8c5f797ad83d2b194ae66339f5c007ca43 upstream. Suggested by PMFW team and same as what did for gfxoff feature. This can address some Mode1Reset failures observed on SMU13.0.0. Signed-off-by: Evan Quan Reviewed-by: Hawking Zhang Reviewed-by: Lijo Lazar Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org # 6.0.x Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++ drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 8 ++++++++ drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 9 +++++++++ 3 files changed, 25 insertions(+) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -2926,6 +2926,14 @@ static int amdgpu_device_ip_suspend_phas amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE); amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE); + /* + * Per PMFW team's suggestion, driver needs to handle gfxoff + * and df cstate features disablement for gpu reset(e.g. Mode1Reset) + * scenario. Add the missing df cstate disablement here. + */ + if (amdgpu_dpm_set_df_cstate(adev, DF_CSTATE_DISALLOW)) + dev_warn(adev->dev, "Failed to disallow df cstate"); + for (i = adev->num_ip_blocks - 1; i >= 0; i--) { if (!adev->ip_blocks[i].status.valid) continue; --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c @@ -2242,9 +2242,17 @@ static void arcturus_get_unique_id(struc static int arcturus_set_df_cstate(struct smu_context *smu, enum pp_df_cstate state) { + struct amdgpu_device *adev = smu->adev; uint32_t smu_version; int ret; + /* + * Arcturus does not need the cstate disablement + * prerequisite for gpu reset. + */ + if (amdgpu_in_reset(adev) || adev->in_suspend) + return 0; + ret = smu_cmn_get_smc_version(smu, NULL, &smu_version); if (ret) { dev_err(smu->adev->dev, "Failed to get smu version!\n"); --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c @@ -1640,6 +1640,15 @@ static bool aldebaran_is_baco_supported( static int aldebaran_set_df_cstate(struct smu_context *smu, enum pp_df_cstate state) { + struct amdgpu_device *adev = smu->adev; + + /* + * Aldebaran does not need the cstate disablement + * prerequisite for gpu reset. + */ + if (amdgpu_in_reset(adev) || adev->in_suspend) + return 0; + return smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_DFCstateControl, state, NULL); } From patchwork Mon Oct 24 11:31:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8353 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp391660wru; Mon, 24 Oct 2022 04:33:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gY/M2AfrU2FJfAc7oRYLK+ldsT+6wQTVg5rdsysTzrt7D7k11c8y6jIlnd8rkH1ezLz0k X-Received: by 2002:a17:902:d2cf:b0:17f:7b65:862f with SMTP id n15-20020a170902d2cf00b0017f7b65862fmr32875696plc.168.1666611220191; Mon, 24 Oct 2022 04:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611220; cv=none; d=google.com; s=arc-20160816; b=uIbqeIBMCMPpd//Dx8Rth8dVooSJ6YceI62X7EFSKqlW5dTVbKWFfFtyfeGg0BumXz wgr/tG6mxNH2caP9UddWe6lpyxBgxBlmQF66P/CAvqGih7fl+KpAGnRJYEWXfm7dwhMl fSIDpVCLOgnV3O410djCYZUPbQIBNl5EEvigeWKYyklWJQRM4nUQb3ZRC9kBCfwpQ4b5 z6x9HHLtoUraV/+i1TsIfgSWAzh3z1adyNJhlyGJN0Y6DmkvpfjQ1ZfY57/gpu48DEu3 j+CsKSlLLRNkNjUcR0bBwtDCiQ6RLLrKiNHbE1G7zYRiLxdWEN21geCXmqLk3H4Yn0/B cqtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=My5o85fGvKGQZLH0ByR3ugFumNkTMH1mb/JHJmvB+zk=; b=MNnFiESRqrtMrpEZICzJWcZ7syh8Ej5s07etPfOi5aHkvflu+C1Dq23niku+IldcU3 rYNCfDtHc5xi0pPBuuorrEZXUrgObuAEfwbRTC/KHldOubRocLQ7hP1V0jpdLGdS6H4p 2IuHEKMtIwoKqtyVBK+Ith3MNQFHQCoJy3NU3DykSBUIAFhhrl5phV6/JcDOEvmI1ywV cldhKPrwUHICN3pGClejIIUvNVuWbvbpHp6ABieSimYT4k/tMCKm6nKa/3wUxalTl56/ Jcu5EoDFxvWv9oQm7a/k1tY51qp+lCiGUNhaX4qe7k0LDi82rZaGmYDYjuHGajeboZIQ Rp/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UzqUfRRf; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 66-20020a630245000000b0046ea4ef43d2si14330366pgc.378.2022.10.24.04.33.26; Mon, 24 Oct 2022 04:33:40 -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=@linuxfoundation.org header.s=korg header.b=UzqUfRRf; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230267AbiJXLb4 (ORCPT + 99 others); Mon, 24 Oct 2022 07:31:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230262AbiJXLbw (ORCPT ); Mon, 24 Oct 2022 07:31:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 691775603D; Mon, 24 Oct 2022 04:31:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A30CCB81133; Mon, 24 Oct 2022 11:31:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F19B4C43141; Mon, 24 Oct 2022 11:31:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611108; bh=/VSGSHF0sdxC4vEXEymNZSjiWrDALm65vLVmrVSJcNo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UzqUfRRfKxXKGe7f+JguNlHAxyaM/YCmW9bhZnFgz+tXgLvLC6vi3f17WPIY9Jnel kir0x7klAv5JE8I/QZ0dv1icCu/SUMbMZD6ZULUJDDIOgbx87tt0swz9IkOsOv2gA0 oZASLvGaZ1/YgYkoXTneQxVXpJXzA9RytQhX67io= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evan Quan , Hawking Zhang , Lijo Lazar , Alex Deucher Subject: [PATCH 6.0 12/20] drm/amd/pm: fulfill SMU13.0.0 cstate control interface Date: Mon, 24 Oct 2022 13:31:14 +0200 Message-Id: <20221024112934.932218124@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568527096681435?= X-GMAIL-MSGID: =?utf-8?q?1747568527096681435?= From: Evan Quan commit 528c0e66e0c01a8c078d2d94431db80f9c75d2a0 upstream. Fulfill the functionality for cstate control. Signed-off-by: Evan Quan Reviewed-by: Hawking Zhang Reviewed-by: Lijo Lazar Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org # 6.0.x Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c @@ -119,6 +119,7 @@ static struct cmn2asic_msg_mapping smu_v MSG_MAP(NotifyPowerSource, PPSMC_MSG_NotifyPowerSource, 0), MSG_MAP(Mode1Reset, PPSMC_MSG_Mode1Reset, 0), MSG_MAP(PrepareMp1ForUnload, PPSMC_MSG_PrepareMp1ForUnload, 0), + MSG_MAP(DFCstateControl, PPSMC_MSG_SetExternalClientDfCstateAllow, 0), }; static struct cmn2asic_mapping smu_v13_0_0_clk_map[SMU_CLK_COUNT] = { @@ -1753,6 +1754,15 @@ static int smu_v13_0_0_set_mp1_state(str return ret; } +static int smu_v13_0_0_set_df_cstate(struct smu_context *smu, + enum pp_df_cstate state) +{ + return smu_cmn_send_smc_msg_with_param(smu, + SMU_MSG_DFCstateControl, + state, + NULL); +} + static const struct pptable_funcs smu_v13_0_0_ppt_funcs = { .get_allowed_feature_mask = smu_v13_0_0_get_allowed_feature_mask, .set_default_dpm_table = smu_v13_0_0_set_default_dpm_table, @@ -1822,6 +1832,7 @@ static const struct pptable_funcs smu_v1 .mode1_reset_is_support = smu_v13_0_0_is_mode1_reset_supported, .mode1_reset = smu_v13_0_mode1_reset, .set_mp1_state = smu_v13_0_0_set_mp1_state, + .set_df_cstate = smu_v13_0_0_set_df_cstate, }; void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu) From patchwork Mon Oct 24 11:31:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8354 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp391669wru; Mon, 24 Oct 2022 04:33:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53YIgfjl1GkdN62dE39rEKGqRu7//AcJk4P9G74rE1EJs1lvUsBFyZB9mri552UTW13d5U X-Received: by 2002:a63:5702:0:b0:44b:290:f24f with SMTP id l2-20020a635702000000b0044b0290f24fmr27861111pgb.558.1666611221686; Mon, 24 Oct 2022 04:33:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611221; cv=none; d=google.com; s=arc-20160816; b=ATBOryYARMZ+i3gPZTwK9Lw+EeLhgWsQQ7IMU3O5h3YOnAje5QOoeMKU/ty8gL9Na7 comNYE/M8iYwKa8/wVoj7eq4KpIZ26m3SVC2C/RNMUMOad3xhm6xF7MAkzjrUxFu3iKr mdaj/iHXfL2c5QUY9xz4DEDayVswbuCLq6mjXfgaXYvbWEm46I+9K8OvvPQEPUWsweX2 vtWYrOlQoSooNL91zD7LEUlGgOVvk3xPWeCa6yKUgxgqpIMUAZHCRX05x/blAH5XZ0xu XVkEy6ban/tjW89cb0SxkAShkej0aRcKavAp6+NetlsSrrxoqegUqrQ2OSOqXeMG9YNw g7Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zpDZvMvVKTACofpHR7Eb1m8EEHASUSUsgzrV/AXtgmY=; b=dQJE1X/rECMPTaXnaYvlUaw50CH17WQ7a7W2hWkB691IAxcjS3NFWbMPvRmlPBr6lC x2+WBi5ejOQj0B8whQK005KLPNWEfibwINgZDC5Fr87LLfvkFqlkcE9C/Rmyv0S3L7cv J/HFzmO/LvPomWcwPHCbfs2fjoq/D0oMmSchPpjDatQTlgDZk4BvnjgWdx7WS1l2wZlj CPlF+uPrfU9a4aXJtI3sxy1IQ+STIlQtZtnnnGQfd+lga7zD0MvAN/p6uqdFtPWChwk/ Jg8SvCoJQbS0/sCrVjiwPr4nKCb7p/BzTBEzn4eBU5U5OoRLSWGo7GWeIb0AtnjmdmR4 /Ezw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RBBJJXLx; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h38-20020a63f926000000b0046ed15b5318si9034074pgi.98.2022.10.24.04.33.27; Mon, 24 Oct 2022 04:33:41 -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=@linuxfoundation.org header.s=korg header.b=RBBJJXLx; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230285AbiJXLcB (ORCPT + 99 others); Mon, 24 Oct 2022 07:32:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230272AbiJXLb5 (ORCPT ); Mon, 24 Oct 2022 07:31:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F88955C58; Mon, 24 Oct 2022 04:31:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7BB6C6125D; Mon, 24 Oct 2022 11:31:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F441C433C1; Mon, 24 Oct 2022 11:31:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611110; bh=pA708DfDAlUs9/8gMiAzDR60U/q1IY8dcr1tgyu+yFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RBBJJXLxWGB5ZKRU7hJnDalV/cSFwKv/BvSh361z4uoYcDV2ORhZl81wlprhK6jHv rTnZNPZF7Z59sis5ZJBLgrl5gkXR5/mj8sXhXLZyxJ34s9nxE9V4x/vkB84jXP1Dk3 WnfUqc9KxzzPyj78JHOQtSdhQY7sV/0LcpSmqyis= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tim Huang , Mario Limonciello , Alex Deucher Subject: [PATCH 6.0 13/20] drm/amd/pm: update SMU IP v13.0.4 driver interface version Date: Mon, 24 Oct 2022 13:31:15 +0200 Message-Id: <20221024112934.963501610@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568528411281129?= X-GMAIL-MSGID: =?utf-8?q?1747568528411281129?= From: Tim Huang commit 853fdb49160e9c30674fd8e4a2eabc06bf70b13a upstream. Update the SMU driver interface version to V7. Signed-off-by: Tim Huang Reviewed-by: Mario Limonciello Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org # 6.0.x Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_4.h | 17 ++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_4.h +++ b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_4.h @@ -27,7 +27,7 @@ // *** IMPORTANT *** // SMU TEAM: Always increment the interface version if // any structure is changed in this file -#define PMFW_DRIVER_IF_VERSION 5 +#define PMFW_DRIVER_IF_VERSION 7 typedef struct { int32_t value; @@ -163,8 +163,8 @@ typedef struct { uint16_t DclkFrequency; //[MHz] uint16_t MemclkFrequency; //[MHz] uint16_t spare; //[centi] - uint16_t UvdActivity; //[centi] uint16_t GfxActivity; //[centi] + uint16_t UvdActivity; //[centi] uint16_t Voltage[2]; //[mV] indices: VDDCR_VDD, VDDCR_SOC uint16_t Current[2]; //[mA] indices: VDDCR_VDD, VDDCR_SOC @@ -199,6 +199,19 @@ typedef struct { uint16_t DeviceState; uint16_t CurTemp; //[centi-Celsius] uint16_t spare2; + + uint16_t AverageGfxclkFrequency; + uint16_t AverageFclkFrequency; + uint16_t AverageGfxActivity; + uint16_t AverageSocclkFrequency; + uint16_t AverageVclkFrequency; + uint16_t AverageVcnActivity; + uint16_t AverageDRAMReads; //Filtered DF Bandwidth::DRAM Reads + uint16_t AverageDRAMWrites; //Filtered DF Bandwidth::DRAM Writes + uint16_t AverageSocketPower; //Filtered value of CurrentSocketPower + uint16_t AverageCorePower; //Filtered of [sum of CorePower[8]]) + uint16_t AverageCoreC0Residency[8]; //Filtered of [average C0 residency % per core] + uint32_t MetricsCounter; //Counts the # of metrics table parameter reads per update to the metrics table, i.e. if the metrics table update happens every 1 second, this value could be up to 1000 if the smu collected metrics data every cycle, or as low as 0 if the smu was asleep the whole time. Reset to 0 after writing. } SmuMetrics_t; typedef struct { From patchwork Mon Oct 24 11:31:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8365 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp392336wru; Mon, 24 Oct 2022 04:35:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7FjuKhGsYXNGOcrYyJoT8GJrMiHXu/T3aE1T1tiYkLudfA7dJUZ/dqO6RCxR4EWjJFs5s6 X-Received: by 2002:a17:906:c151:b0:78d:cdbc:9fb7 with SMTP id dp17-20020a170906c15100b0078dcdbc9fb7mr25949088ejc.688.1666611306564; Mon, 24 Oct 2022 04:35:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611306; cv=none; d=google.com; s=arc-20160816; b=WGHYihNfPCPOjvSxOuLWOLPnowwb2LJH6wfvMka8aMQm9hzXvdhOcIB4BbuS/sHcOO MLCWGpZ/DpwucLwVb4KXE7csTIPDCoZllgKQsUbfl9i1mbph8QaLyaBRxTPOzYeBk25L J0BxyDly+YyXk6FLwpWKKn098Sz7m7rMw/d7ptPTOU99h1bJWodj9rQcHIKu6Ttqfym5 /SYx4RFOgKk3lAlAcDFGkRb6Vc1Na+2pDJLgfGRmGsfgyZYG4eGL6vwD+hgJHDUDxQSW LG89lDlO8hMz/M8p8b5MWNENwn7h54Rd0hfK01v2i9rJ6McveN81jYxyJJGGMkqPNFgg jqlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9aYtkQHX58XJhojciddoeTtKkBk/x4pP33AYkD8PoCY=; b=DNzRJ7tsxkVgzGtUTxwarOFmxvVcaZ7n1NyK8TpG/by0s0FJZnSsHG4YPkSr0GuZPF MWBoy4mFhCpnOO0qTHFVRxaUKVqt9yE8frlGQIBDqNoWoM0FR6C7so0pUsPPs88LxgkG TWKL/KL83BSSrW49dJ97TfRI+Ldkr8UuCu7iAI+eTDg5FVDp/KEXY6SDlQUJuhjOSzhZ Pb3GvM3gpYzK46dglphPRK+iP0GrJL9hc0ktchxVeNli5vAiBumSRWgjOzwkrg+TMX07 xB8zXQeeZ9PJaMrQDq7Yp5Vfy8bbPLAE9HJJeN7TF6oq3GSht8Eq0AAitRIelDLyQxek QpyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q0fs3t7u; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i15-20020a50d74f000000b00458264c2df2si24827421edj.164.2022.10.24.04.34.42; Mon, 24 Oct 2022 04:35:06 -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=@linuxfoundation.org header.s=korg header.b=Q0fs3t7u; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230309AbiJXLcJ (ORCPT + 99 others); Mon, 24 Oct 2022 07:32:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230175AbiJXLcA (ORCPT ); Mon, 24 Oct 2022 07:32:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F45756B85; Mon, 24 Oct 2022 04:31:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2B84B61259; Mon, 24 Oct 2022 11:31:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 374A7C433D6; Mon, 24 Oct 2022 11:31:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611113; bh=BTxUk6zOdn4AF72fGjbFRugsG+1T5LCy1r/WeFDOWhM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q0fs3t7ufewgnLj0weFPFfygZl7GHa46I+NpSmi56yHdNa7mMJH4x7J46Tpum5l4x yS6P4i5DvnB5JnNTepo+ZQMmXXnu4PJETrmLcLMtUwUKO7Eqaz2d9iyjmtzRaX++Gt qVRfwXJTjIF26ElDeWc5T/G1U3IVXS1EWQHhH6lU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikos Tsironis , Mike Snitzer Subject: [PATCH 6.0 14/20] dm clone: Fix typo in block_device format specifier Date: Mon, 24 Oct 2022 13:31:16 +0200 Message-Id: <20221024112934.999774239@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568617831271667?= X-GMAIL-MSGID: =?utf-8?q?1747568617831271667?= From: Nikos Tsironis commit 5434ee8d28575b2e784bd5b4dbfc912e5da90759 upstream. Use %pg for printing the block device name, instead of %pd. Fixes: 385411ffba0c ("dm: stop using bdevname") Cc: stable@vger.kernel.org # v5.18+ Signed-off-by: Nikos Tsironis Signed-off-by: Mike Snitzer Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm-clone-target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-clone-target.c b/drivers/md/dm-clone-target.c index 811b0a5379d0..2f1cc66d2641 100644 --- a/drivers/md/dm-clone-target.c +++ b/drivers/md/dm-clone-target.c @@ -2035,7 +2035,7 @@ static void disable_passdown_if_not_supported(struct clone *clone) reason = "max discard sectors smaller than a region"; if (reason) { - DMWARN("Destination device (%pd) %s: Disabling discard passdown.", + DMWARN("Destination device (%pg) %s: Disabling discard passdown.", dest_dev, reason); clear_bit(DM_CLONE_DISCARD_PASSDOWN, &clone->flags); } From patchwork Mon Oct 24 11:31:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8364 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp392327wru; Mon, 24 Oct 2022 04:35:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7lpDUofrGR3Ie0vptAv+l0ZaBKZmU+k3Gi8tSuCkRsgb+xMBB2DLNj/dwV48DOLmIfwfLb X-Received: by 2002:a17:906:58c5:b0:7a1:8e13:c071 with SMTP id e5-20020a17090658c500b007a18e13c071mr9000922ejs.671.1666611305923; Mon, 24 Oct 2022 04:35:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611305; cv=none; d=google.com; s=arc-20160816; b=BB5TGWJtx1T5BrfjKMlGPPzp0oVYfpA4gENS3UAKpzTh4iMmvpDCadNR4418kJXb+e eAtt7qbKWDhIh5nEqrrOOUpQOJG+2qQIkOubqYcesnfyGAnlqCJA02mG/zddF+tpgEy3 L8z0KYMGlEqteSIY8ANXWDwf8ed/ngGt+kVjUL4uSBQOEoqr/W0c4bEiW69q4OdSLFH3 4k+wjhTg4kFx7alxY+aRtQx1BNdZR5lUo7la3Moq0YKI1ycOQfz+LSybMUco098aOEB0 gP2rbYY9wjZ7Whhnth+6S/hEC37X2WOOpEFYUeayTa6NpXI+cOKzoG3imSzGwlAxKNBK VzCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=o9f8B++Adm86ht1yOEFCn3xfiIyQtroYdJ8MyE3n7Aw=; b=ttn9ry56FC4eRbJ5jTxZL8j9gyyQ8OJZVnOMa72qI4Hu029tLQSraI6/uDDkaSMl3+ acvQmMKAAPAeQatcKehgKmavFkrujI7WRk9vOsvwmFfGG+8wf8sKyAtEqNsDKC2h43cZ /DkrYZE26+AARTslxUpl0BBktvpYwkHA6kW/FkL9gb6ZAukZ/U8oWMpuYCBgQ1Rr0xi6 n6R+SZMib7XSZewrY1DxcHsxFqIDc7TcCymz22SFBzmWuLhwZDGM0VqQ3advNK9KW8Jk K7WmtxYsUdANQJMkBrFkYid00JOYFbo8CzB+hzTgakfRzmoE+tgyXKC21nc1DLvJ8Awk jG4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OQKeGs3L; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e11-20020a17090658cb00b0078e9ca562d8si24130377ejs.879.2022.10.24.04.34.41; Mon, 24 Oct 2022 04:35:05 -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=@linuxfoundation.org header.s=korg header.b=OQKeGs3L; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229781AbiJXLcZ (ORCPT + 99 others); Mon, 24 Oct 2022 07:32:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230175AbiJXLcK (ORCPT ); Mon, 24 Oct 2022 07:32:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3B605E55C; Mon, 24 Oct 2022 04:31:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BD2A061251; Mon, 24 Oct 2022 11:31:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD99EC433C1; Mon, 24 Oct 2022 11:31:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611116; bh=eLrnmTlnmMdpbACYZc3GPWxthCIJh0Mjw7MbfVQmRL8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OQKeGs3LVhowZ+EgQ5dagqKnxJ8B7g7N0yrgZUFG6xXAKr9TPWkmlxpf5gpwXxO+j ZM0f3ZU4nYoCE2gsbGKHzBI+EEOGfZZrFLzkQf/7M9rVMXlnXJsNno2bQ42oHM81QL wJFaKE/tvg+wq81hWzER1kmGzy7lG/+0i1mXi+L8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel Subject: [PATCH 6.0 15/20] efi: efivars: Fix variable writes without query_variable_store() Date: Mon, 24 Oct 2022 13:31:17 +0200 Message-Id: <20221024112935.030619098@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568616341788627?= X-GMAIL-MSGID: =?utf-8?q?1747568616341788627?= From: Ard Biesheuvel commit 8a254d90a77580244ec57e82bca7eb65656cc167 upstream. Commit bbc6d2c6ef22 ("efi: vars: Switch to new wrapper layer") refactored the efivars layer so that the 'business logic' related to which UEFI variables affect the boot flow in which way could be moved out of it, and into the efivarfs driver. This inadvertently broke setting variables on firmware implementations that lack the QueryVariableInfo() boot service, because we no longer tolerate a EFI_UNSUPPORTED result from check_var_size() when calling efivar_entry_set_get_size(), which now ends up calling check_var_size() a second time inadvertently. If QueryVariableInfo() is missing, we support writes of up to 64k - let's move that logic into check_var_size(), and drop the redundant call. Cc: # v6.0 Fixes: bbc6d2c6ef22 ("efi: vars: Switch to new wrapper layer") Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/efi/vars.c | 10 +++++----- fs/efivarfs/vars.c | 16 ---------------- include/linux/efi.h | 3 --- 3 files changed, 5 insertions(+), 24 deletions(-) --- a/drivers/firmware/efi/vars.c +++ b/drivers/firmware/efi/vars.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -20,19 +21,19 @@ static struct efivars *__efivars; static DEFINE_SEMAPHORE(efivars_lock); -efi_status_t check_var_size(u32 attributes, unsigned long size) +static efi_status_t check_var_size(u32 attributes, unsigned long size) { const struct efivar_operations *fops; fops = __efivars->ops; if (!fops->query_variable_store) - return EFI_UNSUPPORTED; + return (size <= SZ_64K) ? EFI_SUCCESS : EFI_OUT_OF_RESOURCES; return fops->query_variable_store(attributes, size, false); } -EXPORT_SYMBOL_NS_GPL(check_var_size, EFIVAR); +static efi_status_t check_var_size_nonblocking(u32 attributes, unsigned long size) { const struct efivar_operations *fops; @@ -40,11 +41,10 @@ efi_status_t check_var_size_nonblocking( fops = __efivars->ops; if (!fops->query_variable_store) - return EFI_UNSUPPORTED; + return (size <= SZ_64K) ? EFI_SUCCESS : EFI_OUT_OF_RESOURCES; return fops->query_variable_store(attributes, size, true); } -EXPORT_SYMBOL_NS_GPL(check_var_size_nonblocking, EFIVAR); /** * efivars_kobject - get the kobject for the registered efivars --- a/fs/efivarfs/vars.c +++ b/fs/efivarfs/vars.c @@ -651,22 +651,6 @@ int efivar_entry_set_get_size(struct efi if (err) return err; - /* - * Ensure that the available space hasn't shrunk below the safe level - */ - status = check_var_size(attributes, *size + ucs2_strsize(name, 1024)); - if (status != EFI_SUCCESS) { - if (status != EFI_UNSUPPORTED) { - err = efi_status_to_err(status); - goto out; - } - - if (*size > 65536) { - err = -ENOSPC; - goto out; - } - } - status = efivar_set_variable_locked(name, vendor, attributes, *size, data, false); if (status != EFI_SUCCESS) { --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -1055,9 +1055,6 @@ efi_status_t efivar_set_variable_locked( efi_status_t efivar_set_variable(efi_char16_t *name, efi_guid_t *vendor, u32 attr, unsigned long data_size, void *data); -efi_status_t check_var_size(u32 attributes, unsigned long size); -efi_status_t check_var_size_nonblocking(u32 attributes, unsigned long size); - #if IS_ENABLED(CONFIG_EFI_CAPSULE_LOADER) extern bool efi_capsule_pending(int *reset_type); From patchwork Mon Oct 24 11:31:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8356 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp391796wru; Mon, 24 Oct 2022 04:33:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6d9ZhN+F7OgwXVANXyFvZUkaXB+5s61U+ZsiyRVBW977ThT2GSEJejzQaICqDmBe3/rHTi X-Received: by 2002:a17:907:1c01:b0:78d:eb6e:3807 with SMTP id nc1-20020a1709071c0100b0078deb6e3807mr27189340ejc.481.1666611239385; Mon, 24 Oct 2022 04:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611239; cv=none; d=google.com; s=arc-20160816; b=YaYryfNvsLy0nGAWE5kd5nq+FDEt00PDdXUV7vDgC7aFTFZ1Zm7a2MOhjHlK5wOLHZ ajvnakVekjeze0N6txOE6DO3edlCjA8Q3BOiTXUKOjAez0aVaIJEZm6y2prmvTEGIJYC 7PFwsXS/8hw8oL8Yk6l71+6NxVJ5ehsNLALc8mo6b5MIUn9CZQUFtuuh3e0XaCLg9YFA oRbITahV2LcliQM2Dxq+YB0P97B5k57V1msJLSnJ96K/zsaOwsG/dkZjNn3LG4MAsU/p XyFuUPLvadkCuncSmAnE3pjLZlN/HYt9EadSWPpYTayzKh97iASM1X2d1p1N6XPglq5L pf1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RXDKwkX877ohUSqwYyoL7i3nFDeUbfKF1MyNHDNk0+A=; b=qmGvrzNzSs02NirX3S+oW2MbtVe35+j5QMMQJ6d4MXIm+A1jBoEuqPJxs9aFYFVcC/ AdTzNxjhizG91EY2GKNgJAgClJ8UW0AU/v0ICRuZnlBCeRFGbhAdkMLeRbjV1YUT7BKP ukX/hu96Bwaj3KK+Lj7qWFGaVZSqhpEn6LOx+8sEaqyGBN2AYzeQCVQ80tYGv/5zSzIm Tny4Qx8ZxQJDHNgVcg5Sxds7JCwxWAwhjHqbMyLl0GmwjJrSPQ8tVRffgVLejK7+7lPo isuTckV+acbtAJ4yvCjN4ohKij4u4dNsXj6XS+mSsSf5TZHraSkvDvtMUBmZS3RjVLU/ ekyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o5n8MywC; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr4-20020a170907720400b00782393c36cfsi3255516ejc.336.2022.10.24.04.33.33; Mon, 24 Oct 2022 04:33:59 -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=@linuxfoundation.org header.s=korg header.b=o5n8MywC; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230291AbiJXLcT (ORCPT + 99 others); Mon, 24 Oct 2022 07:32:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230318AbiJXLcK (ORCPT ); Mon, 24 Oct 2022 07:32:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8859B55C42; Mon, 24 Oct 2022 04:32:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5CD3661257; Mon, 24 Oct 2022 11:31:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DDFEC433D7; Mon, 24 Oct 2022 11:31:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611118; bh=SsxXhBXuJAX9mARv/xwRDQb187Z+68sqr4yjhTCIe70=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o5n8MywCFViw8R0/7bkRg7NkfWJAUBVH8qcI0X9lsOtnCBNoPS2zFloxXhCEd51K7 fKvP0Hplrn9dUYxZiEUZ6Bwl9Vjroa5AFjYdDVMoVE6XukEkcLRkY/T9ke0+50+mWX ujgx0lRHDZQyi6FYvsD8O1QCG21MFXtZGBPxq2gs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= , Ard Biesheuvel Subject: [PATCH 6.0 16/20] efi: ssdt: Dont free memory if ACPI table was loaded successfully Date: Mon, 24 Oct 2022 13:31:18 +0200 Message-Id: <20221024112935.061892355@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568546599032092?= X-GMAIL-MSGID: =?utf-8?q?1747568546599032092?= From: Ard Biesheuvel commit 4b017e59f01097f19b938f6dc4dc2c4720701610 upstream. Amadeusz reports KASAN use-after-free errors introduced by commit 3881ee0b1edc ("efi: avoid efivars layer when loading SSDTs from variables"). The problem appears to be that the memory that holds the new ACPI table is now freed unconditionally, instead of only when the ACPI core reported a failure to load the table. So let's fix this, by omitting the kfree() on success. Cc: # v6.0 Link: https://lore.kernel.org/all/a101a10a-4fbb-5fae-2e3c-76cf96ed8fbd@linux.intel.com/ Fixes: 3881ee0b1edc ("efi: avoid efivars layer when loading SSDTs from variables") Reported-by: Amadeusz Sławiński Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/efi/efi.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -269,6 +269,8 @@ static __init int efivar_ssdt_load(void) acpi_status ret = acpi_load_table(data, NULL); if (ret) pr_err("failed to load table: %u\n", ret); + else + continue; } else { pr_err("failed to get var data: 0x%lx\n", status); } From patchwork Mon Oct 24 11:31:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8367 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp392462wru; Mon, 24 Oct 2022 04:35:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM545cvTaKfUKt+F8l/HQG26By4VPLgQeWORm64A84ISqIslEm9EROUCGN6e8l4fq/xfEsmY X-Received: by 2002:a05:6402:5409:b0:44f:1e05:1e8 with SMTP id ev9-20020a056402540900b0044f1e0501e8mr30104745edb.373.1666611320957; Mon, 24 Oct 2022 04:35:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611320; cv=none; d=google.com; s=arc-20160816; b=xx9oVFIJgti7EL3r8ptfSlgoo/CQogObD2tSq02olEGjtQgr3Pb3WPeOn500kfolWa 6L1DFPSZZOLs/fWKZcja72YHXT5SA7tiPn0Ms+wmRt4UrYl5JoAhGbbihkccFb/rWb82 UjubkZeZEerSHrXipDC5BSzdHPwqmMulhQ9DHc0vqxNLXMXiNAT9LjlxeYoERWc7fO5x 3WEXWdOKe2O0A1Lb1LL6r0xjFdEeYsu6JzYfh3GYLv7B+jvAvN4PruMtP5/2gs7m3y1b uzdpFrneLlBnfZC0EzYfJkhDCwiseeqtfr7NaXQRzzT7085A95lt5CAiQRXHz/EaEZUc 7HVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ozCVv1Z7Nxh914ZQ32W+kEmGACgzjl8+va6hqN3WM1o=; b=M+d16urPjNLwPmiSaMPlFW5OgxJ5ala8jqeCdmgd12CX1Y/6IXbkXNU0qOzsBJ//MH ///yj/b9K73x/D0ZuSHOvVWSKWlmXoYooNXG/unJTz/gzm0nmBwmfleB9ZNafthY1oCr zBE1kDehX1UmwfRd6JBC56KmD83Oj554PA3h6Z8oVy3kN6jMr3URZjv/Au9ETdQfxhka rvrrfueosEDJ2w3zQeJlqVJqR8O0ynBMDyZ8zEobZIVnQtFehxMTkhceh25tl/9uCupo EtuEypAk9oJPVYD1gdUWgVilXIuYtL0S5ERW3fLdmEsg/+RV5xt1/Z3hR3eH77PVQbr/ iVvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="XUhX/Qiy"; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du3-20020a17090772c300b007417040d1c5si26321318ejc.823.2022.10.24.04.34.56; Mon, 24 Oct 2022 04:35:20 -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=@linuxfoundation.org header.s=korg header.b="XUhX/Qiy"; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230347AbiJXLc2 (ORCPT + 99 others); Mon, 24 Oct 2022 07:32:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230297AbiJXLcO (ORCPT ); Mon, 24 Oct 2022 07:32:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C6246113C; Mon, 24 Oct 2022 04:32:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0B80361269; Mon, 24 Oct 2022 11:32:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17560C433D7; Mon, 24 Oct 2022 11:32:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611121; bh=GaP2zY4gDt9q7SPS4N2nf0KNAmezYbQqo06Tm3bRLT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XUhX/QiyGIGs+heuCG/5umB6mRfS8s4Ngl5HRjhgqYMH0k3R40Q8aX7KNP1qzcggM KAPUva+wXkNToX1a9swPCUG4piDKkaItLddK/TttyFaHFKaXAzBBQQRfy7azfSD9O0 uBbogihLl+ByfsG5O7RXj1ehhISY7QBNpdT2jp8Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Liska , Peter Oberparleiter , Andrew Morton Subject: [PATCH 6.0 17/20] gcov: support GCC 12.1 and newer compilers Date: Mon, 24 Oct 2022 13:31:19 +0200 Message-Id: <20221024112935.104167318@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568632781835100?= X-GMAIL-MSGID: =?utf-8?q?1747568632781835100?= From: Martin Liska commit 977ef30a7d888eeb52fb6908f99080f33e5309a8 upstream. Starting with GCC 12.1, the created .gcda format can't be read by gcov tool. There are 2 significant changes to the .gcda file format that need to be supported: a) [gcov: Use system IO buffering] (23eb66d1d46a34cb28c4acbdf8a1deb80a7c5a05) changed that all sizes in the format are in bytes and not in words (4B) b) [gcov: make profile merging smarter] (72e0c742bd01f8e7e6dcca64042b9ad7e75979de) add a new checksum to the file header. Tested with GCC 7.5, 10.4, 12.2 and the current master. Link: https://lkml.kernel.org/r/624bda92-f307-30e9-9aaa-8cc678b2dfb2@suse.cz Signed-off-by: Martin Liska Tested-by: Peter Oberparleiter Reviewed-by: Peter Oberparleiter Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- kernel/gcov/gcc_4_7.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) --- a/kernel/gcov/gcc_4_7.c +++ b/kernel/gcov/gcc_4_7.c @@ -30,6 +30,13 @@ #define GCOV_TAG_FUNCTION_LENGTH 3 +/* Since GCC 12.1 sizes are in BYTES and not in WORDS (4B). */ +#if (__GNUC__ >= 12) +#define GCOV_UNIT_SIZE 4 +#else +#define GCOV_UNIT_SIZE 1 +#endif + static struct gcov_info *gcov_info_head; /** @@ -383,12 +390,18 @@ size_t convert_to_gcda(char *buffer, str pos += store_gcov_u32(buffer, pos, info->version); pos += store_gcov_u32(buffer, pos, info->stamp); +#if (__GNUC__ >= 12) + /* Use zero as checksum of the compilation unit. */ + pos += store_gcov_u32(buffer, pos, 0); +#endif + for (fi_idx = 0; fi_idx < info->n_functions; fi_idx++) { fi_ptr = info->functions[fi_idx]; /* Function record. */ pos += store_gcov_u32(buffer, pos, GCOV_TAG_FUNCTION); - pos += store_gcov_u32(buffer, pos, GCOV_TAG_FUNCTION_LENGTH); + pos += store_gcov_u32(buffer, pos, + GCOV_TAG_FUNCTION_LENGTH * GCOV_UNIT_SIZE); pos += store_gcov_u32(buffer, pos, fi_ptr->ident); pos += store_gcov_u32(buffer, pos, fi_ptr->lineno_checksum); pos += store_gcov_u32(buffer, pos, fi_ptr->cfg_checksum); @@ -402,7 +415,8 @@ size_t convert_to_gcda(char *buffer, str /* Counter record. */ pos += store_gcov_u32(buffer, pos, GCOV_TAG_FOR_COUNTER(ct_idx)); - pos += store_gcov_u32(buffer, pos, ci_ptr->num * 2); + pos += store_gcov_u32(buffer, pos, + ci_ptr->num * 2 * GCOV_UNIT_SIZE); for (cv_idx = 0; cv_idx < ci_ptr->num; cv_idx++) { pos += store_gcov_u64(buffer, pos, From patchwork Mon Oct 24 11:31:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8358 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp391842wru; Mon, 24 Oct 2022 04:34:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4HNAtRf8z12IrVh0hkbzi2Ev6aKWKIa8fjrUHpeuymshEgzpa5rIJmXyn8yNxdsJj57XvO X-Received: by 2002:a17:90b:1bc9:b0:20d:75b8:ee5d with SMTP id oa9-20020a17090b1bc900b0020d75b8ee5dmr39047576pjb.147.1666611246210; Mon, 24 Oct 2022 04:34:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611246; cv=none; d=google.com; s=arc-20160816; b=zM30pxZxFtxLb7ecRJ+bxWnY0Ce7D5jD+Q9UeyYYDACK3pXDMysFBRc9MKX+6V8e2/ taRK1864w/ZwjHyeZpBPV44UOBRCT1RN7F/lm5LbVUDW5v9MNJVVN3V5W3yREgj9G2Ni RvEqs4dcK92fl4aEZQexgFjm2DqaoLV+yxG9UZLKDNCC9YcwECiJd3HLP46JLNGrSIoI bJKtQsD6PeT+1SQRsvT+AGhSYeNAE+6jXEeLisM/0ZSujmT2TeZeimc6t3xC8GLw3Vix gQRpVa3SmA38DQpqAleiJIwNO89nasXuWa8Gz/eIa6kc4n3ovOM7s02BjXbR6sEOL7hg TmOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sVeA76FDTTh7HEGlW+x8UFCdntxJ8qmriT4eiS1IydM=; b=wmyZCIE26HRO0H6Mgd1NDePh6oB8s7RDERcMplqG/aouiJGxpL75XwcqWHhgYQfyJX q07M7SF9WWAV0YT8vhfIMfHgjLXckzXEBfDRNeqj6JyDodVFuj2KQH9A+D7/wSgaosCr Dp3uWW87uocbtIdvU1KY9xp6LSbzWUJQ3IENAr2bq6QJHWWYuVUPSz2LEjGdC9yBPqbE AXKTgH146jB1fRkmbpgXbrXJGG/PH3ZmIULwY6e4Tk+VhYRqt/+WiVNdO/KpOd/OlohM UjmMGvs1QBvUivSLjRaW4fSTUvGD5XjddrZ6j/AGGC2ohY6nqFDpHmURKKQVgEg1Viv9 c0gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ilsTykeZ; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bd11-20020a170902830b00b00176e21bab6asi31333675plb.118.2022.10.24.04.33.52; Mon, 24 Oct 2022 04:34:06 -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=@linuxfoundation.org header.s=korg header.b=ilsTykeZ; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229729AbiJXLc7 (ORCPT + 99 others); Mon, 24 Oct 2022 07:32:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230338AbiJXLc0 (ORCPT ); Mon, 24 Oct 2022 07:32:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F30955C52; Mon, 24 Oct 2022 04:32:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A15D661259; Mon, 24 Oct 2022 11:32:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B497CC433D6; Mon, 24 Oct 2022 11:32:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611124; bh=llE9/ab7USjw9FU0xU1iQ0h7h9m4CO1tKGvXo0cSFkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ilsTykeZRJSw53nWXpxQkxBahqUPy3yhzOGxinWDVNEWHh+G7LN8+xZQWGfuogFpj EgZRfvH7Q6O1P9CuogcbLAqjY5MS8WW3hEZCxF/y7Qrkud20Q89BGp/EAfv8iCSuWk RUkWufnVMsyKCnRFoDxefMsHOMpqSdkm4An2keeU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rafael Mendonca , Jens Axboe Subject: [PATCH 6.0 18/20] io-wq: Fix memory leak in worker creation Date: Mon, 24 Oct 2022 13:31:20 +0200 Message-Id: <20221024112935.134200294@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568554334366820?= X-GMAIL-MSGID: =?utf-8?q?1747568554334366820?= From: Rafael Mendonca commit 996d3efeb091c503afd3ee6b5e20eabf446fd955 upstream. If the CPU mask allocation for a node fails, then the memory allocated for the 'io_wqe' struct of the current node doesn't get freed on the error handling path, since it has not yet been added to the 'wqes' array. This was spotted when fuzzing v6.1-rc1 with Syzkaller: BUG: memory leak unreferenced object 0xffff8880093d5000 (size 1024): comm "syz-executor.2", pid 7701, jiffies 4295048595 (age 13.900s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<00000000cb463369>] __kmem_cache_alloc_node+0x18e/0x720 [<00000000147a3f9c>] kmalloc_node_trace+0x2a/0x130 [<000000004e107011>] io_wq_create+0x7b9/0xdc0 [<00000000c38b2018>] io_uring_alloc_task_context+0x31e/0x59d [<00000000867399da>] __io_uring_add_tctx_node.cold+0x19/0x1ba [<000000007e0e7a79>] io_uring_setup.cold+0x1b80/0x1dce [<00000000b545e9f6>] __x64_sys_io_uring_setup+0x5d/0x80 [<000000008a8a7508>] do_syscall_64+0x5d/0x90 [<000000004ac08bec>] entry_SYSCALL_64_after_hwframe+0x63/0xcd Fixes: 0e03496d1967 ("io-wq: use private CPU mask") Cc: stable@vger.kernel.org Signed-off-by: Rafael Mendonca Link: https://lore.kernel.org/r/20221020014710.902201-1-rafaelmendsr@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/io-wq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/io_uring/io-wq.c +++ b/io_uring/io-wq.c @@ -1164,10 +1164,10 @@ struct io_wq *io_wq_create(unsigned boun wqe = kzalloc_node(sizeof(struct io_wqe), GFP_KERNEL, alloc_node); if (!wqe) goto err; + wq->wqes[node] = wqe; if (!alloc_cpumask_var(&wqe->cpu_mask, GFP_KERNEL)) goto err; cpumask_copy(wqe->cpu_mask, cpumask_of_node(node)); - wq->wqes[node] = wqe; wqe->node = alloc_node; wqe->acct[IO_WQ_ACCT_BOUND].max_workers = bounded; wqe->acct[IO_WQ_ACCT_UNBOUND].max_workers = From patchwork Mon Oct 24 11:31:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8355 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp391780wru; Mon, 24 Oct 2022 04:33:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6AYXMnQs0AX8R+CI5UVUWb0SnhhbBr8A2xk7h62LkQglUkT68X+UXR3jhmAmy7BXSWLLSF X-Received: by 2002:aa7:9298:0:b0:56b:b6dc:988a with SMTP id j24-20020aa79298000000b0056bb6dc988amr6948832pfa.5.1666611236796; Mon, 24 Oct 2022 04:33:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611236; cv=none; d=google.com; s=arc-20160816; b=o06TXY3H2MFdTM4WH5VPLdZbd9IMvwlCf+DyhMccgVv5X2PsDtTNQMnMNA5s7lYklQ W2GIfl5UxWJ0HqiAIeI43SotNKNmt46rKCaOZRAvLSJ/ysXfrcEFzrWFxaizI7yOiE80 ib0U8aOZUehHovNz/GuuC7AM3pE7bTvDH/Ja9hdbf6K/ZrMRrZlp+cevzaGzaIfhThR2 Tf16Rjdmrkdxzt20zG30Rmg7OR7LosOOpN2ni0bzEj4tix1GLXSSBo9TgU8rMmzLbkKY 4+suZKdWi67xpbpJEtlOAAsxqEcRE9ucdoSQzunFHpyMkw5IumhrjjeeKUmAZSVZ3lv3 T2pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tqUAgLflPN4apDlIhXki5dXSdndEiPtJVUR6SoXH6Pg=; b=mt7veR5JgzO1lZFYQiLBhQ2zD2RH4HmZY44iUf2co/lkzSEJR1knmBblwIPzKKZsbr Xl2k6RfVRXLxuFBve38B5Mn9ItfOC/V1FRNmgtV7jriIzGA4RkNSW641gL1dpg7jzlag lfg6eHboS0qIeyKSHwkQZZQis6MEnxJXu50YnxuxZmwSAxSrEeDEK7JT0LxkpFsRIbNE hUcwO4MYa+ymeyh+Xi0chaIu6J1rvbeoULGcoRKsjRqx38tOPLcl7h6B7iL2mHY88jTv maR7W456Z3PRpAWapVbQmpoLybc6n8i2ZiLQBo/CyKwWQ7K+wEfh366lmgyMKg3ykq6C n1kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1djbrR69; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk13-20020a056a02028d00b0046b2bef339csi32585304pgb.257.2022.10.24.04.33.43; Mon, 24 Oct 2022 04:33:56 -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=@linuxfoundation.org header.s=korg header.b=1djbrR69; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230378AbiJXLcm (ORCPT + 99 others); Mon, 24 Oct 2022 07:32:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230293AbiJXLcV (ORCPT ); Mon, 24 Oct 2022 07:32:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCBB75BC17; Mon, 24 Oct 2022 04:32:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 451E661253; Mon, 24 Oct 2022 11:32:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 344B2C433D6; Mon, 24 Oct 2022 11:32:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611126; bh=vAYOtUxPKtKKMTHciRMMwaYZ0q7PAkLwIDwOv9ss5wg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1djbrR69potVnEpqeZbgvkmevDlj3AP8s3SNi52lZzHpobLFDqPNKGO7Yz6aZ1sBK sIENYk/E/zBvoq69z1IETYxr6Ec/dFuRwtCowS91oXpXbHX0kC8+ujKxXHsIrlARqt IvSUSps4QwbyDVas/grLr0Ah1AmC/ZYCkb630Af8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mel Gorman , "Matthew Wilcox (Oracle)" , Yang Shi , Brian Foster , Dan Streetman , Miaohe Lin , Oleksandr Natalenko , Seth Jennings , Vitaly Wool , Andrew Morton Subject: [PATCH 6.0 19/20] mm/huge_memory: do not clobber swp_entry_t during THP split Date: Mon, 24 Oct 2022 13:31:21 +0200 Message-Id: <20221024112935.173960536@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568543836495641?= X-GMAIL-MSGID: =?utf-8?q?1747568543836495641?= From: Mel Gorman commit 71e2d666ef85d51834d658830f823560c402b8b6 upstream. The following has been observed when running stressng mmap since commit b653db77350c ("mm: Clear page->private when splitting or migrating a page") watchdog: BUG: soft lockup - CPU#75 stuck for 26s! [stress-ng:9546] CPU: 75 PID: 9546 Comm: stress-ng Tainted: G E 6.0.0-revert-b653db77-fix+ #29 0357d79b60fb09775f678e4f3f64ef0579ad1374 Hardware name: SGI.COM C2112-4GP3/X10DRT-P-Series, BIOS 2.0a 05/09/2016 RIP: 0010:xas_descend+0x28/0x80 Code: cc cc 0f b6 0e 48 8b 57 08 48 d3 ea 83 e2 3f 89 d0 48 83 c0 04 48 8b 44 c6 08 48 89 77 18 48 89 c1 83 e1 03 48 83 f9 02 75 08 <48> 3d fd 00 00 00 76 08 88 57 12 c3 cc cc cc cc 48 c1 e8 02 89 c2 RSP: 0018:ffffbbf02a2236a8 EFLAGS: 00000246 RAX: ffff9cab7d6a0002 RBX: ffffe04b0af88040 RCX: 0000000000000002 RDX: 0000000000000030 RSI: ffff9cab60509b60 RDI: ffffbbf02a2236c0 RBP: 0000000000000000 R08: ffff9cab60509b60 R09: ffffbbf02a2236c0 R10: 0000000000000001 R11: ffffbbf02a223698 R12: 0000000000000000 R13: ffff9cab4e28da80 R14: 0000000000039c01 R15: ffff9cab4e28da88 FS: 00007fab89b85e40(0000) GS:ffff9cea3fcc0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fab84e00000 CR3: 00000040b73a4003 CR4: 00000000003706e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: xas_load+0x3a/0x50 __filemap_get_folio+0x80/0x370 ? put_swap_page+0x163/0x360 pagecache_get_page+0x13/0x90 __try_to_reclaim_swap+0x50/0x190 scan_swap_map_slots+0x31e/0x670 get_swap_pages+0x226/0x3c0 folio_alloc_swap+0x1cc/0x240 add_to_swap+0x14/0x70 shrink_page_list+0x968/0xbc0 reclaim_page_list+0x70/0xf0 reclaim_pages+0xdd/0x120 madvise_cold_or_pageout_pte_range+0x814/0xf30 walk_pgd_range+0x637/0xa30 __walk_page_range+0x142/0x170 walk_page_range+0x146/0x170 madvise_pageout+0xb7/0x280 ? asm_common_interrupt+0x22/0x40 madvise_vma_behavior+0x3b7/0xac0 ? find_vma+0x4a/0x70 ? find_vma+0x64/0x70 ? madvise_vma_anon_name+0x40/0x40 madvise_walk_vmas+0xa6/0x130 do_madvise+0x2f4/0x360 __x64_sys_madvise+0x26/0x30 do_syscall_64+0x5b/0x80 ? do_syscall_64+0x67/0x80 ? syscall_exit_to_user_mode+0x17/0x40 ? do_syscall_64+0x67/0x80 ? syscall_exit_to_user_mode+0x17/0x40 ? do_syscall_64+0x67/0x80 ? do_syscall_64+0x67/0x80 ? common_interrupt+0x8b/0xa0 entry_SYSCALL_64_after_hwframe+0x63/0xcd The problem can be reproduced with the mmtests config config-workload-stressng-mmap. It does not always happen and when it triggers is variable but it has happened on multiple machines. The intent of commit b653db77350c patch was to avoid the case where PG_private is clear but folio->private is not-NULL. However, THP tail pages uses page->private for "swp_entry_t if folio_test_swapcache()" as stated in the documentation for struct folio. This patch only clobbers page->private for tail pages if the head page was not in swapcache and warns once if page->private had an unexpected value. Link: https://lkml.kernel.org/r/20221019134156.zjyyn5aownakvztf@techsingularity.net Fixes: b653db77350c ("mm: Clear page->private when splitting or migrating a page") Signed-off-by: Mel Gorman Cc: Matthew Wilcox (Oracle) Cc: Mel Gorman Cc: Yang Shi Cc: Brian Foster Cc: Dan Streetman Cc: Miaohe Lin Cc: Oleksandr Natalenko Cc: Seth Jennings Cc: Vitaly Wool Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/huge_memory.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2445,7 +2445,16 @@ static void __split_huge_page_tail(struc page_tail); page_tail->mapping = head->mapping; page_tail->index = head->index + tail; - page_tail->private = 0; + + /* + * page->private should not be set in tail pages with the exception + * of swap cache pages that store the swp_entry_t in tail pages. + * Fix up and warn once if private is unexpectedly set. + */ + if (!folio_test_swapcache(page_folio(head))) { + VM_WARN_ON_ONCE_PAGE(page_tail->private != 0, head); + page_tail->private = 0; + } /* Page flags must be visible before we make the page non-compound. */ smp_wmb(); From patchwork Mon Oct 24 11:31:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8363 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp392326wru; Mon, 24 Oct 2022 04:35:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6GyPyUZV3IXhL6DyLjb2wj0ZSUSEWI0hJY+tQNKbiNL5Ikx+SF8aPKygjKNQ4PArqxaGVc X-Received: by 2002:a17:906:8a4b:b0:7a7:3e17:7f91 with SMTP id gx11-20020a1709068a4b00b007a73e177f91mr4719313ejc.331.1666611305884; Mon, 24 Oct 2022 04:35:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611305; cv=none; d=google.com; s=arc-20160816; b=R6nrDhLTpe/zla0nWwTGFVcXuylzwS9zgjkaN38+A1Bt3iUCGzrZF5YzEcgSGCOl7f mbj6KXnwdITZ8ueR+ixR1zkFAPmjqH7tgBI4yM1i0acFKS4IapvQcU1mxs1hUlqvuG0X 5IJYBqWJ/FViqyMpf2ebYKUTVr8Al/gPylpltb9hHXfKyOvDWPxULe5vQn1aa8rfBs+M RXx3eTcZyDfpFrJ/EozZYvyj30YVwUIhpo8paCk64b/Y55blDllh3z60IRhbubM1tSbG KFXASgfCTZ/unlml8QzgM7XEe2ONZXKv6Xdq7aM7iLNq5JkgDThnkvnGfSNz4Qo5sx7I AoBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=N78nEbmFZ74tmTCM0GauoHq5KO+7EFPw1GirhmSppMo=; b=QI6Vb1tJ8tSagb6QkAiRZpAd35t2yQTEUNuBmHP6rJsiqJnUGTpFSrHf20tzcjZcGC 44hroyrLYbSmXcaUJhgFO/DOhoS3HoatyWmq8Dwh1LgG8mHxR6AE8wy7Lq9+pTPl2LW9 XDmbd3SQI0eNgNxf/GuCY0SIMxbcy+uTlZwTSgH8x0Iza5XjAFk9XCfCppOWLHrR2XvE QRHFYN/yRx7+2ALLz9H29p/ejU/XuT9BrmGW61G64N+ecfVZQ1A9R+SLh5DAIb81ERt/ LTqQp0uFxxRqup7+8Ybe8W4dM6+kkHLViBom1+RpOksi5BerGh5Mxd5nZIB8PSZ3CXZS XaAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bDIs9f3r; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga8-20020a1709070c0800b0077a5733ac08si18201761ejc.601.2022.10.24.04.34.42; Mon, 24 Oct 2022 04:35:05 -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=@linuxfoundation.org header.s=korg header.b=bDIs9f3r; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229572AbiJXLcz (ORCPT + 99 others); Mon, 24 Oct 2022 07:32:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230358AbiJXLcc (ORCPT ); Mon, 24 Oct 2022 07:32:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 044045FC2C; Mon, 24 Oct 2022 04:32:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8618861268; Mon, 24 Oct 2022 11:32:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9612AC433C1; Mon, 24 Oct 2022 11:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611131; bh=nbjQeXROngc2BgaLrDgQ8Atv+F63c5SSrmNcFzJYIyQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bDIs9f3rwV76RQkEpCn/4z0WliVVH3ZF1FzRZO0ATjnXap3BKtKLouxaHcpR5FnK8 F/FGm7aHBUaPsmzYfmzCVh5ZUWveWdhG8hR/N372mZpTF8Hasp04xivgFGFAautfCd ev54IFWdaU/4LF7xr9pQdIh4aR6RTCUb/15nmVSw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Zimmermann , Javier Martinez Canillas Subject: [PATCH 6.0 20/20] fbdev/core: Remove remove_conflicting_pci_framebuffers() Date: Mon, 24 Oct 2022 13:31:22 +0200 Message-Id: <20221024112935.205547130@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568616597312213?= X-GMAIL-MSGID: =?utf-8?q?1747568616597312213?= From: Thomas Zimmermann commit 9d69ef1838150c7d87afc1a87aa658c637217585 upstream. Remove remove_conflicting_pci_framebuffers() and implement similar functionality in aperture_remove_conflicting_pci_device(), which was the only caller. Removes an otherwise unused interface and streamlines the aperture helper. No functional changes. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas Link: https://patchwork.freedesktop.org/patch/msgid/20220718072322.8927-5-tzimmermann@suse.de Signed-off-by: Greg Kroah-Hartman --- drivers/video/aperture.c | 30 ++++++++++++++---------- drivers/video/fbdev/core/fbmem.c | 48 --------------------------------------- include/linux/fb.h | 2 - 3 files changed, 18 insertions(+), 62 deletions(-) --- a/drivers/video/aperture.c +++ b/drivers/video/aperture.c @@ -335,30 +335,36 @@ EXPORT_SYMBOL(aperture_remove_conflictin */ int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name) { + bool primary = false; resource_size_t base, size; int bar, ret; - /* - * WARNING: Apparently we must kick fbdev drivers before vgacon, - * otherwise the vga fbdev driver falls over. - */ -#if IS_REACHABLE(CONFIG_FB) - ret = remove_conflicting_pci_framebuffers(pdev, name); - if (ret) - return ret; +#ifdef CONFIG_X86 + primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; #endif - ret = vga_remove_vgacon(pdev); - if (ret) - return ret; for (bar = 0; bar < PCI_STD_NUM_BARS; ++bar) { if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) continue; + base = pci_resource_start(pdev, bar); size = pci_resource_len(pdev, bar); - aperture_detach_devices(base, size); + ret = aperture_remove_conflicting_devices(base, size, primary, name); + if (ret) + break; } + if (ret) + return ret; + + /* + * WARNING: Apparently we must kick fbdev drivers before vgacon, + * otherwise the vga fbdev driver falls over. + */ + ret = vga_remove_vgacon(pdev); + if (ret) + return ret; + return 0; } --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1788,54 +1788,6 @@ int remove_conflicting_framebuffers(stru EXPORT_SYMBOL(remove_conflicting_framebuffers); /** - * remove_conflicting_pci_framebuffers - remove firmware-configured framebuffers for PCI devices - * @pdev: PCI device - * @name: requesting driver name - * - * This function removes framebuffer devices (eg. initialized by firmware) - * using memory range configured for any of @pdev's memory bars. - * - * The function assumes that PCI device with shadowed ROM drives a primary - * display and so kicks out vga16fb. - */ -int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, const char *name) -{ - struct apertures_struct *ap; - bool primary = false; - int err, idx, bar; - - for (idx = 0, bar = 0; bar < PCI_STD_NUM_BARS; bar++) { - if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) - continue; - idx++; - } - - ap = alloc_apertures(idx); - if (!ap) - return -ENOMEM; - - for (idx = 0, bar = 0; bar < PCI_STD_NUM_BARS; bar++) { - if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) - continue; - ap->ranges[idx].base = pci_resource_start(pdev, bar); - ap->ranges[idx].size = pci_resource_len(pdev, bar); - pci_dbg(pdev, "%s: bar %d: 0x%lx -> 0x%lx\n", __func__, bar, - (unsigned long)pci_resource_start(pdev, bar), - (unsigned long)pci_resource_end(pdev, bar)); - idx++; - } - -#ifdef CONFIG_X86 - primary = pdev->resource[PCI_ROM_RESOURCE].flags & - IORESOURCE_ROM_SHADOW; -#endif - err = remove_conflicting_framebuffers(ap, name, primary); - kfree(ap); - return err; -} -EXPORT_SYMBOL(remove_conflicting_pci_framebuffers); - -/** * register_framebuffer - registers a frame buffer device * @fb_info: frame buffer info structure * --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -615,8 +615,6 @@ extern ssize_t fb_sys_write(struct fb_in /* drivers/video/fbmem.c */ extern int register_framebuffer(struct fb_info *fb_info); extern void unregister_framebuffer(struct fb_info *fb_info); -extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, - const char *name); extern int remove_conflicting_framebuffers(struct apertures_struct *a, const char *name, bool primary); extern int fb_prepare_logo(struct fb_info *fb_info, int rotate);