From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 493C8C32771 for ; Mon, 26 Sep 2022 11:36:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238134AbiIZLgZ (ORCPT ); Mon, 26 Sep 2022 07:36:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234298AbiIZLeq (ORCPT ); Mon, 26 Sep 2022 07:34:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74EC64D80F; Mon, 26 Sep 2022 03:43: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 dfw.source.kernel.org (Postfix) with ESMTPS id 2E70060B4A; Mon, 26 Sep 2022 10:41:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F576C433D6; Mon, 26 Sep 2022 10:41:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188899; bh=0BK0iDrVDjoH3fRvvgiRKrZ6nps587NI38WnoS0Treg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pr1TZvF2a5ubb9IMJ3YYpIHark0GZWWzj2N6LgnnuznrkCX/6olMidPR2TmLxjpht XIhc/0HmAlN3SfNbi+MX4STABS+jXOx5tcwoVyDe1pB19x2yJMJlilkkknTDBndmtV cZLharsfvvk0PISPRmdQiciknLvAFQT3/kjRrc1M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Jani Nikula , Sasha Levin Subject: [PATCH 5.19 001/207] drm/i915: Extract intel_edp_fixup_vbt_bpp() Date: Mon, 26 Sep 2022 12:09:50 +0200 Message-Id: <20220926100806.581167017@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ville Syrj=C3=A4l=C3=A4 [ Upstream commit 822e5ae701af2964c5808b6ade1d6f3b1eaec967 ] We have the same "override eDP VBT bpp with the current bpp" code duplciated in two places. Extract it to a helper function. TODO: Having this in .get_config() is pretty ugly. Should probably try to move it somewhere else (setup_hw_state()/etc.)... Signed-off-by: Ville Syrj=C3=A4l=C3=A4 Link: https://patchwork.freedesktop.org/patch/msgid/20220510104242.6099-3-v= ille.syrjala@linux.intel.com Reviewed-by: Jani Nikula Stable-dep-of: 607f41768a1e ("drm/i915/dsi: filter invalid backlight and CA= BC ports") Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/i915/display/g4x_dp.c | 22 ++------------------- drivers/gpu/drm/i915/display/intel_ddi.c | 22 ++------------------- drivers/gpu/drm/i915/display/intel_dp.c | 25 ++++++++++++++++++++++++ drivers/gpu/drm/i915/display/intel_dp.h | 1 + 4 files changed, 30 insertions(+), 40 deletions(-) diff --git a/drivers/gpu/drm/i915/display/g4x_dp.c b/drivers/gpu/drm/i915/d= isplay/g4x_dp.c index 5a957acebfd6..82ad8fe7440c 100644 --- a/drivers/gpu/drm/i915/display/g4x_dp.c +++ b/drivers/gpu/drm/i915/display/g4x_dp.c @@ -395,26 +395,8 @@ static void intel_dp_get_config(struct intel_encoder *= encoder, intel_dotclock_calculate(pipe_config->port_clock, &pipe_config->dp_m_n); =20 - if (intel_dp_is_edp(intel_dp) && dev_priv->vbt.edp.bpp && - pipe_config->pipe_bpp > dev_priv->vbt.edp.bpp) { - /* - * This is a big fat ugly hack. - * - * Some machines in UEFI boot mode provide us a VBT that has 18 - * bpp and 1.62 GHz link bandwidth for eDP, which for reasons - * unknown we fail to light up. Yet the same BIOS boots up with - * 24 bpp and 2.7 GHz link. Use the same bpp as the BIOS uses as - * max, not what it tells us to use. - * - * Note: This will still be broken if the eDP panel is not lit - * up by the BIOS, and thus we can't get the mode at module - * load. - */ - drm_dbg_kms(&dev_priv->drm, - "pipe has %d bpp for eDP panel, overriding BIOS-provided max %d bpp= \n", - pipe_config->pipe_bpp, dev_priv->vbt.edp.bpp); - dev_priv->vbt.edp.bpp =3D pipe_config->pipe_bpp; - } + if (intel_dp_is_edp(intel_dp)) + intel_edp_fixup_vbt_bpp(encoder, pipe_config->pipe_bpp); } =20 static void diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i91= 5/display/intel_ddi.c index 9e6fa59eabba..333871cf3a2c 100644 --- a/drivers/gpu/drm/i915/display/intel_ddi.c +++ b/drivers/gpu/drm/i915/display/intel_ddi.c @@ -3433,26 +3433,8 @@ static void intel_ddi_get_config(struct intel_encode= r *encoder, pipe_config->has_audio =3D intel_ddi_is_audio_enabled(dev_priv, cpu_transcoder); =20 - if (encoder->type =3D=3D INTEL_OUTPUT_EDP && dev_priv->vbt.edp.bpp && - pipe_config->pipe_bpp > dev_priv->vbt.edp.bpp) { - /* - * This is a big fat ugly hack. - * - * Some machines in UEFI boot mode provide us a VBT that has 18 - * bpp and 1.62 GHz link bandwidth for eDP, which for reasons - * unknown we fail to light up. Yet the same BIOS boots up with - * 24 bpp and 2.7 GHz link. Use the same bpp as the BIOS uses as - * max, not what it tells us to use. - * - * Note: This will still be broken if the eDP panel is not lit - * up by the BIOS, and thus we can't get the mode at module - * load. - */ - drm_dbg_kms(&dev_priv->drm, - "pipe has %d bpp for eDP panel, overriding BIOS-provided max %d bpp= \n", - pipe_config->pipe_bpp, dev_priv->vbt.edp.bpp); - dev_priv->vbt.edp.bpp =3D pipe_config->pipe_bpp; - } + if (encoder->type =3D=3D INTEL_OUTPUT_EDP) + intel_edp_fixup_vbt_bpp(encoder, pipe_config->pipe_bpp); =20 ddi_dotclock_get(pipe_config); =20 diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915= /display/intel_dp.c index fe8b6b72970a..affc820bf8d0 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -2737,6 +2737,31 @@ static void intel_edp_mso_mode_fixup(struct intel_co= nnector *connector, DRM_MODE_ARG(mode)); } =20 +void intel_edp_fixup_vbt_bpp(struct intel_encoder *encoder, int pipe_bpp) +{ + struct drm_i915_private *dev_priv =3D to_i915(encoder->base.dev); + + if (dev_priv->vbt.edp.bpp && pipe_bpp > dev_priv->vbt.edp.bpp) { + /* + * This is a big fat ugly hack. + * + * Some machines in UEFI boot mode provide us a VBT that has 18 + * bpp and 1.62 GHz link bandwidth for eDP, which for reasons + * unknown we fail to light up. Yet the same BIOS boots up with + * 24 bpp and 2.7 GHz link. Use the same bpp as the BIOS uses as + * max, not what it tells us to use. + * + * Note: This will still be broken if the eDP panel is not lit + * up by the BIOS, and thus we can't get the mode at module + * load. + */ + drm_dbg_kms(&dev_priv->drm, + "pipe has %d bpp for eDP panel, overriding BIOS-provided max %d bpp= \n", + pipe_bpp, dev_priv->vbt.edp.bpp); + dev_priv->vbt.edp.bpp =3D pipe_bpp; + } +} + static void intel_edp_mso_init(struct intel_dp *intel_dp) { struct drm_i915_private *i915 =3D dp_to_i915(intel_dp); diff --git a/drivers/gpu/drm/i915/display/intel_dp.h b/drivers/gpu/drm/i915= /display/intel_dp.h index d457e17bdc57..e794d910df56 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.h +++ b/drivers/gpu/drm/i915/display/intel_dp.h @@ -63,6 +63,7 @@ enum irqreturn intel_dp_hpd_pulse(struct intel_digital_po= rt *dig_port, void intel_edp_backlight_on(const struct intel_crtc_state *crtc_state, const struct drm_connector_state *conn_state); void intel_edp_backlight_off(const struct drm_connector_state *conn_state); +void intel_edp_fixup_vbt_bpp(struct intel_encoder *encoder, int pipe_bpp); void intel_dp_mst_suspend(struct drm_i915_private *dev_priv); void intel_dp_mst_resume(struct drm_i915_private *dev_priv); int intel_dp_max_link_rate(struct intel_dp *intel_dp); --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1128CC32771 for ; Mon, 26 Sep 2022 11:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234715AbiIZLbv (ORCPT ); Mon, 26 Sep 2022 07:31:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238002AbiIZLbC (ORCPT ); Mon, 26 Sep 2022 07:31:02 -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 18D016CD30; Mon, 26 Sep 2022 03:42:18 -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 190ECB8095D; Mon, 26 Sep 2022 10:42:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E84FC433D6; Mon, 26 Sep 2022 10:42:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188933; bh=fl7+NFd7t7XQt+yzXGhU2ixASRe6bBzttRLfoiafxw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XL6R6J0lhKxzUQOgE575/9W7H3lq1Ovz/0MJo0smAP4PUX+IyPj77tKY5jX7iQ1UC 76naupCr2wsOKoKB5B4l7qwlzrWHcNI5wp7AbOngGqjaiih7kNrLdUEuwqSs9i0nfP Bv+pwDIUI9iDsG1HDTKhIC1a8l0oql3hxlPgRkfY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Jani Nikula , Sasha Levin Subject: [PATCH 5.19 002/207] drm/i915/pps: Split pps_init_delays() into distinct parts Date: Mon, 26 Sep 2022 12:09:51 +0200 Message-Id: <20220926100806.626926942@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ville Syrj=C3=A4l=C3=A4 [ Upstream commit 75bd0d5e4eadb9ce3e9b6fb71971b6e87c38799e ] Split each of the hw/vbt/spec PPS delay initialization into separate functions to make the whole thing less cluttered. Signed-off-by: Ville Syrj=C3=A4l=C3=A4 Link: https://patchwork.freedesktop.org/patch/msgid/20220510104242.6099-4-v= ille.syrjala@linux.intel.com Reviewed-by: Jani Nikula Stable-dep-of: 607f41768a1e ("drm/i915/dsi: filter invalid backlight and CA= BC ports") Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/i915/display/intel_pps.c | 66 +++++++++++++++++------- 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_pps.c b/drivers/gpu/drm/i91= 5/display/intel_pps.c index 5a598dd06039..5b72c892a6f2 100644 --- a/drivers/gpu/drm/i915/display/intel_pps.c +++ b/drivers/gpu/drm/i915/display/intel_pps.c @@ -1159,53 +1159,83 @@ intel_pps_verify_state(struct intel_dp *intel_dp) } } =20 -static void pps_init_delays(struct intel_dp *intel_dp) +static void pps_init_delays_cur(struct intel_dp *intel_dp, + struct edp_power_seq *cur) { struct drm_i915_private *dev_priv =3D dp_to_i915(intel_dp); - struct edp_power_seq cur, vbt, spec, - *final =3D &intel_dp->pps.pps_delays; =20 lockdep_assert_held(&dev_priv->pps_mutex); =20 - /* already initialized? */ - if (final->t11_t12 !=3D 0) - return; + intel_pps_readout_hw_state(intel_dp, cur); + + intel_pps_dump_state(intel_dp, "cur", cur); +} =20 - intel_pps_readout_hw_state(intel_dp, &cur); +static void pps_init_delays_vbt(struct intel_dp *intel_dp, + struct edp_power_seq *vbt) +{ + struct drm_i915_private *dev_priv =3D dp_to_i915(intel_dp); =20 - intel_pps_dump_state(intel_dp, "cur", &cur); + *vbt =3D dev_priv->vbt.edp.pps; =20 - vbt =3D dev_priv->vbt.edp.pps; /* On Toshiba Satellite P50-C-18C system the VBT T12 delay * of 500ms appears to be too short. Ocassionally the panel * just fails to power back on. Increasing the delay to 800ms * seems sufficient to avoid this problem. */ if (dev_priv->quirks & QUIRK_INCREASE_T12_DELAY) { - vbt.t11_t12 =3D max_t(u16, vbt.t11_t12, 1300 * 10); + vbt->t11_t12 =3D max_t(u16, vbt->t11_t12, 1300 * 10); drm_dbg_kms(&dev_priv->drm, "Increasing T12 panel delay as per the quirk to %d\n", - vbt.t11_t12); + vbt->t11_t12); } + /* T11_T12 delay is special and actually in units of 100ms, but zero * based in the hw (so we need to add 100 ms). But the sw vbt * table multiplies it with 1000 to make it in units of 100usec, * too. */ - vbt.t11_t12 +=3D 100 * 10; + vbt->t11_t12 +=3D 100 * 10; + + intel_pps_dump_state(intel_dp, "vbt", vbt); +} + +static void pps_init_delays_spec(struct intel_dp *intel_dp, + struct edp_power_seq *spec) +{ + struct drm_i915_private *dev_priv =3D dp_to_i915(intel_dp); + + lockdep_assert_held(&dev_priv->pps_mutex); =20 /* Upper limits from eDP 1.3 spec. Note that we use the clunky units of * our hw here, which are all in 100usec. */ - spec.t1_t3 =3D 210 * 10; - spec.t8 =3D 50 * 10; /* no limit for t8, use t7 instead */ - spec.t9 =3D 50 * 10; /* no limit for t9, make it symmetric with t8 */ - spec.t10 =3D 500 * 10; + spec->t1_t3 =3D 210 * 10; + spec->t8 =3D 50 * 10; /* no limit for t8, use t7 instead */ + spec->t9 =3D 50 * 10; /* no limit for t9, make it symmetric with t8 */ + spec->t10 =3D 500 * 10; /* This one is special and actually in units of 100ms, but zero * based in the hw (so we need to add 100 ms). But the sw vbt * table multiplies it with 1000 to make it in units of 100usec, * too. */ - spec.t11_t12 =3D (510 + 100) * 10; + spec->t11_t12 =3D (510 + 100) * 10; + + intel_pps_dump_state(intel_dp, "spec", spec); +} + +static void pps_init_delays(struct intel_dp *intel_dp) +{ + struct drm_i915_private *dev_priv =3D dp_to_i915(intel_dp); + struct edp_power_seq cur, vbt, spec, + *final =3D &intel_dp->pps.pps_delays; + + lockdep_assert_held(&dev_priv->pps_mutex); + + /* already initialized? */ + if (final->t11_t12 !=3D 0) + return; =20 - intel_pps_dump_state(intel_dp, "vbt", &vbt); + pps_init_delays_cur(intel_dp, &cur); + pps_init_delays_vbt(intel_dp, &vbt); + pps_init_delays_spec(intel_dp, &spec); =20 /* Use the max of the register settings and vbt. If both are * unset, fall back to the spec limits. */ --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6F03C32771 for ; Mon, 26 Sep 2022 11:33:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235082AbiIZLdM (ORCPT ); Mon, 26 Sep 2022 07:33:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237978AbiIZLcQ (ORCPT ); Mon, 26 Sep 2022 07:32:16 -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 5F13D4D4E5; Mon, 26 Sep 2022 03:42:49 -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 D0C0AB80760; Mon, 26 Sep 2022 10:42:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DBDDC433D6; Mon, 26 Sep 2022 10:42:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188967; bh=pjyeZDQTVBOZdHRAGowF2lpTQHt4ee9V19vOWpiWexI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pfyx43LvSGfiBWaymTSKatxCvNdekurRBpV0CiKByHc3+gJrjn5JghVVoMurtNTqf ck9UQyCExg/WXL5DVx9raC9s0DKJGENH/UYMi9iRu1H9Mo0CYqCVKi6HlgmNCgqQG9 xFGd29rnQkbGF5d14YF33DrJBtTwoV2/3qZ7Xb8c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jani Nikula , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Sasha Levin Subject: [PATCH 5.19 003/207] drm/i915/bios: Split parse_driver_features() into two parts Date: Mon, 26 Sep 2022 12:09:52 +0200 Message-Id: <20220926100806.663960091@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ville Syrj=C3=A4l=C3=A4 [ Upstream commit c3fbcf60bc74b630967f291f47f0d9d0de6fcea7 ] We use the "driver features" block for two different kinds of data: global data, and per panel data. Split the function into two parts along that line so that we can start doing the parsing in two different locations. Reviewed-by: Jani Nikula Signed-off-by: Ville Syrj=C3=A4l=C3=A4 Link: https://patchwork.freedesktop.org/patch/msgid/20220510104242.6099-11-= ville.syrjala@linux.intel.com Stable-dep-of: 607f41768a1e ("drm/i915/dsi: filter invalid backlight and CA= BC ports") Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/i915/display/intel_bios.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i9= 15/display/intel_bios.c index 91caf4523b34..5ceabc380808 100644 --- a/drivers/gpu/drm/i915/display/intel_bios.c +++ b/drivers/gpu/drm/i915/display/intel_bios.c @@ -1188,6 +1188,16 @@ parse_driver_features(struct drm_i915_private *i915) driver->lvds_config !=3D BDB_DRIVER_FEATURE_INT_SDVO_LVDS) i915->vbt.int_lvds_support =3D 0; } +} + +static void +parse_panel_driver_features(struct drm_i915_private *i915) +{ + const struct bdb_driver_features *driver; + + driver =3D find_section(i915, BDB_DRIVER_FEATURES); + if (!driver) + return; =20 if (i915->vbt.version < 228) { drm_dbg_kms(&i915->drm, "DRRS State Enabled:%d\n", @@ -2965,6 +2975,7 @@ void intel_bios_init(struct drm_i915_private *i915) parse_lfp_backlight(i915); parse_sdvo_panel_data(i915); parse_driver_features(i915); + parse_panel_driver_features(i915); parse_power_conservation_features(i915); parse_edp(i915); parse_psr(i915); --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F579C32771 for ; Mon, 26 Sep 2022 12:15:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239399AbiIZMPl (ORCPT ); Mon, 26 Sep 2022 08:15:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239365AbiIZMPA (ORCPT ); Mon, 26 Sep 2022 08:15:00 -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 2DEA3EE1A; Mon, 26 Sep 2022 03:59:38 -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 3865F60A5B; Mon, 26 Sep 2022 10:42:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F6B9C433D6; Mon, 26 Sep 2022 10:42:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188970; bh=qiAtx4nM4YVJnX2eKxyU5dvImu1sEbPiukUfSOlhmkQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tYRdBvmKYMR/XB+Udht2hFH1pharmJW97LkNe4D2cYTnCtI5CAcc+JtZXZQaTWuth 029GlhQkdJBaUgbchRrj1/a6lPQmYaYq+DdXE3iO6Zh/cIm0GfHqhsf59h6gssVpP6 kV/k+O5ZC2Os622KKkdLZumX0139QP+tmgUV3yYw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jani Nikula , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Sasha Levin Subject: [PATCH 5.19 004/207] drm/i915/bios: Split VBT parsing to global vs. panel specific parts Date: Mon, 26 Sep 2022 12:09:53 +0200 Message-Id: <20220926100806.695308865@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ville Syrj=C3=A4l=C3=A4 [ Upstream commit c2fdb424d32204faf5be29d55f0086b611c94e38 ] Parsing the panel specific data (anything that depends on panel_type) from VBT is currently happening too early. Split the whole thing into global vs. panel specific parts so that we can start doing the panel specific parsing at a later time. v2: Clarify that this is about panel_type (Jani) Split out the leak checks (Jani) Reviewed-by: Jani Nikula Signed-off-by: Ville Syrj=C3=A4l=C3=A4 Link: https://patchwork.freedesktop.org/patch/msgid/20220510104242.6099-12-= ville.syrjala@linux.intel.com Stable-dep-of: 607f41768a1e ("drm/i915/dsi: filter invalid backlight and CA= BC ports") Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/i915/display/intel_bios.c | 26 +++++++++++--------- drivers/gpu/drm/i915/display/intel_bios.h | 1 + drivers/gpu/drm/i915/display/intel_display.c | 1 + 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i9= 15/display/intel_bios.c index 5ceabc380808..d5cae64b916b 100644 --- a/drivers/gpu/drm/i915/display/intel_bios.c +++ b/drivers/gpu/drm/i915/display/intel_bios.c @@ -2969,18 +2969,7 @@ void intel_bios_init(struct drm_i915_private *i915) /* Grab useful general definitions */ parse_general_features(i915); parse_general_definitions(i915); - parse_panel_options(i915); - parse_generic_dtd(i915); - parse_lfp_data(i915); - parse_lfp_backlight(i915); - parse_sdvo_panel_data(i915); parse_driver_features(i915); - parse_panel_driver_features(i915); - parse_power_conservation_features(i915); - parse_edp(i915); - parse_psr(i915); - parse_mipi_config(i915); - parse_mipi_sequence(i915); =20 /* Depends on child device list */ parse_compression_parameters(i915); @@ -2999,6 +2988,21 @@ void intel_bios_init(struct drm_i915_private *i915) kfree(oprom_vbt); } =20 +void intel_bios_init_panel(struct drm_i915_private *i915) +{ + parse_panel_options(i915); + parse_generic_dtd(i915); + parse_lfp_data(i915); + parse_lfp_backlight(i915); + parse_sdvo_panel_data(i915); + parse_panel_driver_features(i915); + parse_power_conservation_features(i915); + parse_edp(i915); + parse_psr(i915); + parse_mipi_config(i915); + parse_mipi_sequence(i915); +} + /** * intel_bios_driver_remove - Free any resources allocated by intel_bios_i= nit() * @i915: i915 device instance diff --git a/drivers/gpu/drm/i915/display/intel_bios.h b/drivers/gpu/drm/i9= 15/display/intel_bios.h index 4709c4d29805..c744d75fa435 100644 --- a/drivers/gpu/drm/i915/display/intel_bios.h +++ b/drivers/gpu/drm/i915/display/intel_bios.h @@ -230,6 +230,7 @@ struct mipi_pps_data { } __packed; =20 void intel_bios_init(struct drm_i915_private *dev_priv); +void intel_bios_init_panel(struct drm_i915_private *dev_priv); void intel_bios_driver_remove(struct drm_i915_private *dev_priv); bool intel_bios_is_valid_vbt(const void *buf, size_t size); bool intel_bios_is_tv_present(struct drm_i915_private *dev_priv); diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm= /i915/display/intel_display.c index 806d50b302ab..e384db157f34 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -9580,6 +9580,7 @@ int intel_modeset_init_noirq(struct drm_i915_private = *i915) } =20 intel_bios_init(i915); + intel_bios_init_panel(i915); =20 ret =3D intel_vga_register(i915); if (ret) --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6ABC8C6FA83 for ; Mon, 26 Sep 2022 11:35:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238028AbiIZLfI (ORCPT ); Mon, 26 Sep 2022 07:35:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238082AbiIZLdv (ORCPT ); Mon, 26 Sep 2022 07:33:51 -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 3149A6D9F9; Mon, 26 Sep 2022 03:42:55 -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 9C9A660B55; Mon, 26 Sep 2022 10:42:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 415F0C433C1; Mon, 26 Sep 2022 10:42:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188974; bh=rYRiHNiz0bgWTj/2CgM2Bv2sdnjqAlesyi0YTdO78lw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uBmoPZ7kxwJG+gmIb9o2rrhcqJzG16gKZQRxcFrUP3N3Y1UuzjcT5tslXMZJt2r9Q v1UuZyXRDkBWwQ75IygWIl/nFds+1HyJ/6IJIilbRXwm4LDzlbFSUPG8Qmz/eQVF77 PYL9ejNCjYlRoyo6+tZz4UoCllPTA0ybHNnWc3yI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Jani Nikula , Sasha Levin Subject: [PATCH 5.19 005/207] drm/i915/bios: Split VBT data into per-panel vs. global parts Date: Mon, 26 Sep 2022 12:09:54 +0200 Message-Id: <20220926100806.735849072@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ville Syrj=C3=A4l=C3=A4 [ Upstream commit 3cf050762534cc268a02793ec00240f81c6e2229 ] Move the panel specific VBT parsing to happen during the output probing stage. Needs to be done because the VBT parsing will need to look at the EDID to determine the correct panel_type on some machines. We split the parsed VBT data (i915->vbt) along the same boundary. For the moment we just hoist all the panel specific stuff into connector->panel.vbt since that seems like the most convenient place for eg. the backlight code. Note that we simply drop the drrs type check from intel_drrs_frontbuffer_update() since that operates on the whole device rather than a specific connector/encoder. But the check was just a micro optimization so removing it doesn't actually mattter for correctness. TODO: Lot's of cleanup to be done in the future. Eg. most of the DSI stuff could probably be eliminated entirely and just parsed on demand during DSI init. v2: Note the intel_drrs_frontbuffer_update() change Signed-off-by: Ville Syrj=C3=A4l=C3=A4 Link: https://patchwork.freedesktop.org/patch/msgid/20220510104242.6099-13-= ville.syrjala@linux.intel.com Reviewed-by: Jani Nikula Stable-dep-of: 607f41768a1e ("drm/i915/dsi: filter invalid backlight and CA= BC ports") Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/i915/display/icl_dsi.c | 11 +- .../gpu/drm/i915/display/intel_backlight.c | 23 +- drivers/gpu/drm/i915/display/intel_bios.c | 371 ++++++++++-------- drivers/gpu/drm/i915/display/intel_bios.h | 5 +- .../drm/i915/display/intel_ddi_buf_trans.c | 9 +- drivers/gpu/drm/i915/display/intel_display.c | 1 - .../drm/i915/display/intel_display_types.h | 69 ++++ drivers/gpu/drm/i915/display/intel_dp.c | 21 +- drivers/gpu/drm/i915/display/intel_dp.h | 1 + .../drm/i915/display/intel_dp_aux_backlight.c | 6 +- drivers/gpu/drm/i915/display/intel_drrs.c | 3 - drivers/gpu/drm/i915/display/intel_dsi.c | 2 +- .../i915/display/intel_dsi_dcs_backlight.c | 9 +- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 56 +-- drivers/gpu/drm/i915/display/intel_lvds.c | 6 +- drivers/gpu/drm/i915/display/intel_panel.c | 13 +- drivers/gpu/drm/i915/display/intel_pps.c | 6 +- drivers/gpu/drm/i915/display/intel_psr.c | 30 +- drivers/gpu/drm/i915/display/intel_sdvo.c | 3 + drivers/gpu/drm/i915/display/vlv_dsi.c | 14 +- drivers/gpu/drm/i915/i915_drv.h | 63 --- 21 files changed, 391 insertions(+), 331 deletions(-) diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/= display/icl_dsi.c index 5508ebb9eb43..5c46acb46516 100644 --- a/drivers/gpu/drm/i915/display/icl_dsi.c +++ b/drivers/gpu/drm/i915/display/icl_dsi.c @@ -1864,7 +1864,8 @@ static void icl_dphy_param_init(struct intel_dsi *int= el_dsi) { struct drm_device *dev =3D intel_dsi->base.base.dev; struct drm_i915_private *dev_priv =3D to_i915(dev); - struct mipi_config *mipi_config =3D dev_priv->vbt.dsi.config; + struct intel_connector *connector =3D intel_dsi->attached_connector; + struct mipi_config *mipi_config =3D connector->panel.vbt.dsi.config; u32 tlpx_ns; u32 prepare_cnt, exit_zero_cnt, clk_zero_cnt, trail_cnt; u32 ths_prepare_ns, tclk_trail_ns; @@ -2051,6 +2052,8 @@ void icl_dsi_init(struct drm_i915_private *dev_priv) /* attach connector to encoder */ intel_connector_attach_encoder(intel_connector, encoder); =20 + intel_bios_init_panel(dev_priv, &intel_connector->panel); + mutex_lock(&dev->mode_config.mutex); intel_panel_add_vbt_lfp_fixed_mode(intel_connector); mutex_unlock(&dev->mode_config.mutex); @@ -2064,13 +2067,13 @@ void icl_dsi_init(struct drm_i915_private *dev_priv) =20 intel_backlight_setup(intel_connector, INVALID_PIPE); =20 - if (dev_priv->vbt.dsi.config->dual_link) + if (intel_connector->panel.vbt.dsi.config->dual_link) intel_dsi->ports =3D BIT(PORT_A) | BIT(PORT_B); else intel_dsi->ports =3D BIT(port); =20 - intel_dsi->dcs_backlight_ports =3D dev_priv->vbt.dsi.bl_ports; - intel_dsi->dcs_cabc_ports =3D dev_priv->vbt.dsi.cabc_ports; + intel_dsi->dcs_backlight_ports =3D intel_connector->panel.vbt.dsi.bl_port= s; + intel_dsi->dcs_cabc_ports =3D intel_connector->panel.vbt.dsi.cabc_ports; =20 for_each_dsi_port(port, intel_dsi->ports) { struct intel_dsi_host *host; diff --git a/drivers/gpu/drm/i915/display/intel_backlight.c b/drivers/gpu/d= rm/i915/display/intel_backlight.c index 3e200a2e4ba2..5182bb66bd28 100644 --- a/drivers/gpu/drm/i915/display/intel_backlight.c +++ b/drivers/gpu/drm/i915/display/intel_backlight.c @@ -1158,9 +1158,10 @@ static u32 vlv_hz_to_pwm(struct intel_connector *con= nector, u32 pwm_freq_hz) return DIV_ROUND_CLOSEST(clock, pwm_freq_hz * mul); } =20 -static u16 get_vbt_pwm_freq(struct drm_i915_private *dev_priv) +static u16 get_vbt_pwm_freq(struct intel_connector *connector) { - u16 pwm_freq_hz =3D dev_priv->vbt.backlight.pwm_freq_hz; + struct drm_i915_private *dev_priv =3D to_i915(connector->base.dev); + u16 pwm_freq_hz =3D connector->panel.vbt.backlight.pwm_freq_hz; =20 if (pwm_freq_hz) { drm_dbg_kms(&dev_priv->drm, @@ -1180,7 +1181,7 @@ static u32 get_backlight_max_vbt(struct intel_connect= or *connector) { struct drm_i915_private *dev_priv =3D to_i915(connector->base.dev); struct intel_panel *panel =3D &connector->panel; - u16 pwm_freq_hz =3D get_vbt_pwm_freq(dev_priv); + u16 pwm_freq_hz =3D get_vbt_pwm_freq(connector); u32 pwm; =20 if (!panel->backlight.pwm_funcs->hz_to_pwm) { @@ -1217,11 +1218,11 @@ static u32 get_backlight_min_vbt(struct intel_conne= ctor *connector) * against this by letting the minimum be at most (arbitrarily chosen) * 25% of the max. */ - min =3D clamp_t(int, dev_priv->vbt.backlight.min_brightness, 0, 64); - if (min !=3D dev_priv->vbt.backlight.min_brightness) { + min =3D clamp_t(int, connector->panel.vbt.backlight.min_brightness, 0, 64= ); + if (min !=3D connector->panel.vbt.backlight.min_brightness) { drm_dbg_kms(&dev_priv->drm, "clamping VBT min backlight %d/255 to %d/255\n", - dev_priv->vbt.backlight.min_brightness, min); + connector->panel.vbt.backlight.min_brightness, min); } =20 /* vbt value is a coefficient in range [0..255] */ @@ -1410,7 +1411,7 @@ bxt_setup_backlight(struct intel_connector *connector= , enum pipe unused) struct intel_panel *panel =3D &connector->panel; u32 pwm_ctl, val; =20 - panel->backlight.controller =3D dev_priv->vbt.backlight.controller; + panel->backlight.controller =3D connector->panel.vbt.backlight.controller; =20 pwm_ctl =3D intel_de_read(dev_priv, BXT_BLC_PWM_CTL(panel->backlight.controller)); @@ -1483,7 +1484,7 @@ static int ext_pwm_setup_backlight(struct intel_conne= ctor *connector, u32 level; =20 /* Get the right PWM chip for DSI backlight according to VBT */ - if (dev_priv->vbt.dsi.config->pwm_blc =3D=3D PPS_BLC_PMIC) { + if (connector->panel.vbt.dsi.config->pwm_blc =3D=3D PPS_BLC_PMIC) { panel->backlight.pwm =3D pwm_get(dev->dev, "pwm_pmic_backlight"); desc =3D "PMIC"; } else { @@ -1512,11 +1513,11 @@ static int ext_pwm_setup_backlight(struct intel_con= nector *connector, =20 drm_dbg_kms(&dev_priv->drm, "PWM already enabled at freq %ld, VBT freq %= d, level %d\n", NSEC_PER_SEC / (unsigned long)panel->backlight.pwm_state.period, - get_vbt_pwm_freq(dev_priv), level); + get_vbt_pwm_freq(connector), level); } else { /* Set period from VBT frequency, leave other settings at 0. */ panel->backlight.pwm_state.period =3D - NSEC_PER_SEC / get_vbt_pwm_freq(dev_priv); + NSEC_PER_SEC / get_vbt_pwm_freq(connector); } =20 drm_info(&dev_priv->drm, "Using %s PWM for LCD backlight control\n", @@ -1601,7 +1602,7 @@ int intel_backlight_setup(struct intel_connector *con= nector, enum pipe pipe) struct intel_panel *panel =3D &connector->panel; int ret; =20 - if (!dev_priv->vbt.backlight.present) { + if (!connector->panel.vbt.backlight.present) { if (dev_priv->quirks & QUIRK_BACKLIGHT_PRESENT) { drm_dbg_kms(&dev_priv->drm, "no backlight present per VBT, but present per quirk\n"); diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i9= 15/display/intel_bios.c index d5cae64b916b..d5d20a44f373 100644 --- a/drivers/gpu/drm/i915/display/intel_bios.c +++ b/drivers/gpu/drm/i915/display/intel_bios.c @@ -682,7 +682,8 @@ static int get_panel_type(struct drm_i915_private *i915) =20 /* Parse general panel options */ static void -parse_panel_options(struct drm_i915_private *i915) +parse_panel_options(struct drm_i915_private *i915, + struct intel_panel *panel) { const struct bdb_lvds_options *lvds_options; int panel_type; @@ -692,11 +693,11 @@ parse_panel_options(struct drm_i915_private *i915) if (!lvds_options) return; =20 - i915->vbt.lvds_dither =3D lvds_options->pixel_dither; + panel->vbt.lvds_dither =3D lvds_options->pixel_dither; =20 panel_type =3D get_panel_type(i915); =20 - i915->vbt.panel_type =3D panel_type; + panel->vbt.panel_type =3D panel_type; =20 drrs_mode =3D (lvds_options->dps_panel_type_bits >> (panel_type * 2)) & MODE_MASK; @@ -707,16 +708,16 @@ parse_panel_options(struct drm_i915_private *i915) */ switch (drrs_mode) { case 0: - i915->vbt.drrs_type =3D DRRS_TYPE_STATIC; + panel->vbt.drrs_type =3D DRRS_TYPE_STATIC; drm_dbg_kms(&i915->drm, "DRRS supported mode is static\n"); break; case 2: - i915->vbt.drrs_type =3D DRRS_TYPE_SEAMLESS; + panel->vbt.drrs_type =3D DRRS_TYPE_SEAMLESS; drm_dbg_kms(&i915->drm, "DRRS supported mode is seamless\n"); break; default: - i915->vbt.drrs_type =3D DRRS_TYPE_NONE; + panel->vbt.drrs_type =3D DRRS_TYPE_NONE; drm_dbg_kms(&i915->drm, "DRRS not supported (VBT input)\n"); break; @@ -725,13 +726,14 @@ parse_panel_options(struct drm_i915_private *i915) =20 static void parse_lfp_panel_dtd(struct drm_i915_private *i915, + struct intel_panel *panel, const struct bdb_lvds_lfp_data *lvds_lfp_data, const struct bdb_lvds_lfp_data_ptrs *lvds_lfp_data_ptrs) { const struct lvds_dvo_timing *panel_dvo_timing; const struct lvds_fp_timing *fp_timing; struct drm_display_mode *panel_fixed_mode; - int panel_type =3D i915->vbt.panel_type; + int panel_type =3D panel->vbt.panel_type; =20 panel_dvo_timing =3D get_lvds_dvo_timing(lvds_lfp_data, lvds_lfp_data_ptrs, @@ -743,7 +745,7 @@ parse_lfp_panel_dtd(struct drm_i915_private *i915, =20 fill_detail_timing_data(panel_fixed_mode, panel_dvo_timing); =20 - i915->vbt.lfp_lvds_vbt_mode =3D panel_fixed_mode; + panel->vbt.lfp_lvds_vbt_mode =3D panel_fixed_mode; =20 drm_dbg_kms(&i915->drm, "Found panel mode in BIOS VBT legacy lfp table: " DRM_MODE_FMT "\n", @@ -756,20 +758,21 @@ parse_lfp_panel_dtd(struct drm_i915_private *i915, /* check the resolution, just to be sure */ if (fp_timing->x_res =3D=3D panel_fixed_mode->hdisplay && fp_timing->y_res =3D=3D panel_fixed_mode->vdisplay) { - i915->vbt.bios_lvds_val =3D fp_timing->lvds_reg_val; + panel->vbt.bios_lvds_val =3D fp_timing->lvds_reg_val; drm_dbg_kms(&i915->drm, "VBT initial LVDS value %x\n", - i915->vbt.bios_lvds_val); + panel->vbt.bios_lvds_val); } } =20 static void -parse_lfp_data(struct drm_i915_private *i915) +parse_lfp_data(struct drm_i915_private *i915, + struct intel_panel *panel) { const struct bdb_lvds_lfp_data *data; const struct bdb_lvds_lfp_data_tail *tail; const struct bdb_lvds_lfp_data_ptrs *ptrs; - int panel_type =3D i915->vbt.panel_type; + int panel_type =3D panel->vbt.panel_type; =20 ptrs =3D find_section(i915, BDB_LVDS_LFP_DATA_PTRS); if (!ptrs) @@ -779,24 +782,25 @@ parse_lfp_data(struct drm_i915_private *i915) if (!data) return; =20 - if (!i915->vbt.lfp_lvds_vbt_mode) - parse_lfp_panel_dtd(i915, data, ptrs); + if (!panel->vbt.lfp_lvds_vbt_mode) + parse_lfp_panel_dtd(i915, panel, data, ptrs); =20 tail =3D get_lfp_data_tail(data, ptrs); if (!tail) return; =20 if (i915->vbt.version >=3D 188) { - i915->vbt.seamless_drrs_min_refresh_rate =3D + panel->vbt.seamless_drrs_min_refresh_rate =3D tail->seamless_drrs_min_refresh_rate[panel_type]; drm_dbg_kms(&i915->drm, "Seamless DRRS min refresh rate: %d Hz\n", - i915->vbt.seamless_drrs_min_refresh_rate); + panel->vbt.seamless_drrs_min_refresh_rate); } } =20 static void -parse_generic_dtd(struct drm_i915_private *i915) +parse_generic_dtd(struct drm_i915_private *i915, + struct intel_panel *panel) { const struct bdb_generic_dtd *generic_dtd; const struct generic_dtd_entry *dtd; @@ -831,14 +835,14 @@ parse_generic_dtd(struct drm_i915_private *i915) =20 num_dtd =3D (get_blocksize(generic_dtd) - sizeof(struct bdb_generic_dtd)) / generic_dtd->gdtd_size; - if (i915->vbt.panel_type >=3D num_dtd) { + if (panel->vbt.panel_type >=3D num_dtd) { drm_err(&i915->drm, "Panel type %d not found in table of %d DTD's\n", - i915->vbt.panel_type, num_dtd); + panel->vbt.panel_type, num_dtd); return; } =20 - dtd =3D &generic_dtd->dtd[i915->vbt.panel_type]; + dtd =3D &generic_dtd->dtd[panel->vbt.panel_type]; =20 panel_fixed_mode =3D kzalloc(sizeof(*panel_fixed_mode), GFP_KERNEL); if (!panel_fixed_mode) @@ -881,15 +885,16 @@ parse_generic_dtd(struct drm_i915_private *i915) "Found panel mode in BIOS VBT generic dtd table: " DRM_MODE_FMT "\n", DRM_MODE_ARG(panel_fixed_mode)); =20 - i915->vbt.lfp_lvds_vbt_mode =3D panel_fixed_mode; + panel->vbt.lfp_lvds_vbt_mode =3D panel_fixed_mode; } =20 static void -parse_lfp_backlight(struct drm_i915_private *i915) +parse_lfp_backlight(struct drm_i915_private *i915, + struct intel_panel *panel) { const struct bdb_lfp_backlight_data *backlight_data; const struct lfp_backlight_data_entry *entry; - int panel_type =3D i915->vbt.panel_type; + int panel_type =3D panel->vbt.panel_type; u16 level; =20 backlight_data =3D find_section(i915, BDB_LVDS_BACKLIGHT); @@ -905,15 +910,15 @@ parse_lfp_backlight(struct drm_i915_private *i915) =20 entry =3D &backlight_data->data[panel_type]; =20 - i915->vbt.backlight.present =3D entry->type =3D=3D BDB_BACKLIGHT_TYPE_PWM; - if (!i915->vbt.backlight.present) { + panel->vbt.backlight.present =3D entry->type =3D=3D BDB_BACKLIGHT_TYPE_PW= M; + if (!panel->vbt.backlight.present) { drm_dbg_kms(&i915->drm, "PWM backlight not present in VBT (type %u)\n", entry->type); return; } =20 - i915->vbt.backlight.type =3D INTEL_BACKLIGHT_DISPLAY_DDI; + panel->vbt.backlight.type =3D INTEL_BACKLIGHT_DISPLAY_DDI; if (i915->vbt.version >=3D 191) { size_t exp_size; =20 @@ -928,13 +933,13 @@ parse_lfp_backlight(struct drm_i915_private *i915) const struct lfp_backlight_control_method *method; =20 method =3D &backlight_data->backlight_control[panel_type]; - i915->vbt.backlight.type =3D method->type; - i915->vbt.backlight.controller =3D method->controller; + panel->vbt.backlight.type =3D method->type; + panel->vbt.backlight.controller =3D method->controller; } } =20 - i915->vbt.backlight.pwm_freq_hz =3D entry->pwm_freq_hz; - i915->vbt.backlight.active_low_pwm =3D entry->active_low_pwm; + panel->vbt.backlight.pwm_freq_hz =3D entry->pwm_freq_hz; + panel->vbt.backlight.active_low_pwm =3D entry->active_low_pwm; =20 if (i915->vbt.version >=3D 234) { u16 min_level; @@ -955,28 +960,29 @@ parse_lfp_backlight(struct drm_i915_private *i915) drm_warn(&i915->drm, "Brightness min level > 255\n"); level =3D 255; } - i915->vbt.backlight.min_brightness =3D min_level; + panel->vbt.backlight.min_brightness =3D min_level; =20 - i915->vbt.backlight.brightness_precision_bits =3D + panel->vbt.backlight.brightness_precision_bits =3D backlight_data->brightness_precision_bits[panel_type]; } else { level =3D backlight_data->level[panel_type]; - i915->vbt.backlight.min_brightness =3D entry->min_brightness; + panel->vbt.backlight.min_brightness =3D entry->min_brightness; } =20 drm_dbg_kms(&i915->drm, "VBT backlight PWM modulation frequency %u Hz, " "active %s, min brightness %u, level %u, controller %u\n", - i915->vbt.backlight.pwm_freq_hz, - i915->vbt.backlight.active_low_pwm ? "low" : "high", - i915->vbt.backlight.min_brightness, + panel->vbt.backlight.pwm_freq_hz, + panel->vbt.backlight.active_low_pwm ? "low" : "high", + panel->vbt.backlight.min_brightness, level, - i915->vbt.backlight.controller); + panel->vbt.backlight.controller); } =20 /* Try to find sdvo panel data */ static void -parse_sdvo_panel_data(struct drm_i915_private *i915) +parse_sdvo_panel_data(struct drm_i915_private *i915, + struct intel_panel *panel) { const struct bdb_sdvo_panel_dtds *dtds; struct drm_display_mode *panel_fixed_mode; @@ -1009,7 +1015,7 @@ parse_sdvo_panel_data(struct drm_i915_private *i915) =20 fill_detail_timing_data(panel_fixed_mode, &dtds->dtds[index]); =20 - i915->vbt.sdvo_lvds_vbt_mode =3D panel_fixed_mode; + panel->vbt.sdvo_lvds_vbt_mode =3D panel_fixed_mode; =20 drm_dbg_kms(&i915->drm, "Found SDVO panel mode in BIOS VBT tables: " DRM_MODE_FMT "\n", @@ -1191,7 +1197,8 @@ parse_driver_features(struct drm_i915_private *i915) } =20 static void -parse_panel_driver_features(struct drm_i915_private *i915) +parse_panel_driver_features(struct drm_i915_private *i915, + struct intel_panel *panel) { const struct bdb_driver_features *driver; =20 @@ -1209,17 +1216,18 @@ parse_panel_driver_features(struct drm_i915_private= *i915) * driver->drrs_enabled=3Dfalse */ if (!driver->drrs_enabled) - i915->vbt.drrs_type =3D DRRS_TYPE_NONE; + panel->vbt.drrs_type =3D DRRS_TYPE_NONE; =20 - i915->vbt.psr.enable =3D driver->psr_enabled; + panel->vbt.psr.enable =3D driver->psr_enabled; } } =20 static void -parse_power_conservation_features(struct drm_i915_private *i915) +parse_power_conservation_features(struct drm_i915_private *i915, + struct intel_panel *panel) { const struct bdb_lfp_power *power; - u8 panel_type =3D i915->vbt.panel_type; + u8 panel_type =3D panel->vbt.panel_type; =20 if (i915->vbt.version < 228) return; @@ -1228,7 +1236,7 @@ parse_power_conservation_features(struct drm_i915_pri= vate *i915) if (!power) return; =20 - i915->vbt.psr.enable =3D power->psr & BIT(panel_type); + panel->vbt.psr.enable =3D power->psr & BIT(panel_type); =20 /* * If DRRS is not supported, drrs_type has to be set to 0. @@ -1237,19 +1245,20 @@ parse_power_conservation_features(struct drm_i915_p= rivate *i915) * power->drrs & BIT(panel_type)=3Dfalse */ if (!(power->drrs & BIT(panel_type))) - i915->vbt.drrs_type =3D DRRS_TYPE_NONE; + panel->vbt.drrs_type =3D DRRS_TYPE_NONE; =20 if (i915->vbt.version >=3D 232) - i915->vbt.edp.hobl =3D power->hobl & BIT(panel_type); + panel->vbt.edp.hobl =3D power->hobl & BIT(panel_type); } =20 static void -parse_edp(struct drm_i915_private *i915) +parse_edp(struct drm_i915_private *i915, + struct intel_panel *panel) { const struct bdb_edp *edp; const struct edp_power_seq *edp_pps; const struct edp_fast_link_params *edp_link_params; - int panel_type =3D i915->vbt.panel_type; + int panel_type =3D panel->vbt.panel_type; =20 edp =3D find_section(i915, BDB_EDP); if (!edp) @@ -1257,13 +1266,13 @@ parse_edp(struct drm_i915_private *i915) =20 switch ((edp->color_depth >> (panel_type * 2)) & 3) { case EDP_18BPP: - i915->vbt.edp.bpp =3D 18; + panel->vbt.edp.bpp =3D 18; break; case EDP_24BPP: - i915->vbt.edp.bpp =3D 24; + panel->vbt.edp.bpp =3D 24; break; case EDP_30BPP: - i915->vbt.edp.bpp =3D 30; + panel->vbt.edp.bpp =3D 30; break; } =20 @@ -1271,14 +1280,14 @@ parse_edp(struct drm_i915_private *i915) edp_pps =3D &edp->power_seqs[panel_type]; edp_link_params =3D &edp->fast_link_params[panel_type]; =20 - i915->vbt.edp.pps =3D *edp_pps; + panel->vbt.edp.pps =3D *edp_pps; =20 switch (edp_link_params->rate) { case EDP_RATE_1_62: - i915->vbt.edp.rate =3D DP_LINK_BW_1_62; + panel->vbt.edp.rate =3D DP_LINK_BW_1_62; break; case EDP_RATE_2_7: - i915->vbt.edp.rate =3D DP_LINK_BW_2_7; + panel->vbt.edp.rate =3D DP_LINK_BW_2_7; break; default: drm_dbg_kms(&i915->drm, @@ -1289,13 +1298,13 @@ parse_edp(struct drm_i915_private *i915) =20 switch (edp_link_params->lanes) { case EDP_LANE_1: - i915->vbt.edp.lanes =3D 1; + panel->vbt.edp.lanes =3D 1; break; case EDP_LANE_2: - i915->vbt.edp.lanes =3D 2; + panel->vbt.edp.lanes =3D 2; break; case EDP_LANE_4: - i915->vbt.edp.lanes =3D 4; + panel->vbt.edp.lanes =3D 4; break; default: drm_dbg_kms(&i915->drm, @@ -1306,16 +1315,16 @@ parse_edp(struct drm_i915_private *i915) =20 switch (edp_link_params->preemphasis) { case EDP_PREEMPHASIS_NONE: - i915->vbt.edp.preemphasis =3D DP_TRAIN_PRE_EMPH_LEVEL_0; + panel->vbt.edp.preemphasis =3D DP_TRAIN_PRE_EMPH_LEVEL_0; break; case EDP_PREEMPHASIS_3_5dB: - i915->vbt.edp.preemphasis =3D DP_TRAIN_PRE_EMPH_LEVEL_1; + panel->vbt.edp.preemphasis =3D DP_TRAIN_PRE_EMPH_LEVEL_1; break; case EDP_PREEMPHASIS_6dB: - i915->vbt.edp.preemphasis =3D DP_TRAIN_PRE_EMPH_LEVEL_2; + panel->vbt.edp.preemphasis =3D DP_TRAIN_PRE_EMPH_LEVEL_2; break; case EDP_PREEMPHASIS_9_5dB: - i915->vbt.edp.preemphasis =3D DP_TRAIN_PRE_EMPH_LEVEL_3; + panel->vbt.edp.preemphasis =3D DP_TRAIN_PRE_EMPH_LEVEL_3; break; default: drm_dbg_kms(&i915->drm, @@ -1326,16 +1335,16 @@ parse_edp(struct drm_i915_private *i915) =20 switch (edp_link_params->vswing) { case EDP_VSWING_0_4V: - i915->vbt.edp.vswing =3D DP_TRAIN_VOLTAGE_SWING_LEVEL_0; + panel->vbt.edp.vswing =3D DP_TRAIN_VOLTAGE_SWING_LEVEL_0; break; case EDP_VSWING_0_6V: - i915->vbt.edp.vswing =3D DP_TRAIN_VOLTAGE_SWING_LEVEL_1; + panel->vbt.edp.vswing =3D DP_TRAIN_VOLTAGE_SWING_LEVEL_1; break; case EDP_VSWING_0_8V: - i915->vbt.edp.vswing =3D DP_TRAIN_VOLTAGE_SWING_LEVEL_2; + panel->vbt.edp.vswing =3D DP_TRAIN_VOLTAGE_SWING_LEVEL_2; break; case EDP_VSWING_1_2V: - i915->vbt.edp.vswing =3D DP_TRAIN_VOLTAGE_SWING_LEVEL_3; + panel->vbt.edp.vswing =3D DP_TRAIN_VOLTAGE_SWING_LEVEL_3; break; default: drm_dbg_kms(&i915->drm, @@ -1349,24 +1358,25 @@ parse_edp(struct drm_i915_private *i915) =20 /* Don't read from VBT if module parameter has valid value*/ if (i915->params.edp_vswing) { - i915->vbt.edp.low_vswing =3D + panel->vbt.edp.low_vswing =3D i915->params.edp_vswing =3D=3D 1; } else { vswing =3D (edp->edp_vswing_preemph >> (panel_type * 4)) & 0xF; - i915->vbt.edp.low_vswing =3D vswing =3D=3D 0; + panel->vbt.edp.low_vswing =3D vswing =3D=3D 0; } } =20 - i915->vbt.edp.drrs_msa_timing_delay =3D + panel->vbt.edp.drrs_msa_timing_delay =3D (edp->sdrrs_msa_timing_delay >> (panel_type * 2)) & 3; } =20 static void -parse_psr(struct drm_i915_private *i915) +parse_psr(struct drm_i915_private *i915, + struct intel_panel *panel) { const struct bdb_psr *psr; const struct psr_table *psr_table; - int panel_type =3D i915->vbt.panel_type; + int panel_type =3D panel->vbt.panel_type; =20 psr =3D find_section(i915, BDB_PSR); if (!psr) { @@ -1376,11 +1386,11 @@ parse_psr(struct drm_i915_private *i915) =20 psr_table =3D &psr->psr_table[panel_type]; =20 - i915->vbt.psr.full_link =3D psr_table->full_link; - i915->vbt.psr.require_aux_wakeup =3D psr_table->require_aux_to_wakeup; + panel->vbt.psr.full_link =3D psr_table->full_link; + panel->vbt.psr.require_aux_wakeup =3D psr_table->require_aux_to_wakeup; =20 /* Allowed VBT values goes from 0 to 15 */ - i915->vbt.psr.idle_frames =3D psr_table->idle_frames < 0 ? 0 : + panel->vbt.psr.idle_frames =3D psr_table->idle_frames < 0 ? 0 : psr_table->idle_frames > 15 ? 15 : psr_table->idle_frames; =20 /* @@ -1391,13 +1401,13 @@ parse_psr(struct drm_i915_private *i915) (DISPLAY_VER(i915) >=3D 9 && !IS_BROXTON(i915))) { switch (psr_table->tp1_wakeup_time) { case 0: - i915->vbt.psr.tp1_wakeup_time_us =3D 500; + panel->vbt.psr.tp1_wakeup_time_us =3D 500; break; case 1: - i915->vbt.psr.tp1_wakeup_time_us =3D 100; + panel->vbt.psr.tp1_wakeup_time_us =3D 100; break; case 3: - i915->vbt.psr.tp1_wakeup_time_us =3D 0; + panel->vbt.psr.tp1_wakeup_time_us =3D 0; break; default: drm_dbg_kms(&i915->drm, @@ -1405,19 +1415,19 @@ parse_psr(struct drm_i915_private *i915) psr_table->tp1_wakeup_time); fallthrough; case 2: - i915->vbt.psr.tp1_wakeup_time_us =3D 2500; + panel->vbt.psr.tp1_wakeup_time_us =3D 2500; break; } =20 switch (psr_table->tp2_tp3_wakeup_time) { case 0: - i915->vbt.psr.tp2_tp3_wakeup_time_us =3D 500; + panel->vbt.psr.tp2_tp3_wakeup_time_us =3D 500; break; case 1: - i915->vbt.psr.tp2_tp3_wakeup_time_us =3D 100; + panel->vbt.psr.tp2_tp3_wakeup_time_us =3D 100; break; case 3: - i915->vbt.psr.tp2_tp3_wakeup_time_us =3D 0; + panel->vbt.psr.tp2_tp3_wakeup_time_us =3D 0; break; default: drm_dbg_kms(&i915->drm, @@ -1425,12 +1435,12 @@ parse_psr(struct drm_i915_private *i915) psr_table->tp2_tp3_wakeup_time); fallthrough; case 2: - i915->vbt.psr.tp2_tp3_wakeup_time_us =3D 2500; + panel->vbt.psr.tp2_tp3_wakeup_time_us =3D 2500; break; } } else { - i915->vbt.psr.tp1_wakeup_time_us =3D psr_table->tp1_wakeup_time * 100; - i915->vbt.psr.tp2_tp3_wakeup_time_us =3D psr_table->tp2_tp3_wakeup_time = * 100; + panel->vbt.psr.tp1_wakeup_time_us =3D psr_table->tp1_wakeup_time * 100; + panel->vbt.psr.tp2_tp3_wakeup_time_us =3D psr_table->tp2_tp3_wakeup_time= * 100; } =20 if (i915->vbt.version >=3D 226) { @@ -1452,62 +1462,64 @@ parse_psr(struct drm_i915_private *i915) wakeup_time =3D 2500; break; } - i915->vbt.psr.psr2_tp2_tp3_wakeup_time_us =3D wakeup_time; + panel->vbt.psr.psr2_tp2_tp3_wakeup_time_us =3D wakeup_time; } else { /* Reusing PSR1 wakeup time for PSR2 in older VBTs */ - i915->vbt.psr.psr2_tp2_tp3_wakeup_time_us =3D i915->vbt.psr.tp2_tp3_wake= up_time_us; + panel->vbt.psr.psr2_tp2_tp3_wakeup_time_us =3D panel->vbt.psr.tp2_tp3_wa= keup_time_us; } } =20 static void parse_dsi_backlight_ports(struct drm_i915_private *i915, - u16 version, enum port port) + struct intel_panel *panel, + enum port port) { - if (!i915->vbt.dsi.config->dual_link || version < 197) { - i915->vbt.dsi.bl_ports =3D BIT(port); - if (i915->vbt.dsi.config->cabc_supported) - i915->vbt.dsi.cabc_ports =3D BIT(port); + if (!panel->vbt.dsi.config->dual_link || i915->vbt.version < 197) { + panel->vbt.dsi.bl_ports =3D BIT(port); + if (panel->vbt.dsi.config->cabc_supported) + panel->vbt.dsi.cabc_ports =3D BIT(port); =20 return; } =20 - switch (i915->vbt.dsi.config->dl_dcs_backlight_ports) { + switch (panel->vbt.dsi.config->dl_dcs_backlight_ports) { case DL_DCS_PORT_A: - i915->vbt.dsi.bl_ports =3D BIT(PORT_A); + panel->vbt.dsi.bl_ports =3D BIT(PORT_A); break; case DL_DCS_PORT_C: - i915->vbt.dsi.bl_ports =3D BIT(PORT_C); + panel->vbt.dsi.bl_ports =3D BIT(PORT_C); break; default: case DL_DCS_PORT_A_AND_C: - i915->vbt.dsi.bl_ports =3D BIT(PORT_A) | BIT(PORT_C); + panel->vbt.dsi.bl_ports =3D BIT(PORT_A) | BIT(PORT_C); break; } =20 - if (!i915->vbt.dsi.config->cabc_supported) + if (!panel->vbt.dsi.config->cabc_supported) return; =20 - switch (i915->vbt.dsi.config->dl_dcs_cabc_ports) { + switch (panel->vbt.dsi.config->dl_dcs_cabc_ports) { case DL_DCS_PORT_A: - i915->vbt.dsi.cabc_ports =3D BIT(PORT_A); + panel->vbt.dsi.cabc_ports =3D BIT(PORT_A); break; case DL_DCS_PORT_C: - i915->vbt.dsi.cabc_ports =3D BIT(PORT_C); + panel->vbt.dsi.cabc_ports =3D BIT(PORT_C); break; default: case DL_DCS_PORT_A_AND_C: - i915->vbt.dsi.cabc_ports =3D + panel->vbt.dsi.cabc_ports =3D BIT(PORT_A) | BIT(PORT_C); break; } } =20 static void -parse_mipi_config(struct drm_i915_private *i915) +parse_mipi_config(struct drm_i915_private *i915, + struct intel_panel *panel) { const struct bdb_mipi_config *start; const struct mipi_config *config; const struct mipi_pps_data *pps; - int panel_type =3D i915->vbt.panel_type; + int panel_type =3D panel->vbt.panel_type; enum port port; =20 /* parse MIPI blocks only if LFP type is MIPI */ @@ -1515,7 +1527,7 @@ parse_mipi_config(struct drm_i915_private *i915) return; =20 /* Initialize this to undefined indicating no generic MIPI support */ - i915->vbt.dsi.panel_id =3D MIPI_DSI_UNDEFINED_PANEL_ID; + panel->vbt.dsi.panel_id =3D MIPI_DSI_UNDEFINED_PANEL_ID; =20 /* Block #40 is already parsed and panel_fixed_mode is * stored in i915->lfp_lvds_vbt_mode @@ -1542,17 +1554,17 @@ parse_mipi_config(struct drm_i915_private *i915) pps =3D &start->pps[panel_type]; =20 /* store as of now full data. Trim when we realise all is not needed */ - i915->vbt.dsi.config =3D kmemdup(config, sizeof(struct mipi_config), GFP_= KERNEL); - if (!i915->vbt.dsi.config) + panel->vbt.dsi.config =3D kmemdup(config, sizeof(struct mipi_config), GFP= _KERNEL); + if (!panel->vbt.dsi.config) return; =20 - i915->vbt.dsi.pps =3D kmemdup(pps, sizeof(struct mipi_pps_data), GFP_KERN= EL); - if (!i915->vbt.dsi.pps) { - kfree(i915->vbt.dsi.config); + panel->vbt.dsi.pps =3D kmemdup(pps, sizeof(struct mipi_pps_data), GFP_KER= NEL); + if (!panel->vbt.dsi.pps) { + kfree(panel->vbt.dsi.config); return; } =20 - parse_dsi_backlight_ports(i915, i915->vbt.version, port); + parse_dsi_backlight_ports(i915, panel, port); =20 /* FIXME is the 90 vs. 270 correct? */ switch (config->rotation) { @@ -1561,25 +1573,25 @@ parse_mipi_config(struct drm_i915_private *i915) * Most (all?) VBTs claim 0 degrees despite having * an upside down panel, thus we do not trust this. */ - i915->vbt.dsi.orientation =3D + panel->vbt.dsi.orientation =3D DRM_MODE_PANEL_ORIENTATION_UNKNOWN; break; case ENABLE_ROTATION_90: - i915->vbt.dsi.orientation =3D + panel->vbt.dsi.orientation =3D DRM_MODE_PANEL_ORIENTATION_RIGHT_UP; break; case ENABLE_ROTATION_180: - i915->vbt.dsi.orientation =3D + panel->vbt.dsi.orientation =3D DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP; break; case ENABLE_ROTATION_270: - i915->vbt.dsi.orientation =3D + panel->vbt.dsi.orientation =3D DRM_MODE_PANEL_ORIENTATION_LEFT_UP; break; } =20 /* We have mandatory mipi config blocks. Initialize as generic panel */ - i915->vbt.dsi.panel_id =3D MIPI_DSI_GENERIC_PANEL_ID; + panel->vbt.dsi.panel_id =3D MIPI_DSI_GENERIC_PANEL_ID; } =20 /* Find the sequence block and size for the given panel. */ @@ -1742,13 +1754,14 @@ static int goto_next_sequence_v3(const u8 *data, in= t index, int total) * Get len of pre-fixed deassert fragment from a v1 init OTP sequence, * skip all delay + gpio operands and stop at the first DSI packet op. */ -static int get_init_otp_deassert_fragment_len(struct drm_i915_private *i91= 5) +static int get_init_otp_deassert_fragment_len(struct drm_i915_private *i91= 5, + struct intel_panel *panel) { - const u8 *data =3D i915->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP]; + const u8 *data =3D panel->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP]; int index, len; =20 if (drm_WARN_ON(&i915->drm, - !data || i915->vbt.dsi.seq_version !=3D 1)) + !data || panel->vbt.dsi.seq_version !=3D 1)) return 0; =20 /* index =3D 1 to skip sequence byte */ @@ -1776,7 +1789,8 @@ static int get_init_otp_deassert_fragment_len(struct = drm_i915_private *i915) * these devices we split the init OTP sequence into a deassert sequence a= nd * the actual init OTP part. */ -static void fixup_mipi_sequences(struct drm_i915_private *i915) +static void fixup_mipi_sequences(struct drm_i915_private *i915, + struct intel_panel *panel) { u8 *init_otp; int len; @@ -1786,18 +1800,18 @@ static void fixup_mipi_sequences(struct drm_i915_pr= ivate *i915) return; =20 /* Limit this to v1 vid-mode sequences */ - if (i915->vbt.dsi.config->is_cmd_mode || - i915->vbt.dsi.seq_version !=3D 1) + if (panel->vbt.dsi.config->is_cmd_mode || + panel->vbt.dsi.seq_version !=3D 1) return; =20 /* Only do this if there are otp and assert seqs and no deassert seq */ - if (!i915->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP] || - !i915->vbt.dsi.sequence[MIPI_SEQ_ASSERT_RESET] || - i915->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET]) + if (!panel->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP] || + !panel->vbt.dsi.sequence[MIPI_SEQ_ASSERT_RESET] || + panel->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET]) return; =20 /* The deassert-sequence ends at the first DSI packet */ - len =3D get_init_otp_deassert_fragment_len(i915); + len =3D get_init_otp_deassert_fragment_len(i915, panel); if (!len) return; =20 @@ -1805,25 +1819,26 @@ static void fixup_mipi_sequences(struct drm_i915_pr= ivate *i915) "Using init OTP fragment to deassert reset\n"); =20 /* Copy the fragment, update seq byte and terminate it */ - init_otp =3D (u8 *)i915->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP]; - i915->vbt.dsi.deassert_seq =3D kmemdup(init_otp, len + 1, GFP_KERNEL); - if (!i915->vbt.dsi.deassert_seq) + init_otp =3D (u8 *)panel->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP]; + panel->vbt.dsi.deassert_seq =3D kmemdup(init_otp, len + 1, GFP_KERNEL); + if (!panel->vbt.dsi.deassert_seq) return; - i915->vbt.dsi.deassert_seq[0] =3D MIPI_SEQ_DEASSERT_RESET; - i915->vbt.dsi.deassert_seq[len] =3D MIPI_SEQ_ELEM_END; + panel->vbt.dsi.deassert_seq[0] =3D MIPI_SEQ_DEASSERT_RESET; + panel->vbt.dsi.deassert_seq[len] =3D MIPI_SEQ_ELEM_END; /* Use the copy for deassert */ - i915->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET] =3D - i915->vbt.dsi.deassert_seq; + panel->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET] =3D + panel->vbt.dsi.deassert_seq; /* Replace the last byte of the fragment with init OTP seq byte */ init_otp[len - 1] =3D MIPI_SEQ_INIT_OTP; /* And make MIPI_MIPI_SEQ_INIT_OTP point to it */ - i915->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP] =3D init_otp + len - 1; + panel->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP] =3D init_otp + len - 1; } =20 static void -parse_mipi_sequence(struct drm_i915_private *i915) +parse_mipi_sequence(struct drm_i915_private *i915, + struct intel_panel *panel) { - int panel_type =3D i915->vbt.panel_type; + int panel_type =3D panel->vbt.panel_type; const struct bdb_mipi_sequence *sequence; const u8 *seq_data; u32 seq_size; @@ -1831,7 +1846,7 @@ parse_mipi_sequence(struct drm_i915_private *i915) int index =3D 0; =20 /* Only our generic panel driver uses the sequence block. */ - if (i915->vbt.dsi.panel_id !=3D MIPI_DSI_GENERIC_PANEL_ID) + if (panel->vbt.dsi.panel_id !=3D MIPI_DSI_GENERIC_PANEL_ID) return; =20 sequence =3D find_section(i915, BDB_MIPI_SEQUENCE); @@ -1877,7 +1892,7 @@ parse_mipi_sequence(struct drm_i915_private *i915) drm_dbg_kms(&i915->drm, "Unsupported sequence %u\n", seq_id); =20 - i915->vbt.dsi.sequence[seq_id] =3D data + index; + panel->vbt.dsi.sequence[seq_id] =3D data + index; =20 if (sequence->version >=3D 3) index =3D goto_next_sequence_v3(data, index, seq_size); @@ -1890,18 +1905,18 @@ parse_mipi_sequence(struct drm_i915_private *i915) } } =20 - i915->vbt.dsi.data =3D data; - i915->vbt.dsi.size =3D seq_size; - i915->vbt.dsi.seq_version =3D sequence->version; + panel->vbt.dsi.data =3D data; + panel->vbt.dsi.size =3D seq_size; + panel->vbt.dsi.seq_version =3D sequence->version; =20 - fixup_mipi_sequences(i915); + fixup_mipi_sequences(i915, panel); =20 drm_dbg(&i915->drm, "MIPI related VBT parsing complete\n"); return; =20 err: kfree(data); - memset(i915->vbt.dsi.sequence, 0, sizeof(i915->vbt.dsi.sequence)); + memset(panel->vbt.dsi.sequence, 0, sizeof(panel->vbt.dsi.sequence)); } =20 static void @@ -2655,15 +2670,6 @@ init_vbt_defaults(struct drm_i915_private *i915) { i915->vbt.crt_ddc_pin =3D GMBUS_PIN_VGADDC; =20 - /* Default to having backlight */ - i915->vbt.backlight.present =3D true; - - /* LFP panel data */ - i915->vbt.lvds_dither =3D 1; - - /* SDVO panel data */ - i915->vbt.sdvo_lvds_vbt_mode =3D NULL; - /* general features */ i915->vbt.int_tv_support =3D 1; i915->vbt.int_crt_support =3D 1; @@ -2683,6 +2689,17 @@ init_vbt_defaults(struct drm_i915_private *i915) i915->vbt.lvds_ssc_freq); } =20 +/* Common defaults which may be overridden by VBT. */ +static void +init_vbt_panel_defaults(struct intel_panel *panel) +{ + /* Default to having backlight */ + panel->vbt.backlight.present =3D true; + + /* LFP panel data */ + panel->vbt.lvds_dither =3D true; +} + /* Defaults to initialize only if there is no VBT. */ static void init_vbt_missing_defaults(struct drm_i915_private *i915) @@ -2988,19 +3005,22 @@ void intel_bios_init(struct drm_i915_private *i915) kfree(oprom_vbt); } =20 -void intel_bios_init_panel(struct drm_i915_private *i915) +void intel_bios_init_panel(struct drm_i915_private *i915, + struct intel_panel *panel) { - parse_panel_options(i915); - parse_generic_dtd(i915); - parse_lfp_data(i915); - parse_lfp_backlight(i915); - parse_sdvo_panel_data(i915); - parse_panel_driver_features(i915); - parse_power_conservation_features(i915); - parse_edp(i915); - parse_psr(i915); - parse_mipi_config(i915); - parse_mipi_sequence(i915); + init_vbt_panel_defaults(panel); + + parse_panel_options(i915, panel); + parse_generic_dtd(i915, panel); + parse_lfp_data(i915, panel); + parse_lfp_backlight(i915, panel); + parse_sdvo_panel_data(i915, panel); + parse_panel_driver_features(i915, panel); + parse_power_conservation_features(i915, panel); + parse_edp(i915, panel); + parse_psr(i915, panel); + parse_mipi_config(i915, panel); + parse_mipi_sequence(i915, panel); } =20 /** @@ -3022,19 +3042,22 @@ void intel_bios_driver_remove(struct drm_i915_priva= te *i915) list_del(&entry->node); kfree(entry); } +} =20 - kfree(i915->vbt.sdvo_lvds_vbt_mode); - i915->vbt.sdvo_lvds_vbt_mode =3D NULL; - kfree(i915->vbt.lfp_lvds_vbt_mode); - i915->vbt.lfp_lvds_vbt_mode =3D NULL; - kfree(i915->vbt.dsi.data); - i915->vbt.dsi.data =3D NULL; - kfree(i915->vbt.dsi.pps); - i915->vbt.dsi.pps =3D NULL; - kfree(i915->vbt.dsi.config); - i915->vbt.dsi.config =3D NULL; - kfree(i915->vbt.dsi.deassert_seq); - i915->vbt.dsi.deassert_seq =3D NULL; +void intel_bios_fini_panel(struct intel_panel *panel) +{ + kfree(panel->vbt.sdvo_lvds_vbt_mode); + panel->vbt.sdvo_lvds_vbt_mode =3D NULL; + kfree(panel->vbt.lfp_lvds_vbt_mode); + panel->vbt.lfp_lvds_vbt_mode =3D NULL; + kfree(panel->vbt.dsi.data); + panel->vbt.dsi.data =3D NULL; + kfree(panel->vbt.dsi.pps); + panel->vbt.dsi.pps =3D NULL; + kfree(panel->vbt.dsi.config); + panel->vbt.dsi.config =3D NULL; + kfree(panel->vbt.dsi.deassert_seq); + panel->vbt.dsi.deassert_seq =3D NULL; } =20 /** diff --git a/drivers/gpu/drm/i915/display/intel_bios.h b/drivers/gpu/drm/i9= 15/display/intel_bios.h index c744d75fa435..86129f015718 100644 --- a/drivers/gpu/drm/i915/display/intel_bios.h +++ b/drivers/gpu/drm/i915/display/intel_bios.h @@ -36,6 +36,7 @@ struct drm_i915_private; struct intel_bios_encoder_data; struct intel_crtc_state; struct intel_encoder; +struct intel_panel; enum port; =20 enum intel_backlight_type { @@ -230,7 +231,9 @@ struct mipi_pps_data { } __packed; =20 void intel_bios_init(struct drm_i915_private *dev_priv); -void intel_bios_init_panel(struct drm_i915_private *dev_priv); +void intel_bios_init_panel(struct drm_i915_private *dev_priv, + struct intel_panel *panel); +void intel_bios_fini_panel(struct intel_panel *panel); void intel_bios_driver_remove(struct drm_i915_private *dev_priv); bool intel_bios_is_valid_vbt(const void *buf, size_t size); bool intel_bios_is_tv_present(struct drm_i915_private *dev_priv); diff --git a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c b/drivers/g= pu/drm/i915/display/intel_ddi_buf_trans.c index 85f58dd3df72..b490acd0ab69 100644 --- a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c +++ b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c @@ -1062,17 +1062,18 @@ bool is_hobl_buf_trans(const struct intel_ddi_buf_t= rans *table) =20 static bool use_edp_hobl(struct intel_encoder *encoder) { - struct drm_i915_private *i915 =3D to_i915(encoder->base.dev); struct intel_dp *intel_dp =3D enc_to_intel_dp(encoder); + struct intel_connector *connector =3D intel_dp->attached_connector; =20 - return i915->vbt.edp.hobl && !intel_dp->hobl_failed; + return connector->panel.vbt.edp.hobl && !intel_dp->hobl_failed; } =20 static bool use_edp_low_vswing(struct intel_encoder *encoder) { - struct drm_i915_private *i915 =3D to_i915(encoder->base.dev); + struct intel_dp *intel_dp =3D enc_to_intel_dp(encoder); + struct intel_connector *connector =3D intel_dp->attached_connector; =20 - return i915->vbt.edp.low_vswing; + return connector->panel.vbt.edp.low_vswing; } =20 static const struct intel_ddi_buf_trans * diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm= /i915/display/intel_display.c index e384db157f34..806d50b302ab 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -9580,7 +9580,6 @@ int intel_modeset_init_noirq(struct drm_i915_private = *i915) } =20 intel_bios_init(i915); - intel_bios_init_panel(i915); =20 ret =3D intel_vga_register(i915); if (ret) diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/g= pu/drm/i915/display/intel_display_types.h index 408152f9f46a..e2561c5d4953 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -279,6 +279,73 @@ struct intel_panel_bl_funcs { u32 (*hz_to_pwm)(struct intel_connector *connector, u32 hz); }; =20 +enum drrs_type { + DRRS_TYPE_NONE, + DRRS_TYPE_STATIC, + DRRS_TYPE_SEAMLESS, +}; + +struct intel_vbt_panel_data { + struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */ + struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */ + + /* Feature bits */ + unsigned int panel_type:4; + unsigned int lvds_dither:1; + unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */ + + u8 seamless_drrs_min_refresh_rate; + enum drrs_type drrs_type; + + struct { + int rate; + int lanes; + int preemphasis; + int vswing; + int bpp; + struct edp_power_seq pps; + u8 drrs_msa_timing_delay; + bool low_vswing; + bool initialized; + bool hobl; + } edp; + + struct { + bool enable; + bool full_link; + bool require_aux_wakeup; + int idle_frames; + int tp1_wakeup_time_us; + int tp2_tp3_wakeup_time_us; + int psr2_tp2_tp3_wakeup_time_us; + } psr; + + struct { + u16 pwm_freq_hz; + u16 brightness_precision_bits; + bool present; + bool active_low_pwm; + u8 min_brightness; /* min_brightness/255 of max */ + u8 controller; /* brightness controller number */ + enum intel_backlight_type type; + } backlight; + + /* MIPI DSI */ + struct { + u16 panel_id; + struct mipi_config *config; + struct mipi_pps_data *pps; + u16 bl_ports; + u16 cabc_ports; + u8 seq_version; + u32 size; + u8 *data; + const u8 *sequence[MIPI_SEQ_MAX]; + u8 *deassert_seq; /* Used by fixup_mipi_sequences() */ + enum drm_panel_orientation orientation; + } dsi; +}; + struct intel_panel { struct list_head fixed_modes; =20 @@ -318,6 +385,8 @@ struct intel_panel { const struct intel_panel_bl_funcs *pwm_funcs; void (*power)(struct intel_connector *, bool enable); } backlight; + + struct intel_vbt_panel_data vbt; }; =20 struct intel_digital_port; diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915= /display/intel_dp.c index affc820bf8d0..0efec6023fbe 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -1246,11 +1246,12 @@ static int intel_dp_max_bpp(struct intel_dp *intel_= dp, if (intel_dp_is_edp(intel_dp)) { /* Get bpp from vbt only for panels that dont have bpp in edid */ if (intel_connector->base.display_info.bpc =3D=3D 0 && - dev_priv->vbt.edp.bpp && dev_priv->vbt.edp.bpp < bpp) { + intel_connector->panel.vbt.edp.bpp && + intel_connector->panel.vbt.edp.bpp < bpp) { drm_dbg_kms(&dev_priv->drm, "clamping bpp for eDP panel to BIOS-provided %i\n", - dev_priv->vbt.edp.bpp); - bpp =3D dev_priv->vbt.edp.bpp; + intel_connector->panel.vbt.edp.bpp); + bpp =3D intel_connector->panel.vbt.edp.bpp; } } =20 @@ -1907,7 +1908,7 @@ intel_dp_drrs_compute_config(struct intel_connector *= connector, } =20 if (IS_IRONLAKE(i915) || IS_SANDYBRIDGE(i915) || IS_IVYBRIDGE(i915)) - pipe_config->msa_timing_delay =3D i915->vbt.edp.drrs_msa_timing_delay; + pipe_config->msa_timing_delay =3D connector->panel.vbt.edp.drrs_msa_timi= ng_delay; =20 pipe_config->has_drrs =3D true; =20 @@ -2740,8 +2741,10 @@ static void intel_edp_mso_mode_fixup(struct intel_co= nnector *connector, void intel_edp_fixup_vbt_bpp(struct intel_encoder *encoder, int pipe_bpp) { struct drm_i915_private *dev_priv =3D to_i915(encoder->base.dev); + struct intel_dp *intel_dp =3D enc_to_intel_dp(encoder); + struct intel_connector *connector =3D intel_dp->attached_connector; =20 - if (dev_priv->vbt.edp.bpp && pipe_bpp > dev_priv->vbt.edp.bpp) { + if (connector->panel.vbt.edp.bpp && pipe_bpp > connector->panel.vbt.edp.b= pp) { /* * This is a big fat ugly hack. * @@ -2757,8 +2760,8 @@ void intel_edp_fixup_vbt_bpp(struct intel_encoder *en= coder, int pipe_bpp) */ drm_dbg_kms(&dev_priv->drm, "pipe has %d bpp for eDP panel, overriding BIOS-provided max %d bpp= \n", - pipe_bpp, dev_priv->vbt.edp.bpp); - dev_priv->vbt.edp.bpp =3D pipe_bpp; + pipe_bpp, connector->panel.vbt.edp.bpp); + connector->panel.vbt.edp.bpp =3D pipe_bpp; } } =20 @@ -5237,8 +5240,10 @@ static bool intel_edp_init_connector(struct intel_dp= *intel_dp, } intel_connector->edid =3D edid; =20 + intel_bios_init_panel(dev_priv, &intel_connector->panel); + intel_panel_add_edid_fixed_modes(intel_connector, - dev_priv->vbt.drrs_type !=3D DRRS_TYPE_NONE); + intel_connector->panel.vbt.drrs_type !=3D DRRS_TYPE_NONE); =20 /* MSO requires information from the EDID */ intel_edp_mso_init(intel_dp); diff --git a/drivers/gpu/drm/i915/display/intel_dp.h b/drivers/gpu/drm/i915= /display/intel_dp.h index e794d910df56..a54902c713a3 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.h +++ b/drivers/gpu/drm/i915/display/intel_dp.h @@ -29,6 +29,7 @@ struct link_config_limits { int min_bpp, max_bpp; }; =20 +void intel_edp_fixup_vbt_bpp(struct intel_encoder *encoder, int pipe_bpp); void intel_dp_adjust_compliance_config(struct intel_dp *intel_dp, struct intel_crtc_state *pipe_config, struct link_config_limits *limits); diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c b/driver= s/gpu/drm/i915/display/intel_dp_aux_backlight.c index fb6cf30ee628..c92d5bb2326a 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c @@ -370,7 +370,7 @@ static int intel_dp_aux_vesa_setup_backlight(struct int= el_connector *connector, int ret; =20 ret =3D drm_edp_backlight_init(&intel_dp->aux, &panel->backlight.edp.vesa= .info, - i915->vbt.backlight.pwm_freq_hz, intel_dp->edp_dpcd, + panel->vbt.backlight.pwm_freq_hz, intel_dp->edp_dpcd, ¤t_level, ¤t_mode); if (ret < 0) return ret; @@ -454,7 +454,7 @@ int intel_dp_aux_init_backlight_funcs(struct intel_conn= ector *connector) case INTEL_DP_AUX_BACKLIGHT_OFF: return -ENODEV; case INTEL_DP_AUX_BACKLIGHT_AUTO: - switch (i915->vbt.backlight.type) { + switch (panel->vbt.backlight.type) { case INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE: try_vesa_interface =3D true; break; @@ -466,7 +466,7 @@ int intel_dp_aux_init_backlight_funcs(struct intel_conn= ector *connector) } break; case INTEL_DP_AUX_BACKLIGHT_ON: - if (i915->vbt.backlight.type !=3D INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE) + if (panel->vbt.backlight.type !=3D INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFAC= E) try_intel_interface =3D true; =20 try_vesa_interface =3D true; diff --git a/drivers/gpu/drm/i915/display/intel_drrs.c b/drivers/gpu/drm/i9= 15/display/intel_drrs.c index 166caf293f7b..7da4a9cbe4ba 100644 --- a/drivers/gpu/drm/i915/display/intel_drrs.c +++ b/drivers/gpu/drm/i915/display/intel_drrs.c @@ -217,9 +217,6 @@ static void intel_drrs_frontbuffer_update(struct drm_i9= 15_private *dev_priv, { struct intel_crtc *crtc; =20 - if (dev_priv->vbt.drrs_type !=3D DRRS_TYPE_SEAMLESS) - return; - for_each_intel_crtc(&dev_priv->drm, crtc) { unsigned int frontbuffer_bits; =20 diff --git a/drivers/gpu/drm/i915/display/intel_dsi.c b/drivers/gpu/drm/i91= 5/display/intel_dsi.c index 389a8c24cdc1..35e121cd226c 100644 --- a/drivers/gpu/drm/i915/display/intel_dsi.c +++ b/drivers/gpu/drm/i915/display/intel_dsi.c @@ -102,7 +102,7 @@ intel_dsi_get_panel_orientation(struct intel_connector = *connector) struct drm_i915_private *dev_priv =3D to_i915(connector->base.dev); enum drm_panel_orientation orientation; =20 - orientation =3D dev_priv->vbt.dsi.orientation; + orientation =3D connector->panel.vbt.dsi.orientation; if (orientation !=3D DRM_MODE_PANEL_ORIENTATION_UNKNOWN) return orientation; =20 diff --git a/drivers/gpu/drm/i915/display/intel_dsi_dcs_backlight.c b/drive= rs/gpu/drm/i915/display/intel_dsi_dcs_backlight.c index 7d234429e71e..1bc7118c56a2 100644 --- a/drivers/gpu/drm/i915/display/intel_dsi_dcs_backlight.c +++ b/drivers/gpu/drm/i915/display/intel_dsi_dcs_backlight.c @@ -160,12 +160,10 @@ static void dcs_enable_backlight(const struct intel_c= rtc_state *crtc_state, static int dcs_setup_backlight(struct intel_connector *connector, enum pipe unused) { - struct drm_device *dev =3D connector->base.dev; - struct drm_i915_private *dev_priv =3D to_i915(dev); struct intel_panel *panel =3D &connector->panel; =20 - if (dev_priv->vbt.backlight.brightness_precision_bits > 8) - panel->backlight.max =3D (1 << dev_priv->vbt.backlight.brightness_precis= ion_bits) - 1; + if (panel->vbt.backlight.brightness_precision_bits > 8) + panel->backlight.max =3D (1 << panel->vbt.backlight.brightness_precision= _bits) - 1; else panel->backlight.max =3D PANEL_PWM_MAX_VALUE; =20 @@ -185,11 +183,10 @@ static const struct intel_panel_bl_funcs dcs_bl_funcs= =3D { int intel_dsi_dcs_init_backlight_funcs(struct intel_connector *intel_conne= ctor) { struct drm_device *dev =3D intel_connector->base.dev; - struct drm_i915_private *dev_priv =3D to_i915(dev); struct intel_encoder *encoder =3D intel_attached_encoder(intel_connector); struct intel_panel *panel =3D &intel_connector->panel; =20 - if (dev_priv->vbt.backlight.type !=3D INTEL_BACKLIGHT_DSI_DCS) + if (panel->vbt.backlight.type !=3D INTEL_BACKLIGHT_DSI_DCS) return -ENODEV; =20 if (drm_WARN_ON(dev, encoder->type !=3D INTEL_OUTPUT_DSI)) diff --git a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c b/drivers/gpu/drm= /i915/display/intel_dsi_vbt.c index dd24aef925f2..75e8cc4337c9 100644 --- a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c +++ b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c @@ -240,9 +240,10 @@ static const u8 *mipi_exec_delay(struct intel_dsi *int= el_dsi, const u8 *data) return data; } =20 -static void vlv_exec_gpio(struct drm_i915_private *dev_priv, +static void vlv_exec_gpio(struct intel_connector *connector, u8 gpio_source, u8 gpio_index, bool value) { + struct drm_i915_private *dev_priv =3D to_i915(connector->base.dev); struct gpio_map *map; u16 pconf0, padval; u32 tmp; @@ -256,7 +257,7 @@ static void vlv_exec_gpio(struct drm_i915_private *dev_= priv, =20 map =3D &vlv_gpio_table[gpio_index]; =20 - if (dev_priv->vbt.dsi.seq_version >=3D 3) { + if (connector->panel.vbt.dsi.seq_version >=3D 3) { /* XXX: this assumes vlv_gpio_table only has NC GPIOs. */ port =3D IOSF_PORT_GPIO_NC; } else { @@ -287,14 +288,15 @@ static void vlv_exec_gpio(struct drm_i915_private *de= v_priv, vlv_iosf_sb_put(dev_priv, BIT(VLV_IOSF_SB_GPIO)); } =20 -static void chv_exec_gpio(struct drm_i915_private *dev_priv, +static void chv_exec_gpio(struct intel_connector *connector, u8 gpio_source, u8 gpio_index, bool value) { + struct drm_i915_private *dev_priv =3D to_i915(connector->base.dev); u16 cfg0, cfg1; u16 family_num; u8 port; =20 - if (dev_priv->vbt.dsi.seq_version >=3D 3) { + if (connector->panel.vbt.dsi.seq_version >=3D 3) { if (gpio_index >=3D CHV_GPIO_IDX_START_SE) { /* XXX: it's unclear whether 255->57 is part of SE. */ gpio_index -=3D CHV_GPIO_IDX_START_SE; @@ -340,9 +342,10 @@ static void chv_exec_gpio(struct drm_i915_private *dev= _priv, vlv_iosf_sb_put(dev_priv, BIT(VLV_IOSF_SB_GPIO)); } =20 -static void bxt_exec_gpio(struct drm_i915_private *dev_priv, +static void bxt_exec_gpio(struct intel_connector *connector, u8 gpio_source, u8 gpio_index, bool value) { + struct drm_i915_private *dev_priv =3D to_i915(connector->base.dev); /* XXX: this table is a quick ugly hack. */ static struct gpio_desc *bxt_gpio_table[U8_MAX + 1]; struct gpio_desc *gpio_desc =3D bxt_gpio_table[gpio_index]; @@ -366,9 +369,11 @@ static void bxt_exec_gpio(struct drm_i915_private *dev= _priv, gpiod_set_value(gpio_desc, value); } =20 -static void icl_exec_gpio(struct drm_i915_private *dev_priv, +static void icl_exec_gpio(struct intel_connector *connector, u8 gpio_source, u8 gpio_index, bool value) { + struct drm_i915_private *dev_priv =3D to_i915(connector->base.dev); + drm_dbg_kms(&dev_priv->drm, "Skipping ICL GPIO element execution\n"); } =20 @@ -376,18 +381,19 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *int= el_dsi, const u8 *data) { struct drm_device *dev =3D intel_dsi->base.base.dev; struct drm_i915_private *dev_priv =3D to_i915(dev); + struct intel_connector *connector =3D intel_dsi->attached_connector; u8 gpio_source, gpio_index =3D 0, gpio_number; bool value; =20 drm_dbg_kms(&dev_priv->drm, "\n"); =20 - if (dev_priv->vbt.dsi.seq_version >=3D 3) + if (connector->panel.vbt.dsi.seq_version >=3D 3) gpio_index =3D *data++; =20 gpio_number =3D *data++; =20 /* gpio source in sequence v2 only */ - if (dev_priv->vbt.dsi.seq_version =3D=3D 2) + if (connector->panel.vbt.dsi.seq_version =3D=3D 2) gpio_source =3D (*data >> 1) & 3; else gpio_source =3D 0; @@ -396,13 +402,13 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *int= el_dsi, const u8 *data) value =3D *data++ & 1; =20 if (DISPLAY_VER(dev_priv) >=3D 11) - icl_exec_gpio(dev_priv, gpio_source, gpio_index, value); + icl_exec_gpio(connector, gpio_source, gpio_index, value); else if (IS_VALLEYVIEW(dev_priv)) - vlv_exec_gpio(dev_priv, gpio_source, gpio_number, value); + vlv_exec_gpio(connector, gpio_source, gpio_number, value); else if (IS_CHERRYVIEW(dev_priv)) - chv_exec_gpio(dev_priv, gpio_source, gpio_number, value); + chv_exec_gpio(connector, gpio_source, gpio_number, value); else - bxt_exec_gpio(dev_priv, gpio_source, gpio_index, value); + bxt_exec_gpio(connector, gpio_source, gpio_index, value); =20 return data; } @@ -585,14 +591,15 @@ static void intel_dsi_vbt_exec(struct intel_dsi *inte= l_dsi, enum mipi_seq seq_id) { struct drm_i915_private *dev_priv =3D to_i915(intel_dsi->base.base.dev); + struct intel_connector *connector =3D intel_dsi->attached_connector; const u8 *data; fn_mipi_elem_exec mipi_elem_exec; =20 if (drm_WARN_ON(&dev_priv->drm, - seq_id >=3D ARRAY_SIZE(dev_priv->vbt.dsi.sequence))) + seq_id >=3D ARRAY_SIZE(connector->panel.vbt.dsi.sequence))) return; =20 - data =3D dev_priv->vbt.dsi.sequence[seq_id]; + data =3D connector->panel.vbt.dsi.sequence[seq_id]; if (!data) return; =20 @@ -605,7 +612,7 @@ static void intel_dsi_vbt_exec(struct intel_dsi *intel_= dsi, data++; =20 /* Skip Size of Sequence. */ - if (dev_priv->vbt.dsi.seq_version >=3D 3) + if (connector->panel.vbt.dsi.seq_version >=3D 3) data +=3D 4; =20 while (1) { @@ -621,7 +628,7 @@ static void intel_dsi_vbt_exec(struct intel_dsi *intel_= dsi, mipi_elem_exec =3D NULL; =20 /* Size of Operation. */ - if (dev_priv->vbt.dsi.seq_version >=3D 3) + if (connector->panel.vbt.dsi.seq_version >=3D 3) operation_size =3D *data++; =20 if (mipi_elem_exec) { @@ -669,10 +676,10 @@ void intel_dsi_vbt_exec_sequence(struct intel_dsi *in= tel_dsi, =20 void intel_dsi_msleep(struct intel_dsi *intel_dsi, int msec) { - struct drm_i915_private *dev_priv =3D to_i915(intel_dsi->base.base.dev); + struct intel_connector *connector =3D intel_dsi->attached_connector; =20 /* For v3 VBTs in vid-mode the delays are part of the VBT sequences */ - if (is_vid_mode(intel_dsi) && dev_priv->vbt.dsi.seq_version >=3D 3) + if (is_vid_mode(intel_dsi) && connector->panel.vbt.dsi.seq_version >=3D 3) return; =20 msleep(msec); @@ -734,9 +741,10 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u= 16 panel_id) { struct drm_device *dev =3D intel_dsi->base.base.dev; struct drm_i915_private *dev_priv =3D to_i915(dev); - struct mipi_config *mipi_config =3D dev_priv->vbt.dsi.config; - struct mipi_pps_data *pps =3D dev_priv->vbt.dsi.pps; - struct drm_display_mode *mode =3D dev_priv->vbt.lfp_lvds_vbt_mode; + struct intel_connector *connector =3D intel_dsi->attached_connector; + struct mipi_config *mipi_config =3D connector->panel.vbt.dsi.config; + struct mipi_pps_data *pps =3D connector->panel.vbt.dsi.pps; + struct drm_display_mode *mode =3D connector->panel.vbt.lfp_lvds_vbt_mode; u16 burst_mode_ratio; enum port port; =20 @@ -872,7 +880,8 @@ void intel_dsi_vbt_gpio_init(struct intel_dsi *intel_ds= i, bool panel_is_on) { struct drm_device *dev =3D intel_dsi->base.base.dev; struct drm_i915_private *dev_priv =3D to_i915(dev); - struct mipi_config *mipi_config =3D dev_priv->vbt.dsi.config; + struct intel_connector *connector =3D intel_dsi->attached_connector; + struct mipi_config *mipi_config =3D connector->panel.vbt.dsi.config; enum gpiod_flags flags =3D panel_is_on ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW; bool want_backlight_gpio =3D false; bool want_panel_gpio =3D false; @@ -927,7 +936,8 @@ void intel_dsi_vbt_gpio_cleanup(struct intel_dsi *intel= _dsi) { struct drm_device *dev =3D intel_dsi->base.base.dev; struct drm_i915_private *dev_priv =3D to_i915(dev); - struct mipi_config *mipi_config =3D dev_priv->vbt.dsi.config; + struct intel_connector *connector =3D intel_dsi->attached_connector; + struct mipi_config *mipi_config =3D connector->panel.vbt.dsi.config; =20 if (intel_dsi->gpio_panel) { gpiod_put(intel_dsi->gpio_panel); diff --git a/drivers/gpu/drm/i915/display/intel_lvds.c b/drivers/gpu/drm/i9= 15/display/intel_lvds.c index e8478161f8b9..9f250a70519a 100644 --- a/drivers/gpu/drm/i915/display/intel_lvds.c +++ b/drivers/gpu/drm/i915/display/intel_lvds.c @@ -809,7 +809,7 @@ static bool compute_is_dual_link_lvds(struct intel_lvds= _encoder *lvds_encoder) else val &=3D ~(LVDS_DETECTED | LVDS_PIPE_SEL_MASK); if (val =3D=3D 0) - val =3D dev_priv->vbt.bios_lvds_val; + val =3D connector->panel.vbt.bios_lvds_val; =20 return (val & LVDS_CLKB_POWER_MASK) =3D=3D LVDS_CLKB_POWER_UP; } @@ -967,9 +967,11 @@ void intel_lvds_init(struct drm_i915_private *dev_priv) } intel_connector->edid =3D edid; =20 + intel_bios_init_panel(dev_priv, &intel_connector->panel); + /* Try EDID first */ intel_panel_add_edid_fixed_modes(intel_connector, - dev_priv->vbt.drrs_type !=3D DRRS_TYPE_NONE); + intel_connector->panel.vbt.drrs_type !=3D DRRS_TYPE_NONE); =20 /* Failed to get EDID, what about VBT? */ if (!intel_panel_preferred_fixed_mode(intel_connector)) diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i= 915/display/intel_panel.c index d1d1b59102d6..d055e4118558 100644 --- a/drivers/gpu/drm/i915/display/intel_panel.c +++ b/drivers/gpu/drm/i915/display/intel_panel.c @@ -75,9 +75,8 @@ const struct drm_display_mode * intel_panel_downclock_mode(struct intel_connector *connector, const struct drm_display_mode *adjusted_mode) { - struct drm_i915_private *i915 =3D to_i915(connector->base.dev); const struct drm_display_mode *fixed_mode, *best_mode =3D NULL; - int min_vrefresh =3D i915->vbt.seamless_drrs_min_refresh_rate; + int min_vrefresh =3D connector->panel.vbt.seamless_drrs_min_refresh_rate; int max_vrefresh =3D drm_mode_vrefresh(adjusted_mode); =20 /* pick the fixed_mode with the lowest refresh rate */ @@ -113,13 +112,11 @@ int intel_panel_get_modes(struct intel_connector *con= nector) =20 enum drrs_type intel_panel_drrs_type(struct intel_connector *connector) { - struct drm_i915_private *i915 =3D to_i915(connector->base.dev); - if (list_empty(&connector->panel.fixed_modes) || list_is_singular(&connector->panel.fixed_modes)) return DRRS_TYPE_NONE; =20 - return i915->vbt.drrs_type; + return connector->panel.vbt.drrs_type; } =20 int intel_panel_compute_config(struct intel_connector *connector, @@ -260,7 +257,7 @@ void intel_panel_add_vbt_lfp_fixed_mode(struct intel_co= nnector *connector) struct drm_i915_private *i915 =3D to_i915(connector->base.dev); const struct drm_display_mode *mode; =20 - mode =3D i915->vbt.lfp_lvds_vbt_mode; + mode =3D connector->panel.vbt.lfp_lvds_vbt_mode; if (!mode) return; =20 @@ -274,7 +271,7 @@ void intel_panel_add_vbt_sdvo_fixed_mode(struct intel_c= onnector *connector) struct drm_i915_private *i915 =3D to_i915(connector->base.dev); const struct drm_display_mode *mode; =20 - mode =3D i915->vbt.sdvo_lvds_vbt_mode; + mode =3D connector->panel.vbt.sdvo_lvds_vbt_mode; if (!mode) return; =20 @@ -639,6 +636,8 @@ void intel_panel_fini(struct intel_connector *connector) =20 intel_backlight_destroy(panel); =20 + intel_bios_fini_panel(panel); + list_for_each_entry_safe(fixed_mode, next, &panel->fixed_modes, head) { list_del(&fixed_mode->head); drm_mode_destroy(connector->base.dev, fixed_mode); diff --git a/drivers/gpu/drm/i915/display/intel_pps.c b/drivers/gpu/drm/i91= 5/display/intel_pps.c index 5b72c892a6f2..a226e4e5c569 100644 --- a/drivers/gpu/drm/i915/display/intel_pps.c +++ b/drivers/gpu/drm/i915/display/intel_pps.c @@ -209,7 +209,8 @@ static int bxt_power_sequencer_idx(struct intel_dp *intel_dp) { struct drm_i915_private *dev_priv =3D dp_to_i915(intel_dp); - int backlight_controller =3D dev_priv->vbt.backlight.controller; + struct intel_connector *connector =3D intel_dp->attached_connector; + int backlight_controller =3D connector->panel.vbt.backlight.controller; =20 lockdep_assert_held(&dev_priv->pps_mutex); =20 @@ -1175,8 +1176,9 @@ static void pps_init_delays_vbt(struct intel_dp *inte= l_dp, struct edp_power_seq *vbt) { struct drm_i915_private *dev_priv =3D dp_to_i915(intel_dp); + struct intel_connector *connector =3D intel_dp->attached_connector; =20 - *vbt =3D dev_priv->vbt.edp.pps; + *vbt =3D connector->panel.vbt.edp.pps; =20 /* On Toshiba Satellite P50-C-18C system the VBT T12 delay * of 500ms appears to be too short. Ocassionally the panel diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i91= 5/display/intel_psr.c index 06db407e2749..195ed9631128 100644 --- a/drivers/gpu/drm/i915/display/intel_psr.c +++ b/drivers/gpu/drm/i915/display/intel_psr.c @@ -399,6 +399,7 @@ static void intel_psr_enable_sink(struct intel_dp *inte= l_dp) =20 static u32 intel_psr1_get_tp_time(struct intel_dp *intel_dp) { + struct intel_connector *connector =3D intel_dp->attached_connector; struct drm_i915_private *dev_priv =3D dp_to_i915(intel_dp); u32 val =3D 0; =20 @@ -411,20 +412,20 @@ static u32 intel_psr1_get_tp_time(struct intel_dp *in= tel_dp) goto check_tp3_sel; } =20 - if (dev_priv->vbt.psr.tp1_wakeup_time_us =3D=3D 0) + if (connector->panel.vbt.psr.tp1_wakeup_time_us =3D=3D 0) val |=3D EDP_PSR_TP1_TIME_0us; - else if (dev_priv->vbt.psr.tp1_wakeup_time_us <=3D 100) + else if (connector->panel.vbt.psr.tp1_wakeup_time_us <=3D 100) val |=3D EDP_PSR_TP1_TIME_100us; - else if (dev_priv->vbt.psr.tp1_wakeup_time_us <=3D 500) + else if (connector->panel.vbt.psr.tp1_wakeup_time_us <=3D 500) val |=3D EDP_PSR_TP1_TIME_500us; else val |=3D EDP_PSR_TP1_TIME_2500us; =20 - if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =3D=3D 0) + if (connector->panel.vbt.psr.tp2_tp3_wakeup_time_us =3D=3D 0) val |=3D EDP_PSR_TP2_TP3_TIME_0us; - else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <=3D 100) + else if (connector->panel.vbt.psr.tp2_tp3_wakeup_time_us <=3D 100) val |=3D EDP_PSR_TP2_TP3_TIME_100us; - else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <=3D 500) + else if (connector->panel.vbt.psr.tp2_tp3_wakeup_time_us <=3D 500) val |=3D EDP_PSR_TP2_TP3_TIME_500us; else val |=3D EDP_PSR_TP2_TP3_TIME_2500us; @@ -441,13 +442,14 @@ static u32 intel_psr1_get_tp_time(struct intel_dp *in= tel_dp) =20 static u8 psr_compute_idle_frames(struct intel_dp *intel_dp) { + struct intel_connector *connector =3D intel_dp->attached_connector; struct drm_i915_private *dev_priv =3D dp_to_i915(intel_dp); int idle_frames; =20 /* Let's use 6 as the minimum to cover all known cases including the * off-by-one issue that HW has in some cases. */ - idle_frames =3D max(6, dev_priv->vbt.psr.idle_frames); + idle_frames =3D max(6, connector->panel.vbt.psr.idle_frames); idle_frames =3D max(idle_frames, intel_dp->psr.sink_sync_latency + 1); =20 if (drm_WARN_ON(&dev_priv->drm, idle_frames > 0xf)) @@ -483,18 +485,19 @@ static void hsw_activate_psr1(struct intel_dp *intel_= dp) =20 static u32 intel_psr2_get_tp_time(struct intel_dp *intel_dp) { + struct intel_connector *connector =3D intel_dp->attached_connector; struct drm_i915_private *dev_priv =3D dp_to_i915(intel_dp); u32 val =3D 0; =20 if (dev_priv->params.psr_safest_params) return EDP_PSR2_TP2_TIME_2500us; =20 - if (dev_priv->vbt.psr.psr2_tp2_tp3_wakeup_time_us >=3D 0 && - dev_priv->vbt.psr.psr2_tp2_tp3_wakeup_time_us <=3D 50) + if (connector->panel.vbt.psr.psr2_tp2_tp3_wakeup_time_us >=3D 0 && + connector->panel.vbt.psr.psr2_tp2_tp3_wakeup_time_us <=3D 50) val |=3D EDP_PSR2_TP2_TIME_50us; - else if (dev_priv->vbt.psr.psr2_tp2_tp3_wakeup_time_us <=3D 100) + else if (connector->panel.vbt.psr.psr2_tp2_tp3_wakeup_time_us <=3D 100) val |=3D EDP_PSR2_TP2_TIME_100us; - else if (dev_priv->vbt.psr.psr2_tp2_tp3_wakeup_time_us <=3D 500) + else if (connector->panel.vbt.psr.psr2_tp2_tp3_wakeup_time_us <=3D 500) val |=3D EDP_PSR2_TP2_TIME_500us; else val |=3D EDP_PSR2_TP2_TIME_2500us; @@ -2344,6 +2347,7 @@ void intel_psr_flush(struct drm_i915_private *dev_pri= v, */ void intel_psr_init(struct intel_dp *intel_dp) { + struct intel_connector *connector =3D intel_dp->attached_connector; struct intel_digital_port *dig_port =3D dp_to_dig_port(intel_dp); struct drm_i915_private *dev_priv =3D dp_to_i915(intel_dp); =20 @@ -2368,13 +2372,13 @@ void intel_psr_init(struct intel_dp *intel_dp) intel_dp->psr.source_support =3D true; =20 if (dev_priv->params.enable_psr =3D=3D -1) - if (!dev_priv->vbt.psr.enable) + if (!connector->panel.vbt.psr.enable) dev_priv->params.enable_psr =3D 0; =20 /* Set link_standby x link_off defaults */ if (DISPLAY_VER(dev_priv) < 12) /* For new platforms up to TGL let's respect VBT back again */ - intel_dp->psr.link_standby =3D dev_priv->vbt.psr.full_link; + intel_dp->psr.link_standby =3D connector->panel.vbt.psr.full_link; =20 INIT_WORK(&intel_dp->psr.work, intel_psr_work); INIT_DELAYED_WORK(&intel_dp->psr.dc3co_work, tgl_dc3co_disable_work); diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c b/drivers/gpu/drm/i9= 15/display/intel_sdvo.c index d81855d57cdc..14a64bd61176 100644 --- a/drivers/gpu/drm/i915/display/intel_sdvo.c +++ b/drivers/gpu/drm/i915/display/intel_sdvo.c @@ -2869,6 +2869,7 @@ static bool intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device) { struct drm_encoder *encoder =3D &intel_sdvo->base.base; + struct drm_i915_private *i915 =3D to_i915(encoder->dev); struct drm_connector *connector; struct intel_connector *intel_connector; struct intel_sdvo_connector *intel_sdvo_connector; @@ -2900,6 +2901,8 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, i= nt device) if (!intel_sdvo_create_enhance_property(intel_sdvo, intel_sdvo_connector)) goto err; =20 + intel_bios_init_panel(i915, &intel_connector->panel); + /* * Fetch modes from VBT. For SDVO prefer the VBT mode since some * SDVO->LVDS transcoders can't cope with the EDID mode. diff --git a/drivers/gpu/drm/i915/display/vlv_dsi.c b/drivers/gpu/drm/i915/= display/vlv_dsi.c index 1954f07f0d3e..be8fd3c362df 100644 --- a/drivers/gpu/drm/i915/display/vlv_dsi.c +++ b/drivers/gpu/drm/i915/display/vlv_dsi.c @@ -782,6 +782,7 @@ static void intel_dsi_pre_enable(struct intel_atomic_st= ate *state, { struct intel_dsi *intel_dsi =3D enc_to_intel_dsi(encoder); struct intel_crtc *crtc =3D to_intel_crtc(pipe_config->uapi.crtc); + struct intel_connector *connector =3D to_intel_connector(conn_state->conn= ector); struct drm_i915_private *dev_priv =3D to_i915(crtc->base.dev); enum pipe pipe =3D crtc->pipe; enum port port; @@ -838,7 +839,7 @@ static void intel_dsi_pre_enable(struct intel_atomic_st= ate *state, * the delay in that case. If there is no deassert-seq, then an * unconditional msleep is used to give the panel time to power-on. */ - if (dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET]) { + if (connector->panel.vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET]) { intel_dsi_msleep(intel_dsi, intel_dsi->panel_on_delay); intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_DEASSERT_RESET); } else { @@ -1690,7 +1691,8 @@ static void vlv_dphy_param_init(struct intel_dsi *int= el_dsi) { struct drm_device *dev =3D intel_dsi->base.base.dev; struct drm_i915_private *dev_priv =3D to_i915(dev); - struct mipi_config *mipi_config =3D dev_priv->vbt.dsi.config; + struct intel_connector *connector =3D intel_dsi->attached_connector; + struct mipi_config *mipi_config =3D connector->panel.vbt.dsi.config; u32 tlpx_ns, extra_byte_count, tlpx_ui; u32 ui_num, ui_den; u32 prepare_cnt, exit_zero_cnt, clk_zero_cnt, trail_cnt; @@ -1924,13 +1926,15 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv) =20 intel_dsi->panel_power_off_time =3D ktime_get_boottime(); =20 - if (dev_priv->vbt.dsi.config->dual_link) + intel_bios_init_panel(dev_priv, &intel_connector->panel); + + if (intel_connector->panel.vbt.dsi.config->dual_link) intel_dsi->ports =3D BIT(PORT_A) | BIT(PORT_C); else intel_dsi->ports =3D BIT(port); =20 - intel_dsi->dcs_backlight_ports =3D dev_priv->vbt.dsi.bl_ports; - intel_dsi->dcs_cabc_ports =3D dev_priv->vbt.dsi.cabc_ports; + intel_dsi->dcs_backlight_ports =3D intel_connector->panel.vbt.dsi.bl_port= s; + intel_dsi->dcs_cabc_ports =3D intel_connector->panel.vbt.dsi.cabc_ports; =20 /* Create a DSI host (and a device) for each port. */ for_each_dsi_port(port, intel_dsi->ports) { diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_dr= v.h index 5184d70d4838..554d79bc0312 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -194,12 +194,6 @@ struct drm_i915_display_funcs { =20 #define I915_COLOR_UNEVICTABLE (-1) /* a non-vma sharing the address space= */ =20 -enum drrs_type { - DRRS_TYPE_NONE, - DRRS_TYPE_STATIC, - DRRS_TYPE_SEAMLESS, -}; - #define QUIRK_LVDS_SSC_DISABLE (1<<1) #define QUIRK_INVERT_BRIGHTNESS (1<<2) #define QUIRK_BACKLIGHT_PRESENT (1<<3) @@ -308,76 +302,19 @@ struct intel_vbt_data { /* bdb version */ u16 version; =20 - struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */ - struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */ - /* Feature bits */ unsigned int int_tv_support:1; - unsigned int lvds_dither:1; unsigned int int_crt_support:1; unsigned int lvds_use_ssc:1; unsigned int int_lvds_support:1; unsigned int display_clock_mode:1; unsigned int fdi_rx_polarity_inverted:1; - unsigned int panel_type:4; int lvds_ssc_freq; - unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */ enum drm_panel_orientation orientation; =20 bool override_afc_startup; u8 override_afc_startup_val; =20 - u8 seamless_drrs_min_refresh_rate; - enum drrs_type drrs_type; - - struct { - int rate; - int lanes; - int preemphasis; - int vswing; - int bpp; - struct edp_power_seq pps; - u8 drrs_msa_timing_delay; - bool low_vswing; - bool initialized; - bool hobl; - } edp; - - struct { - bool enable; - bool full_link; - bool require_aux_wakeup; - int idle_frames; - int tp1_wakeup_time_us; - int tp2_tp3_wakeup_time_us; - int psr2_tp2_tp3_wakeup_time_us; - } psr; - - struct { - u16 pwm_freq_hz; - u16 brightness_precision_bits; - bool present; - bool active_low_pwm; - u8 min_brightness; /* min_brightness/255 of max */ - u8 controller; /* brightness controller number */ - enum intel_backlight_type type; - } backlight; - - /* MIPI DSI */ - struct { - u16 panel_id; - struct mipi_config *config; - struct mipi_pps_data *pps; - u16 bl_ports; - u16 cabc_ports; - u8 seq_version; - u32 size; - u8 *data; - const u8 *sequence[MIPI_SEQ_MAX]; - u8 *deassert_seq; /* Used by fixup_mipi_sequences() */ - enum drm_panel_orientation orientation; - } dsi; - int crt_ddc_pin; =20 struct list_head display_devices; --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68E5FC32771 for ; Mon, 26 Sep 2022 11:59:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238901AbiIZL7j (ORCPT ); Mon, 26 Sep 2022 07:59:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238295AbiIZL4F (ORCPT ); Mon, 26 Sep 2022 07:56:05 -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 3070158B75; Mon, 26 Sep 2022 03:51:21 -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 6D66CB80957; Mon, 26 Sep 2022 10:42:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7017C433D6; Mon, 26 Sep 2022 10:42:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188977; bh=26rK1kT3JNgahVb+nuTchRLpOamrvO85/nRG2gjSRoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VuBD3P4YZTkqL489sIr31ga/KaANaB68npQ22M8fAPaPb/QdwU4qJxDZxB+zsoOsV /qNLNDtVwOLiScucdOAJLIIF83nhNblpDi8GhkTz9So4h/lXIGBUCcun+h4gbykVWi RkdsHVMdi+NsN35mvlydMmdXuaVOfWX6XYLcm3T0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jani Nikula , Stanislav Lisovskiy , Rodrigo Vivi , Sasha Levin Subject: [PATCH 5.19 006/207] drm/i915/dsi: filter invalid backlight and CABC ports Date: Mon, 26 Sep 2022 12:09:55 +0200 Message-Id: <20220926100806.775793933@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jani Nikula [ Upstream commit 607f41768a1ef9c7721866b00fbdeeea5359bc07 ] Avoid using ports that aren't initialized in case the VBT backlight or CABC ports have invalid values. This fixes a NULL pointer dereference of intel_dsi->dsi_hosts[port] in such cases. Cc: stable@vger.kernel.org Signed-off-by: Jani Nikula Reviewed-by: Stanislav Lisovskiy Link: https://patchwork.freedesktop.org/patch/msgid/b0f4f087866257d280eb97d= 6bcfcefd109cc5fa2.1660664162.git.jani.nikula@intel.com (cherry picked from commit f4a6c7a454a6e71c5ccf25af82694213a9784013) Signed-off-by: Rodrigo Vivi Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/i915/display/icl_dsi.c | 7 +++++++ drivers/gpu/drm/i915/display/vlv_dsi.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/= display/icl_dsi.c index 5c46acb46516..f416499dad6f 100644 --- a/drivers/gpu/drm/i915/display/icl_dsi.c +++ b/drivers/gpu/drm/i915/display/icl_dsi.c @@ -2072,7 +2072,14 @@ void icl_dsi_init(struct drm_i915_private *dev_priv) else intel_dsi->ports =3D BIT(port); =20 + if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.bl_ports &= ~intel_dsi->ports)) + intel_connector->panel.vbt.dsi.bl_ports &=3D intel_dsi->ports; + intel_dsi->dcs_backlight_ports =3D intel_connector->panel.vbt.dsi.bl_port= s; + + if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.cabc_ports= & ~intel_dsi->ports)) + intel_connector->panel.vbt.dsi.cabc_ports &=3D intel_dsi->ports; + intel_dsi->dcs_cabc_ports =3D intel_connector->panel.vbt.dsi.cabc_ports; =20 for_each_dsi_port(port, intel_dsi->ports) { diff --git a/drivers/gpu/drm/i915/display/vlv_dsi.c b/drivers/gpu/drm/i915/= display/vlv_dsi.c index be8fd3c362df..02f75e95b2ec 100644 --- a/drivers/gpu/drm/i915/display/vlv_dsi.c +++ b/drivers/gpu/drm/i915/display/vlv_dsi.c @@ -1933,7 +1933,14 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv) else intel_dsi->ports =3D BIT(port); =20 + if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.bl_ports &= ~intel_dsi->ports)) + intel_connector->panel.vbt.dsi.bl_ports &=3D intel_dsi->ports; + intel_dsi->dcs_backlight_ports =3D intel_connector->panel.vbt.dsi.bl_port= s; + + if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.cabc_ports= & ~intel_dsi->ports)) + intel_connector->panel.vbt.dsi.cabc_ports &=3D intel_dsi->ports; + intel_dsi->dcs_cabc_ports =3D intel_connector->panel.vbt.dsi.cabc_ports; =20 /* Create a DSI host (and a device) for each port. */ --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 808D5C07E9D for ; Mon, 26 Sep 2022 11:40:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234611AbiIZLka (ORCPT ); Mon, 26 Sep 2022 07:40:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238389AbiIZLjL (ORCPT ); Mon, 26 Sep 2022 07:39:11 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E5162AC5; Mon, 26 Sep 2022 03:44:50 -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 sin.source.kernel.org (Postfix) with ESMTPS id DE6C6CE1102; Mon, 26 Sep 2022 10:43:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF99BC433D6; Mon, 26 Sep 2022 10:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188980; bh=Aom8kWSJgu4UOgAA9Ykj7bRPrOyf+X8yQTwtsQacFMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EEZsPFgJ4rVj6LNOU6Zqw0j5Rq3MAP0Cs+MOkn5h8TagLLEd0NnFlae9x15PMEEc/ JbE18ogcXWPgUxBIukwuCKh8hkEl2qOZ0AYAs4RO90TtrGDIEzXWh044BSlsQfUoj6 /cQjebeVkRq+zAbPALWFoZGwv00pSoVuXxCchsoU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jani Nikula , Stanislav Lisovskiy , Rodrigo Vivi , Sasha Levin Subject: [PATCH 5.19 007/207] drm/i915/dsi: fix dual-link DSI backlight and CABC ports for display 11+ Date: Mon, 26 Sep 2022 12:09:56 +0200 Message-Id: <20220926100806.807881703@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jani Nikula [ Upstream commit 13393f65b77445d8b0f99c7b605cc9ccc936586f ] The VBT dual-link DSI backlight and CABC still use ports A and C, both in Bspec and code, while display 11+ DSI only supports ports A and B. Assume port C actually means port B for display 11+ when parsing VBT. Bspec: 20154 Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6476 Cc: stable@vger.kernel.org Signed-off-by: Jani Nikula Reviewed-by: Stanislav Lisovskiy Link: https://patchwork.freedesktop.org/patch/msgid/8c462718bcc7b36a83e09d0= a5eef058b6bc8b1a2.1660664162.git.jani.nikula@intel.com (cherry picked from commit ab55165d73a444606af1530cd0d6448b04370f68) Signed-off-by: Rodrigo Vivi Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/i915/display/intel_bios.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i9= 15/display/intel_bios.c index d5d20a44f373..b5de61fe9cc6 100644 --- a/drivers/gpu/drm/i915/display/intel_bios.c +++ b/drivers/gpu/drm/i915/display/intel_bios.c @@ -1473,6 +1473,8 @@ static void parse_dsi_backlight_ports(struct drm_i915= _private *i915, struct intel_panel *panel, enum port port) { + enum port port_bc =3D DISPLAY_VER(i915) >=3D 11 ? PORT_B : PORT_C; + if (!panel->vbt.dsi.config->dual_link || i915->vbt.version < 197) { panel->vbt.dsi.bl_ports =3D BIT(port); if (panel->vbt.dsi.config->cabc_supported) @@ -1486,11 +1488,11 @@ static void parse_dsi_backlight_ports(struct drm_i9= 15_private *i915, panel->vbt.dsi.bl_ports =3D BIT(PORT_A); break; case DL_DCS_PORT_C: - panel->vbt.dsi.bl_ports =3D BIT(PORT_C); + panel->vbt.dsi.bl_ports =3D BIT(port_bc); break; default: case DL_DCS_PORT_A_AND_C: - panel->vbt.dsi.bl_ports =3D BIT(PORT_A) | BIT(PORT_C); + panel->vbt.dsi.bl_ports =3D BIT(PORT_A) | BIT(port_bc); break; } =20 @@ -1502,12 +1504,12 @@ static void parse_dsi_backlight_ports(struct drm_i9= 15_private *i915, panel->vbt.dsi.cabc_ports =3D BIT(PORT_A); break; case DL_DCS_PORT_C: - panel->vbt.dsi.cabc_ports =3D BIT(PORT_C); + panel->vbt.dsi.cabc_ports =3D BIT(port_bc); break; default: case DL_DCS_PORT_A_AND_C: panel->vbt.dsi.cabc_ports =3D - BIT(PORT_A) | BIT(PORT_C); + BIT(PORT_A) | BIT(port_bc); break; } } --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C30EC32771 for ; Mon, 26 Sep 2022 11:40:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238227AbiIZLkC (ORCPT ); Mon, 26 Sep 2022 07:40:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238254AbiIZLin (ORCPT ); Mon, 26 Sep 2022 07:38:43 -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 85CF9DF53; Mon, 26 Sep 2022 03:44: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 dfw.source.kernel.org (Postfix) with ESMTPS id D28DF604F5; Mon, 26 Sep 2022 10:43:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C24A7C433C1; Mon, 26 Sep 2022 10:43:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188983; bh=RPY5zWmkon6xdL9dtCBQBZz/2MPROkphoiQZMo9BrOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UeYcUcJhh43DS02EyOmrDdV2ltIIaF9HpMKr+CatEu+JVD5PEZceNoNC19jn7NRSF LrbCAu6xjB1//jwf1Fk5YSWTQyYBQj22U/0rr+B/9oLKoEbu9tVO7uHIYWaRMOKpuP UtFp0dyEGay1N81e78+TIN18F73VkV9Ocsx4HsOg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Ronnie Sahlberg , Steve French , Sasha Levin Subject: [PATCH 5.19 008/207] smb3: Move the flush out of smb2_copychunk_range() into its callers Date: Mon, 26 Sep 2022 12:09:57 +0200 Message-Id: <20220926100806.856190602@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: David Howells [ Upstream commit c3a72bb213209adfe981a4a92ea5746a778323e4 ] Move the flush out of smb2_copychunk_range() into its callers. This will allow the pagecache to be invalidated between the flush and the operation in smb3_collapse_range() and smb3_insert_range(). Signed-off-by: David Howells cc: Ronnie Sahlberg Signed-off-by: Steve French Stable-dep-of: fa30a81f255a ("smb3: fix temporary data corruption in collap= se range") Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/cifs/cifsfs.c | 2 ++ fs/cifs/smb2ops.c | 20 ++++++++------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 8f2e003e0590..2b51f0cbf4d2 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -1203,6 +1203,8 @@ ssize_t cifs_file_copychunk_range(unsigned int xid, =20 cifs_dbg(FYI, "copychunk range\n"); =20 + filemap_write_and_wait(src_inode->i_mapping); + if (!src_file->private_data || !dst_file->private_data) { rc =3D -EBADF; cifs_dbg(VFS, "missing cifsFileInfo on copy range src file\n"); diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index e8a8daa82ed7..ef8cb7fbabeb 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -1886,17 +1886,8 @@ smb2_copychunk_range(const unsigned int xid, int chunks_copied =3D 0; bool chunk_sizes_updated =3D false; ssize_t bytes_written, total_bytes_written =3D 0; - struct inode *inode; =20 pcchunk =3D kmalloc(sizeof(struct copychunk_ioctl), GFP_KERNEL); - - /* - * We need to flush all unwritten data before we can send the - * copychunk ioctl to the server. - */ - inode =3D d_inode(trgtfile->dentry); - filemap_write_and_wait(inode->i_mapping); - if (pcchunk =3D=3D NULL) return -ENOMEM; =20 @@ -3977,6 +3968,8 @@ static long smb3_collapse_range(struct file *file, st= ruct cifs_tcon *tcon, goto out; } =20 + filemap_write_and_wait(inode->i_mapping); + rc =3D smb2_copychunk_range(xid, cfile, cfile, off + len, i_size_read(inode) - off - len, off); if (rc < 0) @@ -4004,18 +3997,21 @@ static long smb3_insert_range(struct file *file, st= ruct cifs_tcon *tcon, int rc; unsigned int xid; struct cifsFileInfo *cfile =3D file->private_data; + struct inode *inode =3D file_inode(file); __le64 eof; __u64 count; =20 xid =3D get_xid(); =20 - if (off >=3D i_size_read(file->f_inode)) { + if (off >=3D i_size_read(inode)) { rc =3D -EINVAL; goto out; } =20 - count =3D i_size_read(file->f_inode) - off; - eof =3D cpu_to_le64(i_size_read(file->f_inode) + len); + count =3D i_size_read(inode) - off; + eof =3D cpu_to_le64(i_size_read(inode) + len); + + filemap_write_and_wait(inode->i_mapping); =20 rc =3D SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, cfile->fid.volatile_fid, cfile->pid, &eof); --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39E1AC07E9D for ; Mon, 26 Sep 2022 11:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235547AbiIZLez (ORCPT ); Mon, 26 Sep 2022 07:34:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238057AbiIZLdG (ORCPT ); Mon, 26 Sep 2022 07:33:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5EF56DFBA; Mon, 26 Sep 2022 03:43: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 dfw.source.kernel.org (Postfix) with ESMTPS id 01AF960B6A; Mon, 26 Sep 2022 10:43:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB600C433D6; Mon, 26 Sep 2022 10:43:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188986; bh=9tDA6zF8149gV29rFUCy+sshSnUxadCtFYcNRA/IQD8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ShrTeC7TnbzxT2CpEu1fm1eubTV/J+duLVzJoCInbmR4vvXMGClFmpHYksZhdpkbd e907zorZ+DMg+ywR1fxJXMK5OrzpJDeUlZI87fnqNO2Qb6QuCRQyLDjHdikXDe4850 CW9DLVGi+PASxBpFCbQX5PvkIW1hm/EEdnhvQKP8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Ronnie Sahlberg , Steve French , Sasha Levin Subject: [PATCH 5.19 009/207] smb3: fix temporary data corruption in collapse range Date: Mon, 26 Sep 2022 12:09:58 +0200 Message-Id: <20220926100806.904995027@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steve French [ Upstream commit fa30a81f255a56cccd89552cd6ce7ea6e8d8acc4 ] collapse range doesn't discard the affected cached region so can risk temporarily corrupting the file data. This fixes xfstest generic/031 I also decided to merge a minor cleanup to this into the same patch (avoiding rereading inode size repeatedly unnecessarily) to make it clearer. Cc: stable@vger.kernel.org Fixes: 5476b5dd82c8b ("cifs: add support for FALLOC_FL_COLLAPSE_RANGE") Reported-by: David Howells Tested-by: David Howells Reviewed-by: David Howells cc: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/cifs/smb2ops.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index ef8cb7fbabeb..8e55495c4f7e 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -3952,41 +3952,47 @@ static long smb3_collapse_range(struct file *file, = struct cifs_tcon *tcon, { int rc; unsigned int xid; - struct inode *inode; + struct inode *inode =3D file_inode(file); struct cifsFileInfo *cfile =3D file->private_data; - struct cifsInodeInfo *cifsi; + struct cifsInodeInfo *cifsi =3D CIFS_I(inode); __le64 eof; + loff_t old_eof; =20 xid =3D get_xid(); =20 - inode =3D d_inode(cfile->dentry); - cifsi =3D CIFS_I(inode); + inode_lock(inode); =20 - if (off >=3D i_size_read(inode) || - off + len >=3D i_size_read(inode)) { + old_eof =3D i_size_read(inode); + if ((off >=3D old_eof) || + off + len >=3D old_eof) { rc =3D -EINVAL; goto out; } =20 + filemap_invalidate_lock(inode->i_mapping); filemap_write_and_wait(inode->i_mapping); + truncate_pagecache_range(inode, off, old_eof); =20 rc =3D smb2_copychunk_range(xid, cfile, cfile, off + len, - i_size_read(inode) - off - len, off); + old_eof - off - len, off); if (rc < 0) - goto out; + goto out_2; =20 - eof =3D cpu_to_le64(i_size_read(inode) - len); + eof =3D cpu_to_le64(old_eof - len); rc =3D SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, cfile->fid.volatile_fid, cfile->pid, &eof); if (rc < 0) - goto out; + goto out_2; =20 rc =3D 0; =20 cifsi->server_eof =3D i_size_read(inode) - len; truncate_setsize(inode, cifsi->server_eof); fscache_resize_cookie(cifs_inode_cookie(inode), cifsi->server_eof); +out_2: + filemap_invalidate_unlock(inode->i_mapping); out: + inode_unlock(inode); free_xid(xid); return rc; } --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64372C6FA83 for ; Mon, 26 Sep 2022 11:35:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238085AbiIZLfu (ORCPT ); Mon, 26 Sep 2022 07:35:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238223AbiIZLe1 (ORCPT ); Mon, 26 Sep 2022 07:34:27 -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 11FAD6E8A7; Mon, 26 Sep 2022 03:43:41 -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 5429C60B60; Mon, 26 Sep 2022 10:41:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B1B4C433D6; Mon, 26 Sep 2022 10:41:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188902; bh=9WSwyR/5B55U+zFq6JuO1ZPxrcKHAm4xYzfZ9iqMYRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XQPx4fpGwlYS6JI8mx2iewcgXE0m4llIgMTosAzjqSJURBNdSyVwTQDMFWjB5eeIo 1XRNoYplnXppt50oOAt3T6bXdNpzdHC5eNQug0BR+LucExW4ohdCIxcprkzHrHbWVx qXBP7Eh2VqHWJx/GJYpLGqWs7lLSSzxvd3Cg6TfY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Ronnie Sahlberg , Steve French , Sasha Levin Subject: [PATCH 5.19 010/207] smb3: fix temporary data corruption in insert range Date: Mon, 26 Sep 2022 12:09:59 +0200 Message-Id: <20220926100806.953961741@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: David Howells [ Upstream commit 9c8b7a293f50253e694f19161c045817a938e551 ] insert range doesn't discard the affected cached region so can risk temporarily corrupting file data. Also includes some minor cleanup (avoiding rereading inode size repeatedly unnecessarily) to make it clearer. Cc: stable@vger.kernel.org Fixes: 7fe6fe95b936 ("cifs: add FALLOC_FL_INSERT_RANGE support") Signed-off-by: David Howells cc: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/cifs/smb2ops.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 8e55495c4f7e..774c6e5f6584 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -4005,35 +4005,43 @@ static long smb3_insert_range(struct file *file, st= ruct cifs_tcon *tcon, struct cifsFileInfo *cfile =3D file->private_data; struct inode *inode =3D file_inode(file); __le64 eof; - __u64 count; + __u64 count, old_eof; =20 xid =3D get_xid(); =20 - if (off >=3D i_size_read(inode)) { + inode_lock(inode); + + old_eof =3D i_size_read(inode); + if (off >=3D old_eof) { rc =3D -EINVAL; goto out; } =20 - count =3D i_size_read(inode) - off; - eof =3D cpu_to_le64(i_size_read(inode) + len); + count =3D old_eof - off; + eof =3D cpu_to_le64(old_eof + len); =20 + filemap_invalidate_lock(inode->i_mapping); filemap_write_and_wait(inode->i_mapping); + truncate_pagecache_range(inode, off, old_eof); =20 rc =3D SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, cfile->fid.volatile_fid, cfile->pid, &eof); if (rc < 0) - goto out; + goto out_2; =20 rc =3D smb2_copychunk_range(xid, cfile, cfile, off, count, off + len); if (rc < 0) - goto out; + goto out_2; =20 - rc =3D smb3_zero_range(file, tcon, off, len, 1); + rc =3D smb3_zero_data(file, tcon, off, len, xid); if (rc < 0) - goto out; + goto out_2; =20 rc =3D 0; +out_2: + filemap_invalidate_unlock(inode->i_mapping); out: + inode_unlock(inode); free_xid(xid); return rc; } --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82F8CC07E9D for ; Mon, 26 Sep 2022 11:38:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238192AbiIZLiE (ORCPT ); Mon, 26 Sep 2022 07:38:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238164AbiIZLhN (ORCPT ); Mon, 26 Sep 2022 07:37:13 -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 B42D76E8B2; Mon, 26 Sep 2022 03:44: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 ams.source.kernel.org (Postfix) with ESMTPS id 29AE8B8068A; Mon, 26 Sep 2022 10:41:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D6CBC433C1; Mon, 26 Sep 2022 10:41:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188905; bh=qqskinfIqSFhiOcRad+02oGNyNZWFUzlMULSkLljyMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=luenHxc8NwJiuHN6SsDBij0KIPMvyALY2/V/PeQdMMMiRa2OA+DoyBjBq7Woap6IQ 2gUFJ1NJbdBBCXKdDth82CxaN9STC4wfNjgsUCVQn828sF53taK65s3V9NEspj9gxe XHd3dXa9DrmLa7ws3GUtLM2Mb1dC1AntmY4ekX9s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jean-Francois Le Fillatre , stable , Sasha Levin Subject: [PATCH 5.19 011/207] usb: add quirks for Lenovo OneLink+ Dock Date: Mon, 26 Sep 2022 12:10:00 +0200 Message-Id: <20220926100806.994986015@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jean-Francois Le Fillatre [ Upstream commit 3d5f70949f1b1168fbb17d06eb5c57e984c56c58 ] The Lenovo OneLink+ Dock contains two VL812 USB3.0 controllers: 17ef:1018 upstream 17ef:1019 downstream Those two controllers both have problems with some USB3.0 devices, particularly self-powered ones. Typical error messages include: Timeout while waiting for setup device command device not accepting address X, error -62 unable to enumerate USB device By process of elimination the controllers themselves were identified as the cause of the problem. Through trial and error the issue was solved by using USB_QUIRK_RESET_RESUME for both chips. Signed-off-by: Jean-Francois Le Fillatre Cc: stable Link: https://lore.kernel.org/r/20220824191320.17883-1-jflf_kernel@gmx.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/usb/core/quirks.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index f99a65a64588..999b7c9697fc 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c @@ -437,6 +437,10 @@ static const struct usb_device_id usb_quirk_list[] =3D= { { USB_DEVICE(0x1532, 0x0116), .driver_info =3D USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, =20 + /* Lenovo ThinkPad OneLink+ Dock twin hub controllers (VIA Labs VL812) */ + { USB_DEVICE(0x17ef, 0x1018), .driver_info =3D USB_QUIRK_RESET_RESUME }, + { USB_DEVICE(0x17ef, 0x1019), .driver_info =3D USB_QUIRK_RESET_RESUME }, + /* Lenovo USB-C to Ethernet Adapter RTL8153-04 */ { USB_DEVICE(0x17ef, 0x720c), .driver_info =3D USB_QUIRK_NO_LPM }, =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74D11C32771 for ; Mon, 26 Sep 2022 12:26:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235442AbiIZM0p (ORCPT ); Mon, 26 Sep 2022 08:26:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239523AbiIZMZv (ORCPT ); Mon, 26 Sep 2022 08:25:51 -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 A06DFAA35B; Mon, 26 Sep 2022 04:06:57 -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 36241B80688; Mon, 26 Sep 2022 10:41:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EC0AC433C1; Mon, 26 Sep 2022 10:41:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188908; bh=rlxcesN7qhA1c2BoO3vxKUaXLDJZwCFH10u7hTINxcA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H3N4R8rcqkVzOB6k/VORxCmZWONioKJ+gSQBqngguLFm2MxnxspVl8HraJGnEygta E32Hte8yTVVW+J4IIny07F5sHlzAhC9+WKqvq9byfHis2hWAC3i1Jp5V5JURx7l0sT ZKhGD5E49XYOPkrOOs1PJCZdf8VTCp04SGVMCXYE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Piyush Mehta , Sasha Levin Subject: [PATCH 5.19 012/207] usb: gadget: udc-xilinx: replace memcpy with memcpy_toio Date: Mon, 26 Sep 2022 12:10:01 +0200 Message-Id: <20220926100807.033944502@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Piyush Mehta [ Upstream commit 8cb339f1c1f04baede9d54c1e40ac96247a6393b ] For ARM processor, unaligned access to device memory is not allowed. Method memcpy does not take care of alignment. USB detection failure with the unaligned address of memory access, with below kernel crash. To fix the unaligned address the kernel panic issue, replace memcpy with memcpy_toio method. Kernel crash: Unable to handle kernel paging request at virtual address ffff80000c05008a Mem abort info: ESR =3D 0x96000061 EC =3D 0x25: DABT (current EL), IL =3D 32 bits SET =3D 0, FnV =3D 0 EA =3D 0, S1PTW =3D 0 FSC =3D 0x21: alignment fault Data abort info: ISV =3D 0, ISS =3D 0x00000061 CM =3D 0, WnR =3D 1 swapper pgtable: 4k pages, 48-bit VAs, pgdp=3D000000000143b000 [ffff80000c05008a] pgd=3D100000087ffff003, p4d=3D100000087ffff003, pud=3D100000087fffe003, pmd=3D1000000800bcc003, pte=3D00680000a0010713 Internal error: Oops: 96000061 [#1] SMP Modules linked in: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.15.19-xilinx-v2022.1 #1 Hardware name: ZynqMP ZCU102 Rev1.0 (DT) pstate: 200000c5 (nzCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=3D--) pc : __memcpy+0x30/0x260 lr : __xudc_ep0_queue+0xf0/0x110 sp : ffff800008003d00 x29: ffff800008003d00 x28: ffff800009474e80 x27: 00000000000000a0 x26: 0000000000000100 x25: 0000000000000012 x24: ffff000800bc8080 x23: 0000000000000001 x22: 0000000000000012 x21: ffff000800bc8080 x20: 0000000000000012 x19: ffff000800bc8080 x18: 0000000000000000 x17: ffff800876482000 x16: ffff800008004000 x15: 0000000000004000 x14: 00001f09785d0400 x13: 0103020101005567 x12: 0781400000000200 x11: 00000000c5672a10 x10: 00000000000008d0 x9 : ffff800009463cf0 x8 : ffff8000094757b0 x7 : 0201010055670781 x6 : 4000000002000112 x5 : ffff80000c05009a x4 : ffff000800a15012 x3 : ffff00080362ad80 x2 : 0000000000000012 x1 : ffff000800a15000 x0 : ffff80000c050088 Call trace: __memcpy+0x30/0x260 xudc_ep0_queue+0x3c/0x60 usb_ep_queue+0x38/0x44 composite_ep0_queue.constprop.0+0x2c/0xc0 composite_setup+0x8d0/0x185c configfs_composite_setup+0x74/0xb0 xudc_irq+0x570/0xa40 __handle_irq_event_percpu+0x58/0x170 handle_irq_event+0x60/0x120 handle_fasteoi_irq+0xc0/0x220 handle_domain_irq+0x60/0x90 gic_handle_irq+0x74/0xa0 call_on_irq_stack+0x2c/0x60 do_interrupt_handler+0x54/0x60 el1_interrupt+0x30/0x50 el1h_64_irq_handler+0x18/0x24 el1h_64_irq+0x78/0x7c arch_cpu_idle+0x18/0x2c do_idle+0xdc/0x15c cpu_startup_entry+0x28/0x60 rest_init+0xc8/0xe0 arch_call_rest_init+0x10/0x1c start_kernel+0x694/0x6d4 __primary_switched+0xa4/0xac Fixes: 1f7c51660034 ("usb: gadget: Add xilinx usb2 device support") Cc: stable@vger.kernel.org Reviewed-by: Linus Walleij Signed-off-by: Piyush Mehta Link: https://lore.kernel.org/r/20220824071253.1261096-1-piyush.mehta@amd.c= om Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/usb/gadget/udc/udc-xilinx.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/u= dc-xilinx.c index 4827e3cd3834..054b69dc2f0c 100644 --- a/drivers/usb/gadget/udc/udc-xilinx.c +++ b/drivers/usb/gadget/udc/udc-xilinx.c @@ -499,11 +499,11 @@ static int xudc_eptxrx(struct xusb_ep *ep, struct xus= b_req *req, /* Get the Buffer address and copy the transmit data.*/ eprambase =3D (u32 __force *)(udc->addr + ep->rambase); if (ep->is_in) { - memcpy(eprambase, bufferptr, bytestosend); + memcpy_toio(eprambase, bufferptr, bytestosend); udc->write_fn(udc->addr, ep->offset + XUSB_EP_BUF0COUNT_OFFSET, bufferlen); } else { - memcpy(bufferptr, eprambase, bytestosend); + memcpy_toio(bufferptr, eprambase, bytestosend); } /* * Enable the buffer for transmission. @@ -517,11 +517,11 @@ static int xudc_eptxrx(struct xusb_ep *ep, struct xus= b_req *req, eprambase =3D (u32 __force *)(udc->addr + ep->rambase + ep->ep_usb.maxpacket); if (ep->is_in) { - memcpy(eprambase, bufferptr, bytestosend); + memcpy_toio(eprambase, bufferptr, bytestosend); udc->write_fn(udc->addr, ep->offset + XUSB_EP_BUF1COUNT_OFFSET, bufferlen); } else { - memcpy(bufferptr, eprambase, bytestosend); + memcpy_toio(bufferptr, eprambase, bytestosend); } /* * Enable the buffer for transmission. @@ -1023,7 +1023,7 @@ static int __xudc_ep0_queue(struct xusb_ep *ep0, stru= ct xusb_req *req) udc->addr); length =3D req->usb_req.actual =3D min_t(u32, length, EP0_MAX_PACKET); - memcpy(corebuf, req->usb_req.buf, length); + memcpy_toio(corebuf, req->usb_req.buf, length); udc->write_fn(udc->addr, XUSB_EP_BUF0COUNT_OFFSET, length); udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET, 1); } else { @@ -1752,7 +1752,7 @@ static void xudc_handle_setup(struct xusb_udc *udc) =20 /* Load up the chapter 9 command buffer.*/ ep0rambase =3D (u32 __force *) (udc->addr + XUSB_SETUP_PKT_ADDR_OFFSET); - memcpy(&setup, ep0rambase, 8); + memcpy_toio(&setup, ep0rambase, 8); =20 udc->setup =3D setup; udc->setup.wValue =3D cpu_to_le16(setup.wValue); @@ -1839,7 +1839,7 @@ static void xudc_ep0_out(struct xusb_udc *udc) (ep0->rambase << 2)); buffer =3D req->usb_req.buf + req->usb_req.actual; req->usb_req.actual =3D req->usb_req.actual + bytes_to_rx; - memcpy(buffer, ep0rambase, bytes_to_rx); + memcpy_toio(buffer, ep0rambase, bytes_to_rx); =20 if (req->usb_req.length =3D=3D req->usb_req.actual) { /* Data transfer completed get ready for Status stage */ @@ -1915,7 +1915,7 @@ static void xudc_ep0_in(struct xusb_udc *udc) (ep0->rambase << 2)); buffer =3D req->usb_req.buf + req->usb_req.actual; req->usb_req.actual =3D req->usb_req.actual + length; - memcpy(ep0rambase, buffer, length); + memcpy_toio(ep0rambase, buffer, length); } udc->write_fn(udc->addr, XUSB_EP_BUF0COUNT_OFFSET, count); udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET, 1); --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D36EC32771 for ; Mon, 26 Sep 2022 11:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234424AbiIZLba (ORCPT ); Mon, 26 Sep 2022 07:31:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235576AbiIZLap (ORCPT ); Mon, 26 Sep 2022 07:30:45 -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 02B2B6C105; Mon, 26 Sep 2022 03:41:59 -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 64800B80977; Mon, 26 Sep 2022 10:41:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1463C433D6; Mon, 26 Sep 2022 10:41:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188912; bh=avOiRSD0S5RoPyIj8d8waMaD+KxGfn527ZqGmOkuKVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YahPqy1ap8JP4yEjjzo9r0jnxuP0RU91/cCkPMRM8P3QkGgojKmkquu1Wl6CCmQMH 7ThDNdsKsuQFXacKS5hcbB6/996W9PYYw3moAjdObEAGImZC9fl/m/RSVvPtGXDLAS HPUJduJ2vtXyrXzMhohz4Qc5y9t74SQU2wSbi3Ko= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paulo Alcantara (SUSE)" , David Howells , Steve French , Sasha Levin Subject: [PATCH 5.19 013/207] smb3: use filemap_write_and_wait_range instead of filemap_write_and_wait Date: Mon, 26 Sep 2022 12:10:02 +0200 Message-Id: <20220926100807.074513699@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steve French [ Upstream commit 3e3761f1ec7df67d88cfca5e2ea98538f529e645 ] When doing insert range and collapse range we should be writing out the cached pages for the ranges affected but not the whole file. Fixes: c3a72bb21320 ("smb3: Move the flush out of smb2_copychunk_range() in= to its callers") Cc: stable@vger.kernel.org Reviewed-by: Paulo Alcantara (SUSE) Reviewed-by: David Howells Signed-off-by: Steve French Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/cifs/cifsfs.c | 8 ++++++-- fs/cifs/smb2ops.c | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 2b51f0cbf4d2..97278c43f8dc 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -1203,8 +1203,6 @@ ssize_t cifs_file_copychunk_range(unsigned int xid, =20 cifs_dbg(FYI, "copychunk range\n"); =20 - filemap_write_and_wait(src_inode->i_mapping); - if (!src_file->private_data || !dst_file->private_data) { rc =3D -EBADF; cifs_dbg(VFS, "missing cifsFileInfo on copy range src file\n"); @@ -1234,6 +1232,12 @@ ssize_t cifs_file_copychunk_range(unsigned int xid, lock_two_nondirectories(target_inode, src_inode); =20 cifs_dbg(FYI, "about to flush pages\n"); + + rc =3D filemap_write_and_wait_range(src_inode->i_mapping, off, + off + len - 1); + if (rc) + goto out; + /* should we flush first and last page first */ truncate_inode_pages(&target_inode->i_data, 0); =20 diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 774c6e5f6584..cc180d37b8ce 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -3970,7 +3970,10 @@ static long smb3_collapse_range(struct file *file, s= truct cifs_tcon *tcon, } =20 filemap_invalidate_lock(inode->i_mapping); - filemap_write_and_wait(inode->i_mapping); + rc =3D filemap_write_and_wait_range(inode->i_mapping, off, old_eof - 1); + if (rc < 0) + goto out_2; + truncate_pagecache_range(inode, off, old_eof); =20 rc =3D smb2_copychunk_range(xid, cfile, cfile, off + len, @@ -4021,7 +4024,9 @@ static long smb3_insert_range(struct file *file, stru= ct cifs_tcon *tcon, eof =3D cpu_to_le64(old_eof + len); =20 filemap_invalidate_lock(inode->i_mapping); - filemap_write_and_wait(inode->i_mapping); + rc =3D filemap_write_and_wait_range(inode->i_mapping, off, old_eof + len = - 1); + if (rc < 0) + goto out_2; truncate_pagecache_range(inode, off, old_eof); =20 rc =3D SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 085C4C32771 for ; Mon, 26 Sep 2022 11:31:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236064AbiIZLbY (ORCPT ); Mon, 26 Sep 2022 07:31:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235547AbiIZLap (ORCPT ); Mon, 26 Sep 2022 07:30:45 -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 435F36CD0D; Mon, 26 Sep 2022 03:42:16 -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 BC866B80957; Mon, 26 Sep 2022 10:41:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 022BAC433C1; Mon, 26 Sep 2022 10:41:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188915; bh=GdDUD7KOy9ItThcRwpu3l9kw+H45iGoDS4QgSG4WwD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PoLA/GXwGlq0IPnP8Mkm9Q4B5U4Ku2JYXkz5qEVuouj99KYcSH7D2wNalfz9DuRC2 e5SZTA9TUgfO6nLR8i4TNfDY68cWvvh/6HKqTvalrLhH5ksJn7LEQ/yUqtfsZGEgnJ 6akRxZjOlDO4WD0hvFAlq/SmWCY8N7Bypg75wQiw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Neukum , Jean-Francois Le Fillatre , stable , Sasha Levin Subject: [PATCH 5.19 014/207] Revert "usb: add quirks for Lenovo OneLink+ Dock" Date: Mon, 26 Sep 2022 12:10:03 +0200 Message-Id: <20220926100807.118539823@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Greg Kroah-Hartman [ Upstream commit 58bfe7d8e31014d7ce246788df99c56e3cfe6c68 ] This reverts commit 3d5f70949f1b1168fbb17d06eb5c57e984c56c58. The quirk does not work properly, more work is needed to determine what should be done here. Reported-by: Oliver Neukum Cc: Jean-Francois Le Fillatre Cc: stable Fixes: 3d5f70949f1b ("usb: add quirks for Lenovo OneLink+ Dock") Link: https://lore.kernel.org/r/9a17ea86-079f-510d-e919-01bc53a6d09f@gmx.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/usb/core/quirks.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 999b7c9697fc..f99a65a64588 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c @@ -437,10 +437,6 @@ static const struct usb_device_id usb_quirk_list[] =3D= { { USB_DEVICE(0x1532, 0x0116), .driver_info =3D USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, =20 - /* Lenovo ThinkPad OneLink+ Dock twin hub controllers (VIA Labs VL812) */ - { USB_DEVICE(0x17ef, 0x1018), .driver_info =3D USB_QUIRK_RESET_RESUME }, - { USB_DEVICE(0x17ef, 0x1019), .driver_info =3D USB_QUIRK_RESET_RESUME }, - /* Lenovo USB-C to Ethernet Adapter RTL8153-04 */ { USB_DEVICE(0x17ef, 0x720c), .driver_info =3D USB_QUIRK_NO_LPM }, =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21CBAC07E9D for ; Mon, 26 Sep 2022 11:38:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236235AbiIZLiO (ORCPT ); Mon, 26 Sep 2022 07:38:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238124AbiIZLhb (ORCPT ); Mon, 26 Sep 2022 07:37:31 -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 0EB021EAF4; Mon, 26 Sep 2022 03:44: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 1587B60BB7; Mon, 26 Sep 2022 10:41:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B3C5C433D6; Mon, 26 Sep 2022 10:41:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188918; bh=i78EKnG8U9fperRxE5czaMsK5BKLHXSW/sdFBVAY1Mg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S5A+Lte31LXZmld2wqX0epXbskBxd/I6oS2AAAdt4csPDDEVnRJ4S0x+bXu7SyGRS 4FcsFh+2T24MEpqU5HwWfiWouRq4JJ0yeJhKXdoEITTQIcKkYWjM/qMmryxznlxYYS 4sia++z2ZTZfb71QDRePB2in/f/0aXEOkdL/+f0g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Linus Walleij , Piyush Mehta , Sasha Levin Subject: [PATCH 5.19 015/207] Revert "usb: gadget: udc-xilinx: replace memcpy with memcpy_toio" Date: Mon, 26 Sep 2022 12:10:04 +0200 Message-Id: <20220926100807.157458540@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Greg Kroah-Hartman [ Upstream commit fe0a2ac7c627b064c479ad0c3b25e531d342e048 ] This reverts commit 8cb339f1c1f04baede9d54c1e40ac96247a6393b as it throws up a bunch of sparse warnings as reported by the kernel test robot. Reported-by: kernel test robot Link: https://lore.kernel.org/r/202209020044.CX2PfZzM-lkp@intel.com Fixes: 8cb339f1c1f0 ("usb: gadget: udc-xilinx: replace memcpy with memcpy_t= oio") Cc: stable@vger.kernel.org Cc: Linus Walleij Cc: Piyush Mehta Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/usb/gadget/udc/udc-xilinx.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/u= dc-xilinx.c index 054b69dc2f0c..4827e3cd3834 100644 --- a/drivers/usb/gadget/udc/udc-xilinx.c +++ b/drivers/usb/gadget/udc/udc-xilinx.c @@ -499,11 +499,11 @@ static int xudc_eptxrx(struct xusb_ep *ep, struct xus= b_req *req, /* Get the Buffer address and copy the transmit data.*/ eprambase =3D (u32 __force *)(udc->addr + ep->rambase); if (ep->is_in) { - memcpy_toio(eprambase, bufferptr, bytestosend); + memcpy(eprambase, bufferptr, bytestosend); udc->write_fn(udc->addr, ep->offset + XUSB_EP_BUF0COUNT_OFFSET, bufferlen); } else { - memcpy_toio(bufferptr, eprambase, bytestosend); + memcpy(bufferptr, eprambase, bytestosend); } /* * Enable the buffer for transmission. @@ -517,11 +517,11 @@ static int xudc_eptxrx(struct xusb_ep *ep, struct xus= b_req *req, eprambase =3D (u32 __force *)(udc->addr + ep->rambase + ep->ep_usb.maxpacket); if (ep->is_in) { - memcpy_toio(eprambase, bufferptr, bytestosend); + memcpy(eprambase, bufferptr, bytestosend); udc->write_fn(udc->addr, ep->offset + XUSB_EP_BUF1COUNT_OFFSET, bufferlen); } else { - memcpy_toio(bufferptr, eprambase, bytestosend); + memcpy(bufferptr, eprambase, bytestosend); } /* * Enable the buffer for transmission. @@ -1023,7 +1023,7 @@ static int __xudc_ep0_queue(struct xusb_ep *ep0, stru= ct xusb_req *req) udc->addr); length =3D req->usb_req.actual =3D min_t(u32, length, EP0_MAX_PACKET); - memcpy_toio(corebuf, req->usb_req.buf, length); + memcpy(corebuf, req->usb_req.buf, length); udc->write_fn(udc->addr, XUSB_EP_BUF0COUNT_OFFSET, length); udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET, 1); } else { @@ -1752,7 +1752,7 @@ static void xudc_handle_setup(struct xusb_udc *udc) =20 /* Load up the chapter 9 command buffer.*/ ep0rambase =3D (u32 __force *) (udc->addr + XUSB_SETUP_PKT_ADDR_OFFSET); - memcpy_toio(&setup, ep0rambase, 8); + memcpy(&setup, ep0rambase, 8); =20 udc->setup =3D setup; udc->setup.wValue =3D cpu_to_le16(setup.wValue); @@ -1839,7 +1839,7 @@ static void xudc_ep0_out(struct xusb_udc *udc) (ep0->rambase << 2)); buffer =3D req->usb_req.buf + req->usb_req.actual; req->usb_req.actual =3D req->usb_req.actual + bytes_to_rx; - memcpy_toio(buffer, ep0rambase, bytes_to_rx); + memcpy(buffer, ep0rambase, bytes_to_rx); =20 if (req->usb_req.length =3D=3D req->usb_req.actual) { /* Data transfer completed get ready for Status stage */ @@ -1915,7 +1915,7 @@ static void xudc_ep0_in(struct xusb_udc *udc) (ep0->rambase << 2)); buffer =3D req->usb_req.buf + req->usb_req.actual; req->usb_req.actual =3D req->usb_req.actual + length; - memcpy_toio(ep0rambase, buffer, length); + memcpy(ep0rambase, buffer, length); } udc->write_fn(udc->addr, XUSB_EP_BUF0COUNT_OFFSET, count); udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET, 1); --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1B74C32771 for ; Mon, 26 Sep 2022 11:31:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237999AbiIZLbq (ORCPT ); Mon, 26 Sep 2022 07:31:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237993AbiIZLbA (ORCPT ); Mon, 26 Sep 2022 07:31:00 -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 C43426CD2C; Mon, 26 Sep 2022 03:42:18 -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 C6FB5B80943; Mon, 26 Sep 2022 10:42:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20F48C433D6; Mon, 26 Sep 2022 10:42:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188921; bh=jG+YnRP0qQaGWIPk0TfDfTFYX/DRbm19JxWm/sIXadg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ht64jzD8yJyBK8l/fX97FMGADab+1iS8ciu6A/PWy7Y8G1v0NTd8aOcZ6LD+0DgLc 8hcW74J/Yd/Xj8sAtReStcu+lfsW1Qmmo35hgYrE7Y1uJSwRWEo7j6xTTzRpiQ89st GYi26EL6XMvSHcyGQ7EdVeMPXXaOiH79tAW6Gi4w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antony Antony , Steffen Klassert , Sasha Levin Subject: [PATCH 5.19 016/207] xfrm: fix XFRMA_LASTUSED comment Date: Mon, 26 Sep 2022 12:10:05 +0200 Message-Id: <20220926100807.204896124@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Antony Antony [ Upstream commit 36d763509be326bb383b1b1852a129ff58d74e3b ] It is a __u64, internally time64_t. Fixes: bf825f81b454 ("xfrm: introduce basic mark infrastructure") Signed-off-by: Antony Antony Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- include/uapi/linux/xfrm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h index 65e13a099b1a..a9f5d884560a 100644 --- a/include/uapi/linux/xfrm.h +++ b/include/uapi/linux/xfrm.h @@ -296,7 +296,7 @@ enum xfrm_attr_type_t { XFRMA_ETIMER_THRESH, XFRMA_SRCADDR, /* xfrm_address_t */ XFRMA_COADDR, /* xfrm_address_t */ - XFRMA_LASTUSED, /* unsigned long */ + XFRMA_LASTUSED, /* __u64 */ XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ XFRMA_MIGRATE, XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59A72C32771 for ; Mon, 26 Sep 2022 11:31:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238033AbiIZLby (ORCPT ); Mon, 26 Sep 2022 07:31:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235030AbiIZLbO (ORCPT ); Mon, 26 Sep 2022 07:31:14 -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 150DB6C771; Mon, 26 Sep 2022 03:42: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 27EA160B6A; Mon, 26 Sep 2022 10:42:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35B2AC433C1; Mon, 26 Sep 2022 10:42:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188924; bh=qOPvn88nOro9NoNR2AMFhwam0Y5ciogiY1gY09c+10k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uOa0ouj5otfvNWIEOXu9Rze9Z6W7fdZarG63DJ1E3AMt+GWpNnak1z+g/HtkLPoJq trkPvW0M4tHsXSOyTVwwWr9ALZ8mcseijlso6YqxodOJm5tnHH5yxb0FzvKMoGVjLk 852UzebVKpSvlSw7HCoilab0a7ONag7qbDGqIZyw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Hannes Reinecke , Jens Axboe , Sasha Levin Subject: [PATCH 5.19 017/207] block: remove QUEUE_FLAG_DEAD Date: Mon, 26 Sep 2022 12:10:06 +0200 Message-Id: <20220926100807.246193057@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christoph Hellwig [ Upstream commit 1f90307e5f0d7bc9a336ead528f616a5df8e5944 ] Disallow setting the blk-mq state on any queue that is already dying as setting the state even then is a bad idea, and remove the now unused QUEUE_FLAG_DEAD flag. Signed-off-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Link: https://lore.kernel.org/r/20220619060552.1850436-4-hch@lst.de Signed-off-by: Jens Axboe Stable-dep-of: 8fe4ce5836e9 ("scsi: core: Fix a use-after-free") Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- block/blk-core.c | 3 --- block/blk-mq-debugfs.c | 8 +++----- include/linux/blkdev.h | 2 -- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index cc6fbcb6d252..76f070c3a3b0 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -313,9 +313,6 @@ void blk_cleanup_queue(struct request_queue *q) * after draining finished. */ blk_freeze_queue(q); - - blk_queue_flag_set(QUEUE_FLAG_DEAD, q); - blk_sync_queue(q); if (queue_is_mq(q)) { blk_mq_cancel_work_sync(q); diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index 61f179e5f151..28adb01f6441 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -116,7 +116,6 @@ static const char *const blk_queue_flag_name[] =3D { QUEUE_FLAG_NAME(NOXMERGES), QUEUE_FLAG_NAME(ADD_RANDOM), QUEUE_FLAG_NAME(SAME_FORCE), - QUEUE_FLAG_NAME(DEAD), QUEUE_FLAG_NAME(INIT_DONE), QUEUE_FLAG_NAME(STABLE_WRITES), QUEUE_FLAG_NAME(POLL), @@ -151,11 +150,10 @@ static ssize_t queue_state_write(void *data, const ch= ar __user *buf, char opbuf[16] =3D { }, *op; =20 /* - * The "state" attribute is removed after blk_cleanup_queue() has called - * blk_mq_free_queue(). Return if QUEUE_FLAG_DEAD has been set to avoid - * triggering a use-after-free. + * The "state" attribute is removed when the queue is removed. Don't + * allow setting the state on a dying queue to avoid a use-after-free. */ - if (blk_queue_dead(q)) + if (blk_queue_dying(q)) return -ENOENT; =20 if (count >=3D sizeof(opbuf)) { diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 62e3ff52ab03..76f77eed58c3 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -559,7 +559,6 @@ struct request_queue { #define QUEUE_FLAG_NOXMERGES 9 /* No extended merges */ #define QUEUE_FLAG_ADD_RANDOM 10 /* Contributes to random pool */ #define QUEUE_FLAG_SAME_FORCE 12 /* force complete on same CPU */ -#define QUEUE_FLAG_DEAD 13 /* queue tear-down finished */ #define QUEUE_FLAG_INIT_DONE 14 /* queue is initialized */ #define QUEUE_FLAG_STABLE_WRITES 15 /* don't modify blks until WB is done = */ #define QUEUE_FLAG_POLL 16 /* IO polling enabled if set */ @@ -587,7 +586,6 @@ bool blk_queue_flag_test_and_set(unsigned int flag, str= uct request_queue *q); #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flag= s) #define blk_queue_dying(q) test_bit(QUEUE_FLAG_DYING, &(q)->queue_flags) #define blk_queue_has_srcu(q) test_bit(QUEUE_FLAG_HAS_SRCU, &(q)->queue_fl= ags) -#define blk_queue_dead(q) test_bit(QUEUE_FLAG_DEAD, &(q)->queue_flags) #define blk_queue_init_done(q) test_bit(QUEUE_FLAG_INIT_DONE, &(q)->queue_= flags) #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_fl= ags) #define blk_queue_noxmerges(q) \ --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07195C6FA93 for ; Mon, 26 Sep 2022 11:39:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238081AbiIZLjS (ORCPT ); Mon, 26 Sep 2022 07:39:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238161AbiIZLhv (ORCPT ); Mon, 26 Sep 2022 07:37:51 -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 2CC8ABC81; Mon, 26 Sep 2022 03:44: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 17A57609FE; Mon, 26 Sep 2022 10:42:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D548C433C1; Mon, 26 Sep 2022 10:42:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188927; bh=Y280b8Km9VNvziI6QZoOm5NrPSX5eP3b/H2SGoYxOeQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m/io/nSPoFJ4fziQSefJvpw8ExWwpKTNxMowKdVAkU/p7m0f2pej5kR+xznvr7MdB EWnvmZYgz6IgONGjpVFxDXQ/Cr+oWiFCs5Dq1tkJUBb5B4uq86Hn4lBuNx2qKyKwjV I4zA3i0+ajgqJ/L2X83ly1UJ6sklWz7EFKcdNo2k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Hannes Reinecke , Jens Axboe , Sasha Levin Subject: [PATCH 5.19 018/207] block: stop setting the nomerges flags in blk_cleanup_queue Date: Mon, 26 Sep 2022 12:10:07 +0200 Message-Id: <20220926100807.284103780@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christoph Hellwig [ Upstream commit 0e3534022f26ae51f7cf28347a253230604b6f4e ] These flags only apply to file system I/O, and all file system I/O is already drained by del_gendisk and thus can't be in progress when blk_cleanup_queue is called. Signed-off-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Link: https://lore.kernel.org/r/20220619060552.1850436-5-hch@lst.de Signed-off-by: Jens Axboe Stable-dep-of: 8fe4ce5836e9 ("scsi: core: Fix a use-after-free") Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- block/blk-core.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 76f070c3a3b0..b8083decc07f 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -304,9 +304,6 @@ void blk_cleanup_queue(struct request_queue *q) blk_queue_flag_set(QUEUE_FLAG_DYING, q); blk_queue_start_drain(q); =20 - blk_queue_flag_set(QUEUE_FLAG_NOMERGES, q); - blk_queue_flag_set(QUEUE_FLAG_NOXMERGES, q); - /* * Drain all requests queued before DYING marking. Set DEAD flag to * prevent that blk_mq_run_hw_queues() accesses the hardware queues --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 998DAC07E9D for ; Mon, 26 Sep 2022 11:39:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238178AbiIZLjd (ORCPT ); Mon, 26 Sep 2022 07:39:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238128AbiIZLi2 (ORCPT ); Mon, 26 Sep 2022 07:38:28 -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 67A512607; Mon, 26 Sep 2022 03:44:32 -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 3FCEFB80930; Mon, 26 Sep 2022 10:42:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BE01C4314B; Mon, 26 Sep 2022 10:42:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188930; bh=EtrHFxWLma8xFG3uR3B2eD4nVc/vlr/KtMg12XZwn8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yifp55WoXJbYnau7a7Vrg1HeD19X584i0TZnyFzoT0QSuWODG4AXoeJBvqNq4XYs9 5+aIA66wmRH6aAM5EUi5vKJHaGaX/30763K+zdvahSxryPJU6G+quLxSJCIcu/ATh8 ypJlkclrjE4lnzcHNYVRr4JWmv8fFB6YhvO1migE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Hannes Reinecke , Jens Axboe , Sasha Levin Subject: [PATCH 5.19 019/207] block: simplify disk shutdown Date: Mon, 26 Sep 2022 12:10:08 +0200 Message-Id: <20220926100807.331946650@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christoph Hellwig [ Upstream commit 6f8191fdf41d3a53cc1d63fe2234e812c55a0092 ] Set the queue dying flag and call blk_mq_exit_queue from del_gendisk for all disks that do not have separately allocated queues, and thus remove the need to call blk_cleanup_queue for them. Rename blk_cleanup_disk to blk_mq_destroy_queue to make it clear that this function is intended only for separately allocated blk-mq queues. This saves an extra queue freeze for devices without a separately allocated queue. Signed-off-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Link: https://lore.kernel.org/r/20220619060552.1850436-6-hch@lst.de Signed-off-by: Jens Axboe Stable-dep-of: 8fe4ce5836e9 ("scsi: core: Fix a use-after-free") Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- block/blk-core.c | 37 ------------------------- block/blk-mq.c | 43 +++++++++++++++++++++++++++-- block/blk-sysfs.c | 5 ---- block/blk.h | 3 ++ block/bsg-lib.c | 4 +-- block/genhd.c | 23 ++++++++------- drivers/block/ataflop.c | 1 - drivers/block/loop.c | 1 - drivers/block/mtip32xx/mtip32xx.c | 2 -- drivers/block/rnbd/rnbd-clt.c | 2 +- drivers/block/sx8.c | 4 +-- drivers/block/virtio_blk.c | 1 - drivers/block/z2ram.c | 1 - drivers/cdrom/gdrom.c | 1 - drivers/memstick/core/ms_block.c | 1 - drivers/memstick/core/mspro_block.c | 1 - drivers/mmc/core/block.c | 1 - drivers/mmc/core/queue.c | 1 - drivers/nvme/host/apple.c | 2 +- drivers/nvme/host/core.c | 1 - drivers/nvme/host/fc.c | 12 ++++---- drivers/nvme/host/pci.c | 2 +- drivers/nvme/host/rdma.c | 12 ++++---- drivers/nvme/host/tcp.c | 12 ++++---- drivers/nvme/target/loop.c | 12 ++++---- drivers/s390/block/dasd.c | 2 +- drivers/s390/block/dasd_genhd.c | 4 +-- drivers/scsi/scsi_lib.c | 6 ++-- drivers/scsi/scsi_sysfs.c | 2 +- drivers/scsi/sd.c | 4 +-- drivers/scsi/sr.c | 4 +-- drivers/ufs/core/ufshcd.c | 4 +-- include/linux/blk-mq.h | 3 ++ include/linux/blkdev.h | 4 +-- 34 files changed, 105 insertions(+), 113 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index b8083decc07f..7743c68177e8 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -284,43 +284,6 @@ void blk_queue_start_drain(struct request_queue *q) wake_up_all(&q->mq_freeze_wq); } =20 -/** - * blk_cleanup_queue - shutdown a request queue - * @q: request queue to shutdown - * - * Mark @q DYING, drain all pending requests, mark @q DEAD, destroy and - * put it. All future requests will be failed immediately with -ENODEV. - * - * Context: can sleep - */ -void blk_cleanup_queue(struct request_queue *q) -{ - /* cannot be called from atomic context */ - might_sleep(); - - WARN_ON_ONCE(blk_queue_registered(q)); - - /* mark @q DYING, no new request or merges will be allowed afterwards */ - blk_queue_flag_set(QUEUE_FLAG_DYING, q); - blk_queue_start_drain(q); - - /* - * Drain all requests queued before DYING marking. Set DEAD flag to - * prevent that blk_mq_run_hw_queues() accesses the hardware queues - * after draining finished. - */ - blk_freeze_queue(q); - blk_sync_queue(q); - if (queue_is_mq(q)) { - blk_mq_cancel_work_sync(q); - blk_mq_exit_queue(q); - } - - /* @q is and will stay empty, shutdown and put */ - blk_put_queue(q); -} -EXPORT_SYMBOL(blk_cleanup_queue); - /** * blk_queue_enter() - try to increase q->q_usage_counter * @q: request queue pointer diff --git a/block/blk-mq.c b/block/blk-mq.c index 0a299941c622..6e22700dd6cf 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -3896,7 +3896,7 @@ static struct request_queue *blk_mq_init_queue_data(s= truct blk_mq_tag_set *set, q->queuedata =3D queuedata; ret =3D blk_mq_init_allocated_queue(set, q); if (ret) { - blk_cleanup_queue(q); + blk_put_queue(q); return ERR_PTR(ret); } return q; @@ -3908,6 +3908,35 @@ struct request_queue *blk_mq_init_queue(struct blk_m= q_tag_set *set) } EXPORT_SYMBOL(blk_mq_init_queue); =20 +/** + * blk_mq_destroy_queue - shutdown a request queue + * @q: request queue to shutdown + * + * This shuts down a request queue allocated by blk_mq_init_queue() and dr= ops + * the initial reference. All future requests will failed with -ENODEV. + * + * Context: can sleep + */ +void blk_mq_destroy_queue(struct request_queue *q) +{ + WARN_ON_ONCE(!queue_is_mq(q)); + WARN_ON_ONCE(blk_queue_registered(q)); + + might_sleep(); + + blk_queue_flag_set(QUEUE_FLAG_DYING, q); + blk_queue_start_drain(q); + blk_freeze_queue(q); + + blk_sync_queue(q); + blk_mq_cancel_work_sync(q); + blk_mq_exit_queue(q); + + /* @q is and will stay empty, shutdown and put */ + blk_put_queue(q); +} +EXPORT_SYMBOL(blk_mq_destroy_queue); + struct gendisk *__blk_mq_alloc_disk(struct blk_mq_tag_set *set, void *queu= edata, struct lock_class_key *lkclass) { @@ -3920,13 +3949,23 @@ struct gendisk *__blk_mq_alloc_disk(struct blk_mq_t= ag_set *set, void *queuedata, =20 disk =3D __alloc_disk_node(q, set->numa_node, lkclass); if (!disk) { - blk_cleanup_queue(q); + blk_put_queue(q); return ERR_PTR(-ENOMEM); } + set_bit(GD_OWNS_QUEUE, &disk->state); return disk; } EXPORT_SYMBOL(__blk_mq_alloc_disk); =20 +struct gendisk *blk_mq_alloc_disk_for_queue(struct request_queue *q, + struct lock_class_key *lkclass) +{ + if (!blk_get_queue(q)) + return NULL; + return __alloc_disk_node(q, NUMA_NO_NODE, lkclass); +} +EXPORT_SYMBOL(blk_mq_alloc_disk_for_queue); + static struct blk_mq_hw_ctx *blk_mq_alloc_and_init_hctx( struct blk_mq_tag_set *set, struct request_queue *q, int hctx_idx, int node) diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 9b905e9443e4..84d7f8701567 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -748,11 +748,6 @@ static void blk_free_queue_rcu(struct rcu_head *rcu_he= ad) * decremented with blk_put_queue(). Once the refcount reaches 0 this func= tion * is called. * - * For drivers that have a request_queue on a gendisk and added with - * __device_add_disk() the refcount to request_queue will reach 0 with - * the last put_disk() called by the driver. For drivers which don't use - * __device_add_disk() this happens with blk_cleanup_queue(). - * * Drivers exist which depend on the release of the request_queue to be * synchronous, it should not be deferred. * diff --git a/block/blk.h b/block/blk.h index 434017701403..0d6668663ab5 100644 --- a/block/blk.h +++ b/block/blk.h @@ -411,6 +411,9 @@ int bdev_resize_partition(struct gendisk *disk, int par= tno, sector_t start, sector_t length); void blk_drop_partitions(struct gendisk *disk); =20 +struct gendisk *__alloc_disk_node(struct request_queue *q, int node_id, + struct lock_class_key *lkclass); + int bio_add_hw_page(struct request_queue *q, struct bio *bio, struct page *page, unsigned int len, unsigned int offset, unsigned int max_sectors, bool *same_page); diff --git a/block/bsg-lib.c b/block/bsg-lib.c index acfe1357bf6c..fd4cd5e68282 100644 --- a/block/bsg-lib.c +++ b/block/bsg-lib.c @@ -324,7 +324,7 @@ void bsg_remove_queue(struct request_queue *q) container_of(q->tag_set, struct bsg_set, tag_set); =20 bsg_unregister_queue(bset->bd); - blk_cleanup_queue(q); + blk_mq_destroy_queue(q); blk_mq_free_tag_set(&bset->tag_set); kfree(bset); } @@ -399,7 +399,7 @@ struct request_queue *bsg_setup_queue(struct device *de= v, const char *name, =20 return q; out_cleanup_queue: - blk_cleanup_queue(q); + blk_mq_destroy_queue(q); out_queue: blk_mq_free_tag_set(set); out_tag_set: diff --git a/block/genhd.c b/block/genhd.c index 278227ba1d53..4d15f828c449 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -617,6 +617,8 @@ void del_gendisk(struct gendisk *disk) * Fail any new I/O. */ set_bit(GD_DEAD, &disk->state); + if (test_bit(GD_OWNS_QUEUE, &disk->state)) + blk_queue_flag_set(QUEUE_FLAG_DYING, q); set_capacity(disk, 0); =20 /* @@ -663,11 +665,16 @@ void del_gendisk(struct gendisk *disk) blk_mq_unquiesce_queue(q); =20 /* - * Allow using passthrough request again after the queue is torn down. + * If the disk does not own the queue, allow using passthrough requests + * again. Else leave the queue frozen to fail all I/O. */ - blk_queue_flag_clear(QUEUE_FLAG_INIT_DONE, q); - __blk_mq_unfreeze_queue(q, true); - + if (!test_bit(GD_OWNS_QUEUE, &disk->state)) { + blk_queue_flag_clear(QUEUE_FLAG_INIT_DONE, q); + __blk_mq_unfreeze_queue(q, true); + } else { + if (queue_is_mq(q)) + blk_mq_exit_queue(q); + } } EXPORT_SYMBOL(del_gendisk); =20 @@ -1338,9 +1345,6 @@ struct gendisk *__alloc_disk_node(struct request_queu= e *q, int node_id, { struct gendisk *disk; =20 - if (!blk_get_queue(q)) - return NULL; - disk =3D kzalloc_node(sizeof(struct gendisk), GFP_KERNEL, node_id); if (!disk) goto out_put_queue; @@ -1391,7 +1395,6 @@ struct gendisk *__alloc_disk_node(struct request_queu= e *q, int node_id, blk_put_queue(q); return NULL; } -EXPORT_SYMBOL(__alloc_disk_node); =20 struct gendisk *__blk_alloc_disk(int node, struct lock_class_key *lkclass) { @@ -1404,9 +1407,10 @@ struct gendisk *__blk_alloc_disk(int node, struct lo= ck_class_key *lkclass) =20 disk =3D __alloc_disk_node(q, node, lkclass); if (!disk) { - blk_cleanup_queue(q); + blk_put_queue(q); return NULL; } + set_bit(GD_OWNS_QUEUE, &disk->state); return disk; } EXPORT_SYMBOL(__blk_alloc_disk); @@ -1439,7 +1443,6 @@ EXPORT_SYMBOL(put_disk); */ void blk_cleanup_disk(struct gendisk *disk) { - blk_cleanup_queue(disk->queue); put_disk(disk); } EXPORT_SYMBOL(blk_cleanup_disk); diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c index e232cc4fd444..c6e41ee18aaa 100644 --- a/drivers/block/ataflop.c +++ b/drivers/block/ataflop.c @@ -2045,7 +2045,6 @@ static void atari_floppy_cleanup(void) if (!unit[i].disk[type]) continue; del_gendisk(unit[i].disk[type]); - blk_cleanup_queue(unit[i].disk[type]->queue); put_disk(unit[i].disk[type]); } blk_mq_free_tag_set(&unit[i].tag_set); diff --git a/drivers/block/loop.c b/drivers/block/loop.c index a59910ef948e..1c036ef686fb 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -2062,7 +2062,6 @@ static void loop_remove(struct loop_device *lo) { /* Make this loop device unreachable from pathname. */ del_gendisk(lo->lo_disk); - blk_cleanup_queue(lo->lo_disk->queue); blk_mq_free_tag_set(&lo->tag_set); =20 mutex_lock(&loop_ctl_mutex); diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mti= p32xx.c index 6699e4b2f7f4..06994a35acc7 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -3677,7 +3677,6 @@ static int mtip_block_shutdown(struct driver_data *dd) if (test_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag)) del_gendisk(dd->disk); =20 - blk_cleanup_queue(dd->queue); blk_mq_free_tag_set(&dd->tags); put_disk(dd->disk); return 0; @@ -4040,7 +4039,6 @@ static void mtip_pci_remove(struct pci_dev *pdev) dev_info(&dd->pdev->dev, "device %s surprise removal\n", dd->disk->disk_name); =20 - blk_cleanup_queue(dd->queue); blk_mq_free_tag_set(&dd->tags); =20 /* De-initialize the protocol layer. */ diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c index 409c76b81aed..a4470374f54f 100644 --- a/drivers/block/rnbd/rnbd-clt.c +++ b/drivers/block/rnbd/rnbd-clt.c @@ -1755,7 +1755,7 @@ static void rnbd_destroy_sessions(void) list_for_each_entry_safe(dev, tn, &sess->devs_list, list) { /* * Here unmap happens in parallel for only one reason: - * blk_cleanup_queue() takes around half a second, so + * del_gendisk() takes around half a second, so * on huge amount of devices the whole module unload * procedure takes minutes. */ diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c index 63b4f6431d2e..75057dbbcfbe 100644 --- a/drivers/block/sx8.c +++ b/drivers/block/sx8.c @@ -1536,7 +1536,7 @@ static int carm_init_one (struct pci_dev *pdev, const= struct pci_device_id *ent) clear_bit(0, &carm_major_alloc); else if (host->major =3D=3D 161) clear_bit(1, &carm_major_alloc); - blk_cleanup_queue(host->oob_q); + blk_mq_destroy_queue(host->oob_q); blk_mq_free_tag_set(&host->tag_set); err_out_dma_free: dma_free_coherent(&pdev->dev, CARM_SHM_SIZE, host->shm, host->shm_dma); @@ -1570,7 +1570,7 @@ static void carm_remove_one (struct pci_dev *pdev) clear_bit(0, &carm_major_alloc); else if (host->major =3D=3D 161) clear_bit(1, &carm_major_alloc); - blk_cleanup_queue(host->oob_q); + blk_mq_destroy_queue(host->oob_q); blk_mq_free_tag_set(&host->tag_set); dma_free_coherent(&pdev->dev, CARM_SHM_SIZE, host->shm, host->shm_dma); iounmap(host->mmio); diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index d756423e0059..59d6d5faf739 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -1107,7 +1107,6 @@ static void virtblk_remove(struct virtio_device *vdev) flush_work(&vblk->config_work); =20 del_gendisk(vblk->disk); - blk_cleanup_queue(vblk->disk->queue); blk_mq_free_tag_set(&vblk->tag_set); =20 mutex_lock(&vblk->vdev_mutex); diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c index 7a6ed83481b8..18ad43d9933e 100644 --- a/drivers/block/z2ram.c +++ b/drivers/block/z2ram.c @@ -384,7 +384,6 @@ static void __exit z2_exit(void) =20 for (i =3D 0; i < Z2MINOR_COUNT; i++) { del_gendisk(z2ram_gendisk[i]); - blk_cleanup_queue(z2ram_gendisk[i]->queue); put_disk(z2ram_gendisk[i]); } blk_mq_free_tag_set(&tag_set); diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c index 8e78b37d0f6a..f4cc90ea6198 100644 --- a/drivers/cdrom/gdrom.c +++ b/drivers/cdrom/gdrom.c @@ -831,7 +831,6 @@ static int probe_gdrom(struct platform_device *devptr) =20 static int remove_gdrom(struct platform_device *devptr) { - blk_cleanup_queue(gd.gdrom_rq); blk_mq_free_tag_set(&gd.tag_set); free_irq(HW_EVENT_GDROM_CMD, &gd); free_irq(HW_EVENT_GDROM_DMA, &gd); diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_bl= ock.c index f8fdf88fb240..ecbc46714e68 100644 --- a/drivers/memstick/core/ms_block.c +++ b/drivers/memstick/core/ms_block.c @@ -2188,7 +2188,6 @@ static void msb_remove(struct memstick_dev *card) =20 /* Remove the disk */ del_gendisk(msb->disk); - blk_cleanup_queue(msb->queue); blk_mq_free_tag_set(&msb->tag_set); msb->queue =3D NULL; =20 diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/ms= pro_block.c index 725ba74ded30..72e91c06c618 100644 --- a/drivers/memstick/core/mspro_block.c +++ b/drivers/memstick/core/mspro_block.c @@ -1294,7 +1294,6 @@ static void mspro_block_remove(struct memstick_dev *c= ard) del_gendisk(msb->disk); dev_dbg(&card->dev, "mspro block remove\n"); =20 - blk_cleanup_queue(msb->queue); blk_mq_free_tag_set(&msb->tag_set); msb->queue =3D NULL; =20 diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 912a398a9a76..2f89ae55c177 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -2509,7 +2509,6 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct = mmc_card *card, return md; =20 err_cleanup_queue: - blk_cleanup_queue(md->disk->queue); blk_mq_free_tag_set(&md->queue.tag_set); err_kfree: kfree(md); diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c index fa5324ceeebe..f824cfdab75a 100644 --- a/drivers/mmc/core/queue.c +++ b/drivers/mmc/core/queue.c @@ -494,7 +494,6 @@ void mmc_cleanup_queue(struct mmc_queue *mq) if (blk_queue_quiesced(q)) blk_mq_unquiesce_queue(q); =20 - blk_cleanup_queue(q); blk_mq_free_tag_set(&mq->tag_set); =20 /* diff --git a/drivers/nvme/host/apple.c b/drivers/nvme/host/apple.c index d702d7d60235..2d23b7d41f7e 100644 --- a/drivers/nvme/host/apple.c +++ b/drivers/nvme/host/apple.c @@ -1502,7 +1502,7 @@ static int apple_nvme_probe(struct platform_device *p= dev) =20 if (!blk_get_queue(anv->ctrl.admin_q)) { nvme_start_admin_queue(&anv->ctrl); - blk_cleanup_queue(anv->ctrl.admin_q); + blk_mq_destroy_queue(anv->ctrl.admin_q); anv->ctrl.admin_q =3D NULL; ret =3D -ENODEV; goto put_dev; diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 2f965356f345..6d76fc608b74 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -4105,7 +4105,6 @@ static void nvme_ns_remove(struct nvme_ns *ns) if (!nvme_ns_head_multipath(ns->head)) nvme_cdev_del(&ns->cdev, &ns->cdev_device); del_gendisk(ns->disk); - blk_cleanup_queue(ns->queue); =20 down_write(&ns->ctrl->namespaces_rwsem); list_del_init(&ns->list); diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 4aff83b1b0c0..9a5ce70d7f21 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -2392,7 +2392,7 @@ nvme_fc_ctrl_free(struct kref *ref) unsigned long flags; =20 if (ctrl->ctrl.tagset) { - blk_cleanup_queue(ctrl->ctrl.connect_q); + blk_mq_destroy_queue(ctrl->ctrl.connect_q); blk_mq_free_tag_set(&ctrl->tag_set); } =20 @@ -2402,8 +2402,8 @@ nvme_fc_ctrl_free(struct kref *ref) spin_unlock_irqrestore(&ctrl->rport->lock, flags); =20 nvme_start_admin_queue(&ctrl->ctrl); - blk_cleanup_queue(ctrl->ctrl.admin_q); - blk_cleanup_queue(ctrl->ctrl.fabrics_q); + blk_mq_destroy_queue(ctrl->ctrl.admin_q); + blk_mq_destroy_queue(ctrl->ctrl.fabrics_q); blk_mq_free_tag_set(&ctrl->admin_tag_set); =20 kfree(ctrl->queues); @@ -2953,7 +2953,7 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl) out_delete_hw_queues: nvme_fc_delete_hw_io_queues(ctrl); out_cleanup_blk_queue: - blk_cleanup_queue(ctrl->ctrl.connect_q); + blk_mq_destroy_queue(ctrl->ctrl.connect_q); out_free_tag_set: blk_mq_free_tag_set(&ctrl->tag_set); nvme_fc_free_io_queues(ctrl); @@ -3642,9 +3642,9 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctr= l_options *opts, return ERR_PTR(-EIO); =20 out_cleanup_admin_q: - blk_cleanup_queue(ctrl->ctrl.admin_q); + blk_mq_destroy_queue(ctrl->ctrl.admin_q); out_cleanup_fabrics_q: - blk_cleanup_queue(ctrl->ctrl.fabrics_q); + blk_mq_destroy_queue(ctrl->ctrl.fabrics_q); out_free_admin_tag_set: blk_mq_free_tag_set(&ctrl->admin_tag_set); out_free_queues: diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 9f6614f7dbeb..3516678d3754 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -1760,7 +1760,7 @@ static void nvme_dev_remove_admin(struct nvme_dev *de= v) * queue to flush these to completion. */ nvme_start_admin_queue(&dev->ctrl); - blk_cleanup_queue(dev->ctrl.admin_q); + blk_mq_destroy_queue(dev->ctrl.admin_q); blk_mq_free_tag_set(&dev->admin_tagset); } } diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 46c2dcf72f7e..240024dd5d85 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -840,8 +840,8 @@ static void nvme_rdma_destroy_admin_queue(struct nvme_r= dma_ctrl *ctrl, bool remove) { if (remove) { - blk_cleanup_queue(ctrl->ctrl.admin_q); - blk_cleanup_queue(ctrl->ctrl.fabrics_q); + blk_mq_destroy_queue(ctrl->ctrl.admin_q); + blk_mq_destroy_queue(ctrl->ctrl.fabrics_q); blk_mq_free_tag_set(ctrl->ctrl.admin_tagset); } if (ctrl->async_event_sqe.data) { @@ -935,10 +935,10 @@ static int nvme_rdma_configure_admin_queue(struct nvm= e_rdma_ctrl *ctrl, nvme_cancel_admin_tagset(&ctrl->ctrl); out_cleanup_queue: if (new) - blk_cleanup_queue(ctrl->ctrl.admin_q); + blk_mq_destroy_queue(ctrl->ctrl.admin_q); out_cleanup_fabrics_q: if (new) - blk_cleanup_queue(ctrl->ctrl.fabrics_q); + blk_mq_destroy_queue(ctrl->ctrl.fabrics_q); out_free_tagset: if (new) blk_mq_free_tag_set(ctrl->ctrl.admin_tagset); @@ -957,7 +957,7 @@ static void nvme_rdma_destroy_io_queues(struct nvme_rdm= a_ctrl *ctrl, bool remove) { if (remove) { - blk_cleanup_queue(ctrl->ctrl.connect_q); + blk_mq_destroy_queue(ctrl->ctrl.connect_q); blk_mq_free_tag_set(ctrl->ctrl.tagset); } nvme_rdma_free_io_queues(ctrl); @@ -1012,7 +1012,7 @@ static int nvme_rdma_configure_io_queues(struct nvme_= rdma_ctrl *ctrl, bool new) out_cleanup_connect_q: nvme_cancel_tagset(&ctrl->ctrl); if (new) - blk_cleanup_queue(ctrl->ctrl.connect_q); + blk_mq_destroy_queue(ctrl->ctrl.connect_q); out_free_tag_set: if (new) blk_mq_free_tag_set(ctrl->ctrl.tagset); diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index daa0e160e121..d7e5bbdb9b75 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -1881,7 +1881,7 @@ static void nvme_tcp_destroy_io_queues(struct nvme_ct= rl *ctrl, bool remove) { nvme_tcp_stop_io_queues(ctrl); if (remove) { - blk_cleanup_queue(ctrl->connect_q); + blk_mq_destroy_queue(ctrl->connect_q); blk_mq_free_tag_set(ctrl->tagset); } nvme_tcp_free_io_queues(ctrl); @@ -1936,7 +1936,7 @@ static int nvme_tcp_configure_io_queues(struct nvme_c= trl *ctrl, bool new) out_cleanup_connect_q: nvme_cancel_tagset(ctrl); if (new) - blk_cleanup_queue(ctrl->connect_q); + blk_mq_destroy_queue(ctrl->connect_q); out_free_tag_set: if (new) blk_mq_free_tag_set(ctrl->tagset); @@ -1949,8 +1949,8 @@ static void nvme_tcp_destroy_admin_queue(struct nvme_= ctrl *ctrl, bool remove) { nvme_tcp_stop_queue(ctrl, 0); if (remove) { - blk_cleanup_queue(ctrl->admin_q); - blk_cleanup_queue(ctrl->fabrics_q); + blk_mq_destroy_queue(ctrl->admin_q); + blk_mq_destroy_queue(ctrl->fabrics_q); blk_mq_free_tag_set(ctrl->admin_tagset); } nvme_tcp_free_admin_queue(ctrl); @@ -2008,10 +2008,10 @@ static int nvme_tcp_configure_admin_queue(struct nv= me_ctrl *ctrl, bool new) nvme_cancel_admin_tagset(ctrl); out_cleanup_queue: if (new) - blk_cleanup_queue(ctrl->admin_q); + blk_mq_destroy_queue(ctrl->admin_q); out_cleanup_fabrics_q: if (new) - blk_cleanup_queue(ctrl->fabrics_q); + blk_mq_destroy_queue(ctrl->fabrics_q); out_free_tagset: if (new) blk_mq_free_tag_set(ctrl->admin_tagset); diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c index 59024af2da2e..0f5c77e22a0a 100644 --- a/drivers/nvme/target/loop.c +++ b/drivers/nvme/target/loop.c @@ -266,8 +266,8 @@ static void nvme_loop_destroy_admin_queue(struct nvme_l= oop_ctrl *ctrl) if (!test_and_clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags)) return; nvmet_sq_destroy(&ctrl->queues[0].nvme_sq); - blk_cleanup_queue(ctrl->ctrl.admin_q); - blk_cleanup_queue(ctrl->ctrl.fabrics_q); + blk_mq_destroy_queue(ctrl->ctrl.admin_q); + blk_mq_destroy_queue(ctrl->ctrl.fabrics_q); blk_mq_free_tag_set(&ctrl->admin_tag_set); } =20 @@ -283,7 +283,7 @@ static void nvme_loop_free_ctrl(struct nvme_ctrl *nctrl) mutex_unlock(&nvme_loop_ctrl_mutex); =20 if (nctrl->tagset) { - blk_cleanup_queue(ctrl->ctrl.connect_q); + blk_mq_destroy_queue(ctrl->ctrl.connect_q); blk_mq_free_tag_set(&ctrl->tag_set); } kfree(ctrl->queues); @@ -410,9 +410,9 @@ static int nvme_loop_configure_admin_queue(struct nvme_= loop_ctrl *ctrl) =20 out_cleanup_queue: clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags); - blk_cleanup_queue(ctrl->ctrl.admin_q); + blk_mq_destroy_queue(ctrl->ctrl.admin_q); out_cleanup_fabrics_q: - blk_cleanup_queue(ctrl->ctrl.fabrics_q); + blk_mq_destroy_queue(ctrl->ctrl.fabrics_q); out_free_tagset: blk_mq_free_tag_set(&ctrl->admin_tag_set); out_free_sq: @@ -554,7 +554,7 @@ static int nvme_loop_create_io_queues(struct nvme_loop_= ctrl *ctrl) return 0; =20 out_cleanup_connect_q: - blk_cleanup_queue(ctrl->ctrl.connect_q); + blk_mq_destroy_queue(ctrl->ctrl.connect_q); out_free_tagset: blk_mq_free_tag_set(&ctrl->tag_set); out_destroy_queues: diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index ba6d78789660..e8489331f12b 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c @@ -3280,7 +3280,7 @@ static int dasd_alloc_queue(struct dasd_block *block) static void dasd_free_queue(struct dasd_block *block) { if (block->request_queue) { - blk_cleanup_queue(block->request_queue); + blk_mq_destroy_queue(block->request_queue); blk_mq_free_tag_set(&block->tag_set); block->request_queue =3D NULL; } diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genh= d.c index a7a33ebf4bbe..5a83f0a39901 100644 --- a/drivers/s390/block/dasd_genhd.c +++ b/drivers/s390/block/dasd_genhd.c @@ -41,8 +41,8 @@ int dasd_gendisk_alloc(struct dasd_block *block) if (base->devindex >=3D DASD_PER_MAJOR) return -EBUSY; =20 - gdp =3D __alloc_disk_node(block->request_queue, NUMA_NO_NODE, - &dasd_bio_compl_lkclass); + gdp =3D blk_mq_alloc_disk_for_queue(block->request_queue, + &dasd_bio_compl_lkclass); if (!gdp) return -ENOMEM; =20 diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index f5c876d03c1a..0a267d6e2f7c 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -168,7 +168,7 @@ static void __scsi_queue_insert(struct scsi_cmnd *cmd, = int reason, bool unbusy) * Requeue this command. It will go before all other commands * that are already in the queue. Schedule requeue work under * lock such that the kblockd_schedule_work() call happens - * before blk_cleanup_queue() finishes. + * before blk_mq_destroy_queue() finishes. */ cmd->result =3D 0; =20 @@ -429,9 +429,9 @@ static void scsi_starved_list_run(struct Scsi_Host *sho= st) * it and the queue. Mitigate by taking a reference to the * queue and never touching the sdev again after we drop the * host lock. Note: if __scsi_remove_device() invokes - * blk_cleanup_queue() before the queue is run from this + * blk_mq_destroy_queue() before the queue is run from this * function then blk_run_queue() will return immediately since - * blk_cleanup_queue() marks the queue with QUEUE_FLAG_DYING. + * blk_mq_destroy_queue() marks the queue with QUEUE_FLAG_DYING. */ slq =3D sdev->request_queue; if (!blk_get_queue(slq)) diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 43949798a2e4..aa70d9282161 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -1475,7 +1475,7 @@ void __scsi_remove_device(struct scsi_device *sdev) scsi_device_set_state(sdev, SDEV_DEL); mutex_unlock(&sdev->state_mutex); =20 - blk_cleanup_queue(sdev->request_queue); + blk_mq_destroy_queue(sdev->request_queue); cancel_work_sync(&sdev->requeue_work); =20 if (sdev->host->hostt->slave_destroy) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index a1a2ac09066f..cb587e488601 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3440,8 +3440,8 @@ static int sd_probe(struct device *dev) if (!sdkp) goto out; =20 - gd =3D __alloc_disk_node(sdp->request_queue, NUMA_NO_NODE, - &sd_bio_compl_lkclass); + gd =3D blk_mq_alloc_disk_for_queue(sdp->request_queue, + &sd_bio_compl_lkclass); if (!gd) goto out_free; =20 diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 32d3b8274f14..a278b739d0c5 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -624,8 +624,8 @@ static int sr_probe(struct device *dev) if (!cd) goto fail; =20 - disk =3D __alloc_disk_node(sdev->request_queue, NUMA_NO_NODE, - &sr_bio_compl_lkclass); + disk =3D blk_mq_alloc_disk_for_queue(sdev->request_queue, + &sr_bio_compl_lkclass); if (!disk) goto fail_free; mutex_init(&cd->lock); diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 829da9cb14a8..55bb0d0422d5 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -9519,7 +9519,7 @@ void ufshcd_remove(struct ufs_hba *hba) ufs_bsg_remove(hba); ufshpb_remove(hba); ufs_sysfs_remove_nodes(hba->dev); - blk_cleanup_queue(hba->tmf_queue); + blk_mq_destroy_queue(hba->tmf_queue); blk_mq_free_tag_set(&hba->tmf_tag_set); scsi_remove_host(hba->host); /* disable interrupts */ @@ -9815,7 +9815,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mm= io_base, unsigned int irq) return 0; =20 free_tmf_queue: - blk_cleanup_queue(hba->tmf_queue); + blk_mq_destroy_queue(hba->tmf_queue); free_tmf_tag_set: blk_mq_free_tag_set(&hba->tmf_tag_set); out_remove_scsi_host: diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index e2d9daf7e8dd..0fd96e92c6c6 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -686,10 +686,13 @@ struct gendisk *__blk_mq_alloc_disk(struct blk_mq_tag= _set *set, void *queuedata, \ __blk_mq_alloc_disk(set, queuedata, &__key); \ }) +struct gendisk *blk_mq_alloc_disk_for_queue(struct request_queue *q, + struct lock_class_key *lkclass); struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *); int blk_mq_init_allocated_queue(struct blk_mq_tag_set *set, struct request_queue *q); void blk_mq_unregister_dev(struct device *, struct request_queue *); +void blk_mq_destroy_queue(struct request_queue *); =20 int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set); int blk_mq_alloc_sq_tag_set(struct blk_mq_tag_set *set, diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 76f77eed58c3..83eb8869a8c9 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -148,6 +148,7 @@ struct gendisk { #define GD_NATIVE_CAPACITY 3 #define GD_ADDED 4 #define GD_SUPPRESS_PART_SCAN 5 +#define GD_OWNS_QUEUE 6 =20 struct mutex open_mutex; /* open/close mutex */ unsigned open_partitions; /* number of open partitions */ @@ -810,8 +811,6 @@ static inline u64 sb_bdev_nr_blocks(struct super_block = *sb) =20 int bdev_disk_changed(struct gendisk *disk, bool invalidate); =20 -struct gendisk *__alloc_disk_node(struct request_queue *q, int node_id, - struct lock_class_key *lkclass); void put_disk(struct gendisk *disk); struct gendisk *__blk_alloc_disk(int node, struct lock_class_key *lkclass); =20 @@ -953,7 +952,6 @@ static inline unsigned int blk_max_size_offset(struct r= equest_queue *q, /* * Access functions for manipulating queue properties */ -extern void blk_cleanup_queue(struct request_queue *); void blk_queue_bounce_limit(struct request_queue *q, enum blk_bounce limit= ); extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int); extern void blk_queue_chunk_sectors(struct request_queue *, unsigned int); --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B942C07E9D for ; Mon, 26 Sep 2022 11:39:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238168AbiIZLj3 (ORCPT ); Mon, 26 Sep 2022 07:39:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233417AbiIZLiK (ORCPT ); Mon, 26 Sep 2022 07:38:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09EFB2FFED; Mon, 26 Sep 2022 03:44:25 -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 29436B80942; Mon, 26 Sep 2022 10:42:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AF77C433C1; Mon, 26 Sep 2022 10:42:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188936; bh=8qGXLMvWUTjEVTmM/cfRPaf8rj4RUemQlqnquuptqzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h5pfV6HDbRSs6ep937s8gDN51yh0kxBUS0Bf9/RKI4e8CgbTxF5QKoHEq/F/SwTuu xA+GHfrQw2VPr1d9FzkM3NaH3x4f692q+nVGrfPV0Ug2ybmZ42veYCILZanHFPJtvo lKSNvYm2/soJcKMfuKQ8jdwZDxEUDL8X3/mRcKRI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Lei , Christoph Hellwig , Mike Christie , Hannes Reinecke , John Garry , Li Zhijian , Bart Van Assche , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 020/207] scsi: core: Fix a use-after-free Date: Mon, 26 Sep 2022 12:10:09 +0200 Message-Id: <20220926100807.381304572@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bart Van Assche [ Upstream commit 8fe4ce5836e932f5766317cb651c1ff2a4cd0506 ] There are two .exit_cmd_priv implementations. Both implementations use resources associated with the SCSI host. Make sure that these resources are still available when .exit_cmd_priv is called by waiting inside scsi_remove_host() until the tag set has been freed. This commit fixes the following use-after-free: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D BUG: KASAN: use-after-free in srp_exit_cmd_priv+0x27/0xd0 [ib_srp] Read of size 8 at addr ffff888100337000 by task multipathd/16727 Call Trace: dump_stack_lvl+0x34/0x44 print_report.cold+0x5e/0x5db kasan_report+0xab/0x120 srp_exit_cmd_priv+0x27/0xd0 [ib_srp] scsi_mq_exit_request+0x4d/0x70 blk_mq_free_rqs+0x143/0x410 __blk_mq_free_map_and_rqs+0x6e/0x100 blk_mq_free_tag_set+0x2b/0x160 scsi_host_dev_release+0xf3/0x1a0 device_release+0x54/0xe0 kobject_put+0xa5/0x120 device_release+0x54/0xe0 kobject_put+0xa5/0x120 scsi_device_dev_release_usercontext+0x4c1/0x4e0 execute_in_process_context+0x23/0x90 device_release+0x54/0xe0 kobject_put+0xa5/0x120 scsi_disk_release+0x3f/0x50 device_release+0x54/0xe0 kobject_put+0xa5/0x120 disk_release+0x17f/0x1b0 device_release+0x54/0xe0 kobject_put+0xa5/0x120 dm_put_table_device+0xa3/0x160 [dm_mod] dm_put_device+0xd0/0x140 [dm_mod] free_priority_group+0xd8/0x110 [dm_multipath] free_multipath+0x94/0xe0 [dm_multipath] dm_table_destroy+0xa2/0x1e0 [dm_mod] __dm_destroy+0x196/0x350 [dm_mod] dev_remove+0x10c/0x160 [dm_mod] ctl_ioctl+0x2c2/0x590 [dm_mod] dm_ctl_ioctl+0x5/0x10 [dm_mod] __x64_sys_ioctl+0xb4/0xf0 dm_ctl_ioctl+0x5/0x10 [dm_mod] __x64_sys_ioctl+0xb4/0xf0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Link: https://lore.kernel.org/r/20220826002635.919423-1-bvanassche@acm.org Fixes: 65ca846a5314 ("scsi: core: Introduce {init,exit}_cmd_priv()") Cc: Ming Lei Cc: Christoph Hellwig Cc: Mike Christie Cc: Hannes Reinecke Cc: John Garry Cc: Li Zhijian Reported-by: Li Zhijian Tested-by: Li Zhijian Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/scsi/hosts.c | 16 +++++++++++++--- drivers/scsi/scsi_lib.c | 6 +++++- drivers/scsi/scsi_priv.h | 2 +- drivers/scsi/scsi_scan.c | 1 + drivers/scsi/scsi_sysfs.c | 1 + include/scsi/scsi_host.h | 2 ++ 6 files changed, 23 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 8352f90d997d..ae9a107c520d 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -182,6 +182,15 @@ void scsi_remove_host(struct Scsi_Host *shost) mutex_unlock(&shost->scan_mutex); scsi_proc_host_rm(shost); =20 + /* + * New SCSI devices cannot be attached anymore because of the SCSI host + * state so drop the tag set refcnt. Wait until the tag set refcnt drops + * to zero because .exit_cmd_priv implementations may need the host + * pointer. + */ + kref_put(&shost->tagset_refcnt, scsi_mq_free_tags); + wait_for_completion(&shost->tagset_freed); + spin_lock_irqsave(shost->host_lock, flags); if (scsi_host_set_state(shost, SHOST_DEL)) BUG_ON(scsi_host_set_state(shost, SHOST_DEL_RECOVERY)); @@ -240,6 +249,9 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, str= uct device *dev, if (error) goto fail; =20 + kref_init(&shost->tagset_refcnt); + init_completion(&shost->tagset_freed); + /* * Increase usage count temporarily here so that calling * scsi_autopm_put_host() will trigger runtime idle if there is @@ -312,6 +324,7 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, str= uct device *dev, pm_runtime_disable(&shost->shost_gendev); pm_runtime_set_suspended(&shost->shost_gendev); pm_runtime_put_noidle(&shost->shost_gendev); + kref_put(&shost->tagset_refcnt, scsi_mq_free_tags); fail: return error; } @@ -345,9 +358,6 @@ static void scsi_host_dev_release(struct device *dev) kfree(dev_name(&shost->shost_dev)); } =20 - if (shost->tag_set.tags) - scsi_mq_destroy_tags(shost); - kfree(shost->shost_data); =20 ida_simple_remove(&host_index_ida, shost->host_no); diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 0a267d6e2f7c..7e990f7a9f16 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1995,9 +1995,13 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost) return blk_mq_alloc_tag_set(tag_set); } =20 -void scsi_mq_destroy_tags(struct Scsi_Host *shost) +void scsi_mq_free_tags(struct kref *kref) { + struct Scsi_Host *shost =3D container_of(kref, typeof(*shost), + tagset_refcnt); + blk_mq_free_tag_set(&shost->tag_set); + complete(&shost->tagset_freed); } =20 /** diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h index 5c4786310a31..a0ee31d55f5f 100644 --- a/drivers/scsi/scsi_priv.h +++ b/drivers/scsi/scsi_priv.h @@ -94,7 +94,7 @@ extern void scsi_run_host_queues(struct Scsi_Host *shost); extern void scsi_requeue_run_queue(struct work_struct *work); extern void scsi_start_queue(struct scsi_device *sdev); extern int scsi_mq_setup_tags(struct Scsi_Host *shost); -extern void scsi_mq_destroy_tags(struct Scsi_Host *shost); +extern void scsi_mq_free_tags(struct kref *kref); extern void scsi_exit_queue(void); extern void scsi_evt_thread(struct work_struct *work); =20 diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 91ac901a6682..5d27f5196de6 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -340,6 +340,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_= target *starget, kfree(sdev); goto out; } + kref_get(&sdev->host->tagset_refcnt); sdev->request_queue =3D q; q->queuedata =3D sdev; __scsi_init_queue(sdev->host, q); diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index aa70d9282161..5d61f58399dc 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -1476,6 +1476,7 @@ void __scsi_remove_device(struct scsi_device *sdev) mutex_unlock(&sdev->state_mutex); =20 blk_mq_destroy_queue(sdev->request_queue); + kref_put(&sdev->host->tagset_refcnt, scsi_mq_free_tags); cancel_work_sync(&sdev->requeue_work); =20 if (sdev->host->hostt->slave_destroy) diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 667d889b92b5..3e1cea155049 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -557,6 +557,8 @@ struct Scsi_Host { struct scsi_host_template *hostt; struct scsi_transport_template *transportt; =20 + struct kref tagset_refcnt; + struct completion tagset_freed; /* Area to keep a shared tag map */ struct blk_mq_tag_set tag_set; =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB7D0C07E9D for ; Mon, 26 Sep 2022 11:39:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238141AbiIZLjX (ORCPT ); Mon, 26 Sep 2022 07:39:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238166AbiIZLhz (ORCPT ); Mon, 26 Sep 2022 07:37:55 -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 096476EF1E; Mon, 26 Sep 2022 03:44:15 -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 A46DB60A36; Mon, 26 Sep 2022 10:42:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D444C433D6; Mon, 26 Sep 2022 10:42:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188940; bh=mXgQHzzbXk8scCA00EwPq4JkzV+JHFrkwHS/AwZf3bA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=voVb0GUgrFWRAaAZYimRjYLNyaLa4x3nJarP/VFWOG5wD1g0mnPNzL8QICKFWKclS c26zGfPk3xTkAgkc5gUrAUjc1so/fxW2TeK77pkd2RmrIC5ZV8W7VSPFsw3u5f18Ul 8x25iLXGpI/8FORe1fZb4/LuhGmgp+mfNAnrtSkw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" , Yury Norov , feng xiangjun , Phil Auld Subject: [PATCH 5.19 021/207] drivers/base: Fix unsigned comparison to -1 in CPUMAP_FILE_MAX_BYTES Date: Mon, 26 Sep 2022 12:10:10 +0200 Message-Id: <20220926100807.421848068@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Phil Auld commit d7f06bdd6ee87fbefa05af5f57361d85e7715b11 upstream. As PAGE_SIZE is unsigned long, -1 > PAGE_SIZE when NR_CPUS <=3D 3. This leads to very large file sizes: topology$ ls -l total 0 -r--r--r-- 1 root root 18446744073709551615 Sep 5 11:59 core_cpus -r--r--r-- 1 root root 4096 Sep 5 11:59 core_cpus_list -r--r--r-- 1 root root 4096 Sep 5 10:58 core_id -r--r--r-- 1 root root 18446744073709551615 Sep 5 10:10 core_siblings -r--r--r-- 1 root root 4096 Sep 5 11:59 core_siblings_list -r--r--r-- 1 root root 18446744073709551615 Sep 5 11:59 die_cpus -r--r--r-- 1 root root 4096 Sep 5 11:59 die_cpus_list -r--r--r-- 1 root root 4096 Sep 5 11:59 die_id -r--r--r-- 1 root root 18446744073709551615 Sep 5 11:59 package_cpus -r--r--r-- 1 root root 4096 Sep 5 11:59 package_cpus_list -r--r--r-- 1 root root 4096 Sep 5 10:58 physical_package_id -r--r--r-- 1 root root 18446744073709551615 Sep 5 10:10 thread_siblings -r--r--r-- 1 root root 4096 Sep 5 11:59 thread_siblings_li= st Adjust the inequality to catch the case when NR_CPUS is configured to a small value. Fixes: 7ee951acd31a ("drivers/base: fix userspace break from using bin_attr= ibutes for cpumap and cpulist") Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Yury Norov Cc: stable@vger.kernel.org Cc: feng xiangjun Reported-by: feng xiangjun Signed-off-by: Phil Auld Signed-off-by: Yury Norov Link: https://lore.kernel.org/r/20220906203542.1796629-1-pauld@redhat.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- include/linux/cpumask.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -1083,9 +1083,10 @@ cpumap_print_list_to_buf(char *buf, cons * cover a worst-case of every other cpu being on one of two nodes for a * very large NR_CPUS. * - * Use PAGE_SIZE as a minimum for smaller configurations. + * Use PAGE_SIZE as a minimum for smaller configurations while avoiding + * unsigned comparison to -1. */ -#define CPUMAP_FILE_MAX_BYTES ((((NR_CPUS * 9)/32 - 1) > PAGE_SIZE) \ +#define CPUMAP_FILE_MAX_BYTES (((NR_CPUS * 9)/32 > PAGE_SIZE) \ ? (NR_CPUS * 9)/32 - 1 : PAGE_SIZE) #define CPULIST_FILE_MAX_BYTES (((NR_CPUS * 7)/2 > PAGE_SIZE) ? (NR_CPUS = * 7)/2 : PAGE_SIZE) From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C6E4C07E9D for ; Mon, 26 Sep 2022 11:32:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235017AbiIZLcJ (ORCPT ); Mon, 26 Sep 2022 07:32:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233578AbiIZLb1 (ORCPT ); Mon, 26 Sep 2022 07:31:27 -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 039356CF6D; Mon, 26 Sep 2022 03:42: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 734AFB80760; Mon, 26 Sep 2022 10:42:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7418C433D6; Mon, 26 Sep 2022 10:42:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188943; bh=eaaHNBE6K/7q1W3ZF1vhSRG5mT9ySuUriyXoVAHOO0o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uGn26rpU6DXzd2dRoOd0f5g6XvgTT0IBBYdJPia1Upvu6tW0PIAkpJjNTKwCQYW4E UfViyhtRqa1jYAU7BMXNc4og1bDr/m96swWxTJwTW+P1+A7TkA+8ASimf+a8YBGTIi BoBMai+613ahYdOJ6peiezyErlEswhfpozlbSZXk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Rothwell , Bagas Sanjaya , Alan Stern Subject: [PATCH 5.19 022/207] USB: core: Fix RST error in hub.c Date: Mon, 26 Sep 2022 12:10:11 +0200 Message-Id: <20220926100807.473475716@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alan Stern commit 766a96dc558385be735a370db867e302c8f22153 upstream. A recent commit added an invalid RST expression to a kerneldoc comment in hub.c. The fix is trivial. Fixes: 9c6d778800b9 ("USB: core: Prevent nested device-reset calls") Cc: Reported-by: Stephen Rothwell Reviewed-by: Bagas Sanjaya Signed-off-by: Alan Stern Link: https://lore.kernel.org/r/YxDDcsLtRZ7c20pq@rowland.harvard.edu Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/usb/core/hub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -6049,7 +6049,7 @@ re_enumerate: * * Return: The same as for usb_reset_and_verify_device(). * However, if a reset is already in progress (for instance, if a - * driver doesn't have pre_ or post_reset() callbacks, and while + * driver doesn't have pre_reset() or post_reset() callbacks, and while * being unbound or re-bound during the ongoing reset its disconnect() * or probe() routine tries to perform a second, nested reset), the * routine returns -EINPROGRESS. From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8ED6C32771 for ; Mon, 26 Sep 2022 11:40:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238211AbiIZLj4 (ORCPT ); Mon, 26 Sep 2022 07:39:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238240AbiIZLik (ORCPT ); Mon, 26 Sep 2022 07:38:40 -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 EEF02260B; Mon, 26 Sep 2022 03:44:37 -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 8D82D60A37; Mon, 26 Sep 2022 10:42:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E5C5C433C1; Mon, 26 Sep 2022 10:42:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188946; bh=4dbwDwZ0eBnfjVz2XPlQVhmi10ewahaSZNSGTnSir1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ehpVOwxKmA4kZWiBYysLVvNo0/tbusDaK33yKa71wO7eMaFoB99R3izYgk6eldU29 Hy4wUnY22oIVUCtE+yj1SNsUZskVbAiyFFLNhQAw8KlcODFhasL51TzmJPSyFIpwzT e/3a9n4HzoXvow3ty1pZOhQvlvjNooNc58XUflGc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Carl Yin , Johan Hovold Subject: [PATCH 5.19 023/207] USB: serial: option: add Quectel BG95 0x0203 composition Date: Mon, 26 Sep 2022 12:10:12 +0200 Message-Id: <20220926100807.512498693@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Carl Yin(=E6=AE=B7=E5=BC=A0=E6=88=90) commit f8f67eff6847f9b8d753fa029723bcc54296055a upstream. Add support for the following Quectel BG95 composition: 0x0203: Diag + GNSS + Modem + ECM usb-devices output: T: Bus=3D01 Lev=3D01 Prnt=3D01 Port=3D03 Cnt=3D01 Dev#=3D 2 Spd=3D480 Mx= Ch=3D 0 D: Ver=3D 2.00 Cls=3Def(misc ) Sub=3D02 Prot=3D01 MxPS=3D64 #Cfgs=3D 1 P: Vendor=3D2c7c ProdID=3D0203 Rev=3D 0.00 S: Manufacturer=3DQuectel, Incorporated S: Product=3DQuectel LPWA Module S: SerialNumber=3D71d3a21b C:* #Ifs=3D 5 Cfg#=3D 1 Atr=3De0 MxPwr=3D500mA A: FirstIf#=3D 3 IfCount=3D 2 Cls=3D02(comm.) Sub=3D00 Prot=3D00 I:* If#=3D 0 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3D30 Driver= =3Doption E: Ad=3D81(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D01(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 1 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3D60 Driver= =3Doption E: Ad=3D82(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D02(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 2 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Doption E: Ad=3D83(I) Atr=3D03(Int.) MxPS=3D 64 Ivl=3D2ms E: Ad=3D84(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D03(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 3 Alt=3D 0 #EPs=3D 1 Cls=3D02(comm.) Sub=3D06 Prot=3D00 Driver= =3Dcdc_ether E: Ad=3D85(I) Atr=3D03(Int.) MxPS=3D 64 Ivl=3D2ms I: If#=3D 4 Alt=3D 0 #EPs=3D 0 Cls=3D0a(data ) Sub=3D00 Prot=3D00 Driver= =3Dcdc_ether I:* If#=3D 4 Alt=3D 1 #EPs=3D 2 Cls=3D0a(data ) Sub=3D00 Prot=3D00 Driver= =3Dcdc_ether E: Ad=3D86(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D04(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms Signed-off-by: Carl Yin Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -1138,6 +1138,8 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, = 0xff, 0xff, 0xff), .driver_info =3D NUMEP2 }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, = 0xff, 0, 0) }, + { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, 0x0203, 0xff), /* BG95-M3= */ + .driver_info =3D ZLP }, { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), .driver_info =3D RSVD(4) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, = 0xff, 0xff, 0xff), From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD048C07E9D for ; Mon, 26 Sep 2022 11:32:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234968AbiIZLcM (ORCPT ); Mon, 26 Sep 2022 07:32:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237944AbiIZLbi (ORCPT ); Mon, 26 Sep 2022 07:31:38 -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 E7FF76CF79; Mon, 26 Sep 2022 03:42: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 dfw.source.kernel.org (Postfix) with ESMTPS id 9DFD260B7E; Mon, 26 Sep 2022 10:42:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 905A1C433D6; Mon, 26 Sep 2022 10:42:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188949; bh=OnHJPjH4h6Nbsq01JGvqFhs1so7/TP+GxApbv3kVy+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R8Uq2bKkh+JmhehvxMqFCDW1FXB74Sec0S8o49wXPfvXzlLVrtqw0ckfrOQ01cuz9 qEmX1OXDUZFH8Yw3X7yKYeHf869ksqrsxD3sz2WAO7GEds528E5VrCEtORCyB+iKSg CAFzoCsqvcDhxVDli2QEPYjUDpbAFYu0JD+W+Ock= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, jerry meng , Johan Hovold Subject: [PATCH 5.19 024/207] USB: serial: option: add Quectel RM520N Date: Mon, 26 Sep 2022 12:10:13 +0200 Message-Id: <20220926100807.550314236@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: jerry meng commit d640c4cb8f2f933c0ca896541f9de7fb1ae245f4 upstream. add support for Quectel RM520N which is based on Qualcomm SDX62 chip. 0x0801: DIAG + NMEA + AT + MODEM + RMNET T: Bus=3D03 Lev=3D01 Prnt=3D01 Port=3D01 Cnt=3D02 Dev#=3D 10 Spd=3D480 Mx= Ch=3D 0 D: Ver=3D 2.10 Cls=3D00(>ifc ) Sub=3D00 Prot=3D00 MxPS=3D64 #Cfgs=3D 1 P: Vendor=3D2c7c ProdID=3D0801 Rev=3D 5.04 S: Manufacturer=3DQuectel S: Product=3DRM520N-GL S: SerialNumber=3D384af524 C:* #Ifs=3D 5 Cfg#=3D 1 Atr=3Da0 MxPwr=3D500mA I:* If#=3D 0 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3D30 Driver= =3Doption E: Ad=3D01(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D81(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 1 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D40 Driver= =3Doption E: Ad=3D83(I) Atr=3D03(Int.) MxPS=3D 10 Ivl=3D32ms E: Ad=3D82(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D02(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 2 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D00 Driver= =3Doption E: Ad=3D85(I) Atr=3D03(Int.) MxPS=3D 10 Ivl=3D32ms E: Ad=3D84(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D03(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 3 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D00 Driver= =3Doption E: Ad=3D87(I) Atr=3D03(Int.) MxPS=3D 10 Ivl=3D32ms E: Ad=3D86(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D04(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 4 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Dqmi_wwan E: Ad=3D88(I) Atr=3D03(Int.) MxPS=3D 8 Ivl=3D32ms E: Ad=3D8e(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D0f(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms Signed-off-by: jerry meng Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/usb/serial/option.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -256,6 +256,7 @@ static void option_instat_callback(struc #define QUECTEL_PRODUCT_EM060K 0x030b #define QUECTEL_PRODUCT_EM12 0x0512 #define QUECTEL_PRODUCT_RM500Q 0x0800 +#define QUECTEL_PRODUCT_RM520N 0x0801 #define QUECTEL_PRODUCT_EC200S_CN 0x6002 #define QUECTEL_PRODUCT_EC200T 0x6026 #define QUECTEL_PRODUCT_RM500K 0x7001 @@ -1161,6 +1162,9 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q= , 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q= , 0xff, 0xff, 0x10), .driver_info =3D ZLP }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM520N= , 0xff, 0xff, 0x30) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM520N= , 0xff, 0, 0x40) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM520N= , 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200S= _CN, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T= , 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500K= , 0xff, 0x00, 0x00) }, From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62C18C6FA83 for ; Mon, 26 Sep 2022 12:18:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239490AbiIZMR7 (ORCPT ); Mon, 26 Sep 2022 08:17:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239402AbiIZMRY (ORCPT ); Mon, 26 Sep 2022 08:17:24 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB2068769D; Mon, 26 Sep 2022 04:00:35 -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 sin.source.kernel.org (Postfix) with ESMTPS id A8FA8CE10E9; Mon, 26 Sep 2022 10:42:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1A25C433C1; Mon, 26 Sep 2022 10:42:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188952; bh=JMWFfDdxGeDhF2nbUZDhH8kf6fSAkLFjq6b7QHEYMAI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jfoIVF0+dOjOK/gx+Hos/2Y9IheMnF7TVK60nGhgpLqUVib0dJsMd3VCwXudlLibY x7VAoYUgqjOX5q1p6GFJbYRmWVbBFfMCistuhtovZJ9fA7x6mwjLm4t0JsUX2lNBBj lncXpwxsVJPO2WZTgAnN8GGiqD52ziTjM5Dl227o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.19 025/207] Revert "ALSA: usb-audio: Split endpoint setups for hw_params and prepare" Date: Mon, 26 Sep 2022 12:10:14 +0200 Message-Id: <20220926100807.598605894@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai commit 79764ec772bc1346441ae1c4b1f3bd1991d634e8 upstream. This reverts commit ff878b408a03bef5d610b7e2302702e16a53636e. Unfortunately the recent fix seems bringing another regressions with PulseAudio / pipewire, at least for Steinberg and MOTU devices. As a temporary solution, do a straight revert. The issue for Android will be revisited again later by another different fix (if any). Fixes: ff878b408a03 ("ALSA: usb-audio: Split endpoint setups for hw_params = and prepare") Cc: BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=3D216500 Link: https://lore.kernel.org/r/20220920113929.25162-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/usb/endpoint.c | 23 ++++++++++++++--------- sound/usb/endpoint.h | 6 ++---- sound/usb/pcm.c | 14 ++++---------- 3 files changed, 20 insertions(+), 23 deletions(-) --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -758,8 +758,7 @@ bool snd_usb_endpoint_compatible(struct * The endpoint needs to be closed via snd_usb_endpoint_close() later. * * Note that this function doesn't configure the endpoint. The substream - * needs to set it up later via snd_usb_endpoint_set_params() and - * snd_usb_endpoint_prepare(). + * needs to set it up later via snd_usb_endpoint_configure(). */ struct snd_usb_endpoint * snd_usb_endpoint_open(struct snd_usb_audio *chip, @@ -1293,13 +1292,12 @@ out_of_memory: /* * snd_usb_endpoint_set_params: configure an snd_usb_endpoint * - * It's called either from hw_params callback. * Determine the number of URBs to be used on this endpoint. * An endpoint must be configured before it can be started. * An endpoint that is already running can not be reconfigured. */ -int snd_usb_endpoint_set_params(struct snd_usb_audio *chip, - struct snd_usb_endpoint *ep) +static int snd_usb_endpoint_set_params(struct snd_usb_audio *chip, + struct snd_usb_endpoint *ep) { const struct audioformat *fmt =3D ep->cur_audiofmt; int err; @@ -1382,18 +1380,18 @@ static int init_sample_rate(struct snd_u } =20 /* - * snd_usb_endpoint_prepare: Prepare the endpoint + * snd_usb_endpoint_configure: Configure the endpoint * * This function sets up the EP to be fully usable state. - * It's called either from prepare callback. + * It's called either from hw_params or prepare callback. * The function checks need_setup flag, and performs nothing unless needed, * so it's safe to call this multiple times. * * This returns zero if unchanged, 1 if the configuration has changed, * or a negative error code. */ -int snd_usb_endpoint_prepare(struct snd_usb_audio *chip, - struct snd_usb_endpoint *ep) +int snd_usb_endpoint_configure(struct snd_usb_audio *chip, + struct snd_usb_endpoint *ep) { bool iface_first; int err =3D 0; @@ -1414,6 +1412,9 @@ int snd_usb_endpoint_prepare(struct snd_ if (err < 0) goto unlock; } + err =3D snd_usb_endpoint_set_params(chip, ep); + if (err < 0) + goto unlock; goto done; } =20 @@ -1441,6 +1442,10 @@ int snd_usb_endpoint_prepare(struct snd_ if (err < 0) goto unlock; =20 + err =3D snd_usb_endpoint_set_params(chip, ep); + if (err < 0) + goto unlock; + err =3D snd_usb_select_mode_quirk(chip, ep->cur_audiofmt); if (err < 0) goto unlock; --- a/sound/usb/endpoint.h +++ b/sound/usb/endpoint.h @@ -17,10 +17,8 @@ snd_usb_endpoint_open(struct snd_usb_aud bool is_sync_ep); void snd_usb_endpoint_close(struct snd_usb_audio *chip, struct snd_usb_endpoint *ep); -int snd_usb_endpoint_set_params(struct snd_usb_audio *chip, - struct snd_usb_endpoint *ep); -int snd_usb_endpoint_prepare(struct snd_usb_audio *chip, - struct snd_usb_endpoint *ep); +int snd_usb_endpoint_configure(struct snd_usb_audio *chip, + struct snd_usb_endpoint *ep); int snd_usb_endpoint_get_clock_rate(struct snd_usb_audio *chip, int clock); =20 bool snd_usb_endpoint_compatible(struct snd_usb_audio *chip, --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c @@ -443,17 +443,17 @@ static int configure_endpoints(struct sn if (stop_endpoints(subs, false)) sync_pending_stops(subs); if (subs->sync_endpoint) { - err =3D snd_usb_endpoint_prepare(chip, subs->sync_endpoint); + err =3D snd_usb_endpoint_configure(chip, subs->sync_endpoint); if (err < 0) return err; } - err =3D snd_usb_endpoint_prepare(chip, subs->data_endpoint); + err =3D snd_usb_endpoint_configure(chip, subs->data_endpoint); if (err < 0) return err; snd_usb_set_format_quirk(subs, subs->cur_audiofmt); } else { if (subs->sync_endpoint) { - err =3D snd_usb_endpoint_prepare(chip, subs->sync_endpoint); + err =3D snd_usb_endpoint_configure(chip, subs->sync_endpoint); if (err < 0) return err; } @@ -551,13 +551,7 @@ static int snd_usb_hw_params(struct snd_ subs->cur_audiofmt =3D fmt; mutex_unlock(&chip->mutex); =20 - if (subs->sync_endpoint) { - ret =3D snd_usb_endpoint_set_params(chip, subs->sync_endpoint); - if (ret < 0) - goto unlock; - } - - ret =3D snd_usb_endpoint_set_params(chip, subs->data_endpoint); + ret =3D configure_endpoints(chip, subs); =20 unlock: if (ret < 0) From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 204BDC07E9D for ; Mon, 26 Sep 2022 12:07:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239419AbiIZMH1 (ORCPT ); Mon, 26 Sep 2022 08:07:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238793AbiIZMDJ (ORCPT ); Mon, 26 Sep 2022 08:03:09 -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 0816A7D1F9; Mon, 26 Sep 2022 03:53:50 -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 C193F60769; Mon, 26 Sep 2022 10:42:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBEE2C433C1; Mon, 26 Sep 2022 10:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188955; bh=ekEYV8am7I3UA39OEA5d3IcLfPZlN6rAm5VHcwf7ZNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BUhFF6zjLocop8E8hgXl6xf7chthZsoTOgfo5hAgDa5cSrCsMu7hMStxdqMRMEKCI J6K080h/tICIG770m8FJ7EWCMImjnju+7G5rzjcfywkklcHxEArBXX+ay7ETzfkXMO h9lxtELdvNYWGu9m9lpCjoncooY8qnXLdsY6XD+A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rondreis , Takashi Iwai Subject: [PATCH 5.19 026/207] ALSA: core: Fix double-free at snd_card_new() Date: Mon, 26 Sep 2022 12:10:15 +0200 Message-Id: <20220926100807.648115115@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai commit c3afa2a402d1ecefa59f88d55d9e765f52f75bd9 upstream. During the code change to add the support for devres-managed card instance, we put an explicit kfree(card) call at the error path in snd_card_new(). This is needed for the early error path before the card is initialized with the device, but is rather superfluous and causes a double-free at the error path after the card instance is initialized, as the destructor of the card object already contains a kfree() call. This patch fixes the double-free situation by removing the superfluous kfree(). Meanwhile we need to call kfree() explicitly for the early error path, so it's added there instead. Fixes: e8ad415b7a55 ("ALSA: core: Add managed card creation") Reported-by: Rondreis Cc: Link: https://lore.kernel.org/r/CAB7eexL1zBnB636hwS27d-LdPYZ_R1-5fJS_h=3DZb= CWYU=3DUPWJg@mail.gmail.com Link: https://lore.kernel.org/r/20220919123516.28222-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/core/init.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/sound/core/init.c +++ b/sound/core/init.c @@ -178,10 +178,8 @@ int snd_card_new(struct device *parent, return -ENOMEM; =20 err =3D snd_card_init(card, parent, idx, xid, module, extra_size); - if (err < 0) { - kfree(card); - return err; - } + if (err < 0) + return err; /* card is freed by error handler */ =20 *card_ret =3D card; return 0; @@ -231,7 +229,7 @@ int snd_devm_card_new(struct device *par card->managed =3D true; err =3D snd_card_init(card, parent, idx, xid, module, extra_size); if (err < 0) { - devres_free(card); + devres_free(card); /* in managed mode, we need to free manually */ return err; } =20 @@ -293,6 +291,8 @@ static int snd_card_init(struct snd_card mutex_unlock(&snd_card_mutex); dev_err(parent, "cannot find the slot for index %d (range 0-%i), error: = %d\n", idx, snd_ecards_limit - 1, err); + if (!card->managed) + kfree(card); /* manually free here, as no destructor called */ return err; } set_bit(idx, snd_cards_lock); /* lock it */ From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA646C32771 for ; Mon, 26 Sep 2022 11:32:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238050AbiIZLcu (ORCPT ); Mon, 26 Sep 2022 07:32:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235189AbiIZLb5 (ORCPT ); Mon, 26 Sep 2022 07:31:57 -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 528B95466D; Mon, 26 Sep 2022 03:42:41 -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 7A176B809E3; Mon, 26 Sep 2022 10:42:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C45DCC43470; Mon, 26 Sep 2022 10:42:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188958; bh=b9f2K4jDQN+CYAqLoJZBA29j1gsqykkI4OOEG+gEnIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ssw7fjHvvByNYVTZ5LaOkmD8qSL+vaNyvPFwtX2DUSn2vYpSy1gdX3U38hO1uLz4R HO5CfxwHlytDPu6YZ6SeIVt3x8YV1T8KWSvJcWwHRVkqFQ/3yfbAgv+T05cCOnGkBw UxIFIsJlWbcWaORVZTsjH0d1D01EknDtLiVFSjwM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mohan Kumar , Takashi Iwai Subject: [PATCH 5.19 027/207] ALSA: hda/tegra: set depop delay for tegra Date: Mon, 26 Sep 2022 12:10:16 +0200 Message-Id: <20220926100807.698959137@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mohan Kumar commit 3c4d8c24fb6c44f426e447b04800b0ed61a7b5ae upstream. Reduce the suspend time by setting depop delay to 10ms for tegra. Signed-off-by: Mohan Kumar Cc: Link: https://lore.kernel.org/r/20220913053641.23299-1-mkumard@nvidia.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/pci/hda/patch_hdmi.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -3984,6 +3984,7 @@ static int tegra_hdmi_init(struct hda_co =20 generic_hdmi_init_per_pins(codec); =20 + codec->depop_delay =3D 10; codec->patch_ops.build_pcms =3D tegra_hdmi_build_pcms; spec->chmap.ops.chmap_cea_alloc_validate_get_type =3D nvhdmi_chmap_cea_alloc_validate_get_type; From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81701C32771 for ; Mon, 26 Sep 2022 11:32:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238016AbiIZLcx (ORCPT ); Mon, 26 Sep 2022 07:32:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235547AbiIZLcC (ORCPT ); Mon, 26 Sep 2022 07:32:02 -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 B01D66CD08; Mon, 26 Sep 2022 03:42:42 -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 E15B2604F5; Mon, 26 Sep 2022 10:42:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6098C433D6; Mon, 26 Sep 2022 10:42:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188961; bh=iJBO1ATwtmoS0joPIeWvUPq+w4pRFuon95cJw9vbeCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vplQ2Bp2WPLzR7nlIf5u6xosjcEO/DtcURorY4WI/2RoQkN6iZCSdg/N8vflDdzeh sP762JTwpN92MflB+jasNypMspL9cIvG3sjHj7gGV9m4mgkhwMD52QcMEInRXOWZjQ jsqoBHIdtXOZCZTSZ1X4Lk60PqEl+sFC12xOOy2c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Takashi Iwai Subject: [PATCH 5.19 028/207] ALSA: hda: Fix hang at HD-audio codec unbinding due to refcount saturation Date: Mon, 26 Sep 2022 12:10:17 +0200 Message-Id: <20220926100807.747921742@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai commit ead3d3c5b54f76da79c079e61bacb4279ec56965 upstream. We fixed the potential deadlock at dynamic unbinding the HD-audio codec at the commit 7206998f578d ("ALSA: hda: Fix potential deadlock at codec unbinding"), but ironically, this caused another potential deadlock. The current code uses refcount_dec() and waits for the pending task with wait_event for dropping the refcount to 0. This works fine when PCMs are assigned and actually waiting for the refcount drop. Meanwhile, when there was no PCM assigned, the refcount_dec() call itself was supposed to drop to zero -- alas, it doesn't in reality; refcount_dec() complains, spews kernel warning and it saturates instead of dropping to 0, due to the nature of refcount_dec() implementation. This eventually blocks the wait_event() wakeup and the code get stuck there. For avoiding the problem, we call refcount_dec_and_test() and skips the sync-wait if it already reaches to zero. The patch does a slight code reshuffling to make sure to invoke other disconnect calls before the sync-wait, too. Fixes: 7206998f578d ("ALSA: hda: Fix potential deadlock at codec unbinding") Reported-by: Ville Syrj=C3=A4l=C3=A4 Tested-by: Ville Syrj=C3=A4l=C3=A4 Cc: Link: https://lore.kernel.org/r/YxtflWQnslMHVlU7@intel.com Link: https://lore.kernel.org/r/20220910142550.28494-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/pci/hda/hda_bind.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/sound/pci/hda/hda_bind.c +++ b/sound/pci/hda/hda_bind.c @@ -157,10 +157,10 @@ static int hda_codec_driver_remove(struc return codec->bus->core.ext_ops->hdev_detach(&codec->core); } =20 - refcount_dec(&codec->pcm_ref); snd_hda_codec_disconnect_pcms(codec); snd_hda_jack_tbl_disconnect(codec); - wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref)); + if (!refcount_dec_and_test(&codec->pcm_ref)) + wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref)); snd_power_sync_ref(codec->bus->card); =20 if (codec->patch_ops.free) From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3270AC32771 for ; Mon, 26 Sep 2022 12:01:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239157AbiIZMBq (ORCPT ); Mon, 26 Sep 2022 08:01:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239166AbiIZL62 (ORCPT ); Mon, 26 Sep 2022 07:58:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 700A57B1DC; Mon, 26 Sep 2022 03:52:07 -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 9DB35B80943; Mon, 26 Sep 2022 10:42:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8993C43470; Mon, 26 Sep 2022 10:42:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188964; bh=Nzr51lwUrmbCck9szfNyKvBeqEsGN2UynDFvYwPfw8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IE/NHFB6P0FHcpMyO9iuyGrnKRl8Kwn+jyk9KJ89wyK+1Bl4Yk/MwzsdxcBmwgbTf zJw6TGrt7bI0YnVzxjgP1zzy82rNCs3uc6byxIHWGL0e33MsSOXlSQFADT3qELKNuZ WVJ2zSelMHzJ4O41Wt3Ps8K2RekaxfDSp7Gx29zQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mohan Kumar , Takashi Iwai Subject: [PATCH 5.19 029/207] ALSA: hda: Fix Nvidia dp infoframe Date: Mon, 26 Sep 2022 12:10:18 +0200 Message-Id: <20220926100807.779609294@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mohan Kumar commit f89e409402e2aeb3bc3aa44d2b7a597959e4e6af upstream. Nvidia HDA HW expects infoframe data bytes order same for both HDMI and DP i.e infoframe data starts from 5th bytes offset. As dp infoframe structure has 4th byte as valid infoframe data, use hdmi infoframe structure for nvidia dp infoframe to match HW behvaior. Signed-off-by: Mohan Kumar Cc: Link: https://lore.kernel.org/r/20220913065818.13015-1-mkumard@nvidia.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/pci/hda/patch_hdmi.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -170,6 +170,8 @@ struct hdmi_spec { bool dyn_pcm_no_legacy; /* hdmi interrupt trigger control flag for Nvidia codec */ bool hdmi_intr_trig_ctrl; + bool nv_dp_workaround; /* workaround DP audio infoframe for Nvidia */ + bool intel_hsw_fixup; /* apply Intel platform-specific fixups */ /* * Non-generic VIA/NVIDIA specific @@ -679,15 +681,24 @@ static void hdmi_pin_setup_infoframe(str int ca, int active_channels, int conn_type) { + struct hdmi_spec *spec =3D codec->spec; union audio_infoframe ai; =20 memset(&ai, 0, sizeof(ai)); - if (conn_type =3D=3D 0) { /* HDMI */ + if ((conn_type =3D=3D 0) || /* HDMI */ + /* Nvidia DisplayPort: Nvidia HW expects same layout as HDMI */ + (conn_type =3D=3D 1 && spec->nv_dp_workaround)) { struct hdmi_audio_infoframe *hdmi_ai =3D &ai.hdmi; =20 - hdmi_ai->type =3D 0x84; - hdmi_ai->ver =3D 0x01; - hdmi_ai->len =3D 0x0a; + if (conn_type =3D=3D 0) { /* HDMI */ + hdmi_ai->type =3D 0x84; + hdmi_ai->ver =3D 0x01; + hdmi_ai->len =3D 0x0a; + } else {/* Nvidia DP */ + hdmi_ai->type =3D 0x84; + hdmi_ai->ver =3D 0x1b; + hdmi_ai->len =3D 0x11 << 2; + } hdmi_ai->CC02_CT47 =3D active_channels - 1; hdmi_ai->CA =3D ca; hdmi_checksum_audio_infoframe(hdmi_ai); @@ -3617,6 +3628,7 @@ static int patch_nvhdmi_2ch(struct hda_c spec->pcm_playback.rates =3D SUPPORTED_RATES; spec->pcm_playback.maxbps =3D SUPPORTED_MAXBPS; spec->pcm_playback.formats =3D SUPPORTED_FORMATS; + spec->nv_dp_workaround =3D true; return 0; } =20 @@ -3756,6 +3768,7 @@ static int patch_nvhdmi(struct hda_codec spec->chmap.ops.chmap_cea_alloc_validate_get_type =3D nvhdmi_chmap_cea_alloc_validate_get_type; spec->chmap.ops.chmap_validate =3D nvhdmi_chmap_validate; + spec->nv_dp_workaround =3D true; =20 codec->link_down_at_suspend =3D 1; =20 @@ -3779,6 +3792,7 @@ static int patch_nvhdmi_legacy(struct hd spec->chmap.ops.chmap_cea_alloc_validate_get_type =3D nvhdmi_chmap_cea_alloc_validate_get_type; spec->chmap.ops.chmap_validate =3D nvhdmi_chmap_validate; + spec->nv_dp_workaround =3D true; =20 codec->link_down_at_suspend =3D 1; =20 @@ -3993,6 +4007,7 @@ static int tegra_hdmi_init(struct hda_co spec->chmap.ops.chmap_cea_alloc_validate_get_type =3D nvhdmi_chmap_cea_alloc_validate_get_type; spec->chmap.ops.chmap_validate =3D nvhdmi_chmap_validate; + spec->nv_dp_workaround =3D true; =20 return 0; } From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E8BAC32771 for ; Mon, 26 Sep 2022 11:45:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238483AbiIZLnc (ORCPT ); Mon, 26 Sep 2022 07:43:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238426AbiIZLmc (ORCPT ); Mon, 26 Sep 2022 07:42:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B241726AA; Mon, 26 Sep 2022 03:46:04 -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 0CAC460C0B; Mon, 26 Sep 2022 10:44:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EA1CC433D6; Mon, 26 Sep 2022 10:44:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189094; bh=E+Etq5abwmgEC3fBvjItrVLSFactGP35XcBjGeqpvJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BcRklbJl4oNo3j7AxEVdls5Ij9DD0gDKGkIc2wkcmRZY5qWVGMpNIkNjO+MepGQ9O G5lJXS3QCjbG0WrhH3ZIauVuSz+VGyxyob8sd53/Fw3y8TMZOJUnOIRpMa8dNCZpGa GIlypo6Kb7/R1H6acivVxYbi51QFtdLs82f69Rec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai Vehmanen , Takashi Iwai Subject: [PATCH 5.19 030/207] ALSA: hda: add Intel 5 Series / 3400 PCI DID Date: Mon, 26 Sep 2022 12:10:19 +0200 Message-Id: <20220926100807.809390777@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kai Vehmanen commit 4d40ceef4745536289012670103c59264e0fb3ec upstream. Handle 0x3b57 variant with same AZX_DCAPS_INTEL_PCH_NOPM capabilities as 0x3b56. In practise this allow use of HDMI/DP display audio via i915. BugLink: https://gitlab.freedesktop.org/drm/intel/-/issues/2751 Signed-off-by: Kai Vehmanen Cc: Link: https://lore.kernel.org/r/20220912183716.2126312-1-kai.vehmanen@linux= .intel.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/pci/hda/hda_intel.c | 2 ++ 1 file changed, 2 insertions(+) --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2550,6 +2550,8 @@ static const struct pci_device_id azx_id /* 5 Series/3400 */ { PCI_DEVICE(0x8086, 0x3b56), .driver_data =3D AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM }, + { PCI_DEVICE(0x8086, 0x3b57), + .driver_data =3D AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM }, /* Poulsbo */ { PCI_DEVICE(0x8086, 0x811b), .driver_data =3D AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_BASE }, From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22E7FC07E9D for ; Mon, 26 Sep 2022 11:35:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237981AbiIZLfB (ORCPT ); Mon, 26 Sep 2022 07:35:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233324AbiIZLda (ORCPT ); Mon, 26 Sep 2022 07:33:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA060109B; Mon, 26 Sep 2022 03:43: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 5E22760AD7; Mon, 26 Sep 2022 10:43:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BE19C433C1; Mon, 26 Sep 2022 10:43:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188992; bh=tEo2qrFxEKofABW8SWACi0vMOKtR4BuQ12ivhj0+N7c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MFiOoFad2pkqsL7SojuD2gwCL7pEZiErUlV5wPLDjCTn7lnMhPE+72PSREVYnI/MK 3pvUz901Uu8X9iRtxMJ6kAfIam2j8qIWgq3Hxt5m1FgVzh8hiNMVqL53ImIjoGGBuo gM+tkVMyjtFkhr811J2sbLMLSsq+ZvIpW1O7nJlg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, huangwenhui , Takashi Iwai Subject: [PATCH 5.19 031/207] ALSA: hda/realtek: Add quirk for Huawei WRT-WX9 Date: Mon, 26 Sep 2022 12:10:20 +0200 Message-Id: <20220926100807.854624525@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: huangwenhui commit cbcdf8c4d35cd74aee8581eb2f0453e0ecab7b05 upstream. Fixes headphone and headset microphone detection on Huawei WRT-WX9. Signed-off-by: huangwenhui Cc: Link: https://lore.kernel.org/r/20220913054622.15979-1-huangwenhuia@unionte= ch.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -9532,6 +9532,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDI= O_JACK), SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH= _WX9_PINS), + SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO= _PRESENCE), SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20), SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI), SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101), From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 155FCC07E9D for ; Mon, 26 Sep 2022 12:03:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239217AbiIZMDM (ORCPT ); Mon, 26 Sep 2022 08:03:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238938AbiIZMBI (ORCPT ); Mon, 26 Sep 2022 08:01:08 -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 D05697CAB4; Mon, 26 Sep 2022 03:53: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 dfw.source.kernel.org (Postfix) with ESMTPS id EAB8060B99; Mon, 26 Sep 2022 10:43:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC4AEC433D7; Mon, 26 Sep 2022 10:43:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189026; bh=JasYexfOABVp82q4RXwJyjkmIuqbr27jPIlnFXrmJj4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tZJu3D0mjln4v7SRPKnf1D+NNIK5Ym6po2R+vKHsLYAyiUulxbCebT7R4RuDFrGBy /L+BSCel2puVMl8Ylh1AXt7yrbbx8MU3aGiYb2FdfVVQqyvwjFz1jyjL7WVbneXovu Z1gfHrEi1/dx9M6iteuxHU4app9nG61pHAW/feSM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Callum Osmotherly , Takashi Iwai Subject: [PATCH 5.19 032/207] ALSA: hda/realtek: Enable 4-speaker output Dell Precision 5570 laptop Date: Mon, 26 Sep 2022 12:10:21 +0200 Message-Id: <20220926100807.892905956@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Callum Osmotherly commit bdc9b7396f7d4d6533e70fd8d5472f505b5ef58f upstream. The Dell Precision 5570 uses the same 4-speakers-on-ALC289 just like the previous Precision 5560. I replicated that patch onto this one, and can confirm that the audio is much better (the woofers are now working); I've tested it on my Dell Precision 5570. Signed-off-by: Callum Osmotherly Cc: Link: https://lore.kernel.org/r/YyGbWM5wEoFMbW2v@piranha Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -9130,6 +9130,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MI= C_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MI= C_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK), + SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SP= K), SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52D4FC32771 for ; Mon, 26 Sep 2022 11:40:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238351AbiIZLk5 (ORCPT ); Mon, 26 Sep 2022 07:40:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238272AbiIZLkT (ORCPT ); Mon, 26 Sep 2022 07:40:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4791D1C10E; Mon, 26 Sep 2022 03:45:11 -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 6DC7260B55; Mon, 26 Sep 2022 10:44:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D5D6C433D6; Mon, 26 Sep 2022 10:44:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189060; bh=Sg2d2XMWSRbBwH/dQ+GguvOhN7JVCewsCNPGwmsfshs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ThYU328DEVTkuCYWQl8P9lpZD6fUn3IBcTC4lBJrdsut7esn+vxPzazgI62UBnlR5 Pr4AdqIccCrLzA1IByjpk0S7m1sUdvwUuKG6KwTUCZG5lS7QFZZz9PvSzJtx/yvRZv 13nmO68diKv7NiYki+LyJgV2toIH/qiMpEtL+xRs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.19 033/207] ALSA: hda/realtek: Re-arrange quirk table entries Date: Mon, 26 Sep 2022 12:10:22 +0200 Message-Id: <20220926100807.941331414@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai commit b16c8f229a58eaddfc58aab447253464abd3c85e upstream. A few entries have been mistakenly inserted in wrong positions without considering the SSID ordering. Place them at right positions. Fixes: b7557267c233 ("ALSA: hda/realtek: Add quirk for ASUS GA402") Fixes: 94db9cc8f8fa ("ALSA: hda/realtek: Add quirk for ASUS GU603") Fixes: 739d0959fbed ("ALSA: hda: Add quirk for ASUS Flow x13") Cc: Link: https://lore.kernel.org/r/20220915154724.31634-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/pci/hda/patch_realtek.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -9305,10 +9305,11 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC), SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_Z= ENBOOK), SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_Z= ENBOOK_UX31A), + SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK), + SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401), SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS), SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK), - SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK), SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX50= 2_PINS), SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_M= IC), SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_M= IC), @@ -9325,13 +9326,12 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRE= SENCE), SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOO= ST), SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS= _GA401), SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE), SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA50= 2), SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU50= 2_PINS), SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA40= 1), SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA40= 1), - SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS= _GA401), - SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401), SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2= ), SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC), From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C47FC32771 for ; Mon, 26 Sep 2022 11:39:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238190AbiIZLjp (ORCPT ); Mon, 26 Sep 2022 07:39:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238225AbiIZLii (ORCPT ); Mon, 26 Sep 2022 07:38:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF110264F; Mon, 26 Sep 2022 03:44:38 -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 B8969B80936; Mon, 26 Sep 2022 10:44:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE5BBC433C1; Mon, 26 Sep 2022 10:44:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189076; bh=jaJeJqROZcvFq4vGFfZ+cR1vS7ttavk9mSvvB7maJes=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fL5EwUdpbRs9Yjg/lqGioIgYr+Cft5+UKZNg/ybPtp1nPKLecfSQsq9rPAA7Y/Rqz S6nxBcP0sIcYTmLklgskmAlREH9y+smorqQVj4mFSjncJhnvC+BrztkqYSy3x/6rV5 kV6cFIYG37ZeoPS0Bhb6GmwPiuVCpVh9/wGFIVFs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Luke D. Jones" , Takashi Iwai Subject: [PATCH 5.19 034/207] ALSA: hda/realtek: Add pincfg for ASUS G513 HP jack Date: Mon, 26 Sep 2022 12:10:23 +0200 Message-Id: <20220926100807.983732518@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luke D. Jones commit c611e659044168e7abcbae8ba1ea833521498fbb upstream. Fixes up the pincfg for ASUS ROG Strix G513 headphone and mic combo jack [ Fixed the position in the quirk table by tiwai ] Signed-off-by: Luke D. Jones Cc: Link: https://lore.kernel.org/r/20220915080921.35563-2-luke@ljones.dev Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/pci/hda/patch_realtek.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -7037,6 +7037,7 @@ enum { ALC294_FIXUP_ASUS_GU502_HP, ALC294_FIXUP_ASUS_GU502_PINS, ALC294_FIXUP_ASUS_GU502_VERBS, + ALC294_FIXUP_ASUS_G513_PINS, ALC285_FIXUP_HP_GPIO_LED, ALC285_FIXUP_HP_MUTE_LED, ALC236_FIXUP_HP_GPIO_LED, @@ -8375,6 +8376,15 @@ static const struct hda_fixup alc269_fix .type =3D HDA_FIXUP_FUNC, .v.func =3D alc294_fixup_gu502_hp, }, + [ALC294_FIXUP_ASUS_G513_PINS] =3D { + .type =3D HDA_FIXUP_PINS, + .v.pins =3D (const struct hda_pintbl[]) { + { 0x19, 0x03a11050 }, /* front HP mic */ + { 0x1a, 0x03a11c30 }, /* rear external mic */ + { 0x21, 0x03211420 }, /* front HP out */ + { } + }, + }, [ALC294_FIXUP_ASUS_COEF_1B] =3D { .type =3D HDA_FIXUP_VERBS, .v.verbs =3D (const struct hda_verb[]) { @@ -9330,6 +9340,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE), SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA50= 2), SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU50= 2_PINS), + SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G5= 13_PINS), SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA40= 1), SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA40= 1), SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2= ), From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 082C9C6FA83 for ; Mon, 26 Sep 2022 11:42:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238260AbiIZLmo (ORCPT ); Mon, 26 Sep 2022 07:42:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238245AbiIZLmQ (ORCPT ); Mon, 26 Sep 2022 07:42:16 -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 4123A6FA0B; Mon, 26 Sep 2022 03:45:47 -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 4B41360B6A; Mon, 26 Sep 2022 10:44:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E084C433D7; Mon, 26 Sep 2022 10:44:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189079; bh=L31EZP0m5UA1cnHIbiHpxFtQI9DRA1la4q43bKaZdck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wEDUqV7nSU8cYBbcicX2J2/blVjucxsc0VrdhqIfBIcAzssGkl5mjr7AdKAK5yLaM V6HutbZHaa3Gh35UCIoP7IkLkMehhOO0B2qJT8rk3MhvrQ2k61EVWVgMMSXXvgGVmA VyiQS4vtGGy9wtqze3DcCCPYpDGEPtw9Z+jJ3Wqw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Luke D. Jones" , Takashi Iwai Subject: [PATCH 5.19 035/207] ALSA: hda/realtek: Add pincfg for ASUS G533Z HP jack Date: Mon, 26 Sep 2022 12:10:24 +0200 Message-Id: <20220926100808.032363245@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luke D. Jones commit bc2c23549ccd7105eb6ff0d4f0ac519285628673 upstream. Fixes up the pincfg for ASUS ROG Strix G15 (G533Z) headphone combo jack [ Fixed the position in the quirk table by tiwai ] Signed-off-by: Luke D. Jones Cc: Link: https://lore.kernel.org/r/20220915080921.35563-3-luke@ljones.dev Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/pci/hda/patch_realtek.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -7038,6 +7038,7 @@ enum { ALC294_FIXUP_ASUS_GU502_PINS, ALC294_FIXUP_ASUS_GU502_VERBS, ALC294_FIXUP_ASUS_G513_PINS, + ALC285_FIXUP_ASUS_G533Z_PINS, ALC285_FIXUP_HP_GPIO_LED, ALC285_FIXUP_HP_MUTE_LED, ALC236_FIXUP_HP_GPIO_LED, @@ -8385,6 +8386,15 @@ static const struct hda_fixup alc269_fix { } }, }, + [ALC285_FIXUP_ASUS_G533Z_PINS] =3D { + .type =3D HDA_FIXUP_PINS, + .v.pins =3D (const struct hda_pintbl[]) { + { 0x14, 0x90170120 }, + { } + }, + .chained =3D true, + .chain_id =3D ALC294_FIXUP_ASUS_G513_PINS, + }, [ALC294_FIXUP_ASUS_COEF_1B] =3D { .type =3D HDA_FIXUP_VERBS, .v.verbs =3D (const struct hda_verb[]) { @@ -9335,6 +9345,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRE= SENCE), SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOO= ST), + SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G53= 3Z_PINS), SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS= _GA401), SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE), From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44817C32771 for ; Mon, 26 Sep 2022 11:43:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236110AbiIZLn0 (ORCPT ); Mon, 26 Sep 2022 07:43:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238391AbiIZLmY (ORCPT ); Mon, 26 Sep 2022 07:42:24 -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 DE9187170E; Mon, 26 Sep 2022 03:45:43 -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 42B4660BB7; Mon, 26 Sep 2022 10:44:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EB6EC433D7; Mon, 26 Sep 2022 10:44:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189082; bh=wp3OhQ1HPWF/aPMYW9YDhQ1V1FhPPVjSB/btCyYxl9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xq811rjES5FdSjNPMWb0Zw/28fsODyLatdC1tofwS3d89S6HJfRrKrK9kZkmRHWZX zA2qkEzBGA8OKGk2ZjmZTl7NYgoSEvwAb+8eifsFT8BML/Ng44Hi4c7T8nXIQxlXy2 8GIEHxH7+Y4KhFK6WSWYVkZbSpsxTR0OvyPgTMLM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Luke D. Jones" , Takashi Iwai Subject: [PATCH 5.19 036/207] ALSA: hda/realtek: Add quirk for ASUS GA503R laptop Date: Mon, 26 Sep 2022 12:10:25 +0200 Message-Id: <20220926100808.223997025@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luke D. Jones commit ba1f818053b0668a1ce2fe86b840e81b592cc560 upstream. The ASUS G15 2022 (GA503R) series laptop has the same node-to-DAC pairs as early models and the G14, this includes bass speakers which are by default mapped incorrectly to the 0x06 node. Add a quirk to use the same DAC pairs as the G14. Signed-off-by: Luke D. Jones Cc: Link: https://lore.kernel.org/r/20220915080921.35563-4-luke@ljones.dev Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -9353,6 +9353,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU50= 2_PINS), SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G5= 13_PINS), SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA40= 1), + SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS= _GA401), SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA40= 1), SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2= ), SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EBBEC32771 for ; Mon, 26 Sep 2022 11:42:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238417AbiIZLl4 (ORCPT ); Mon, 26 Sep 2022 07:41:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238313AbiIZLlG (ORCPT ); Mon, 26 Sep 2022 07:41:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5AF26F548; Mon, 26 Sep 2022 03:45: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 dfw.source.kernel.org (Postfix) with ESMTPS id 3B88960A52; Mon, 26 Sep 2022 10:44:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34F5CC433D6; Mon, 26 Sep 2022 10:44:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189085; bh=5/kmmVFM79XD0DknOLwHTGFBbLTGilshMyNLZ8aNO5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B3e51/27/2q7AFBDnVapcTVOtntUZU/v8wBta2AXrZaham145G/j4ZAdDZtGHHnJb vWnnyZN1WFZHmXciu2OfY6wENBu1SLwaTPnTR2W0L31FHX/gO0XzxtMCQaD05VWlV7 DilgIVDu7NTQEypkMLulEPyizv2A/g1HTwgu0Tow= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Callum Osmotherly , Takashi Iwai Subject: [PATCH 5.19 037/207] ALSA: hda/realtek: Enable 4-speaker output Dell Precision 5530 laptop Date: Mon, 26 Sep 2022 12:10:26 +0200 Message-Id: <20220926100808.273907483@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Callum Osmotherly commit 1885ff13d4c42910b37a0e3f7c2f182520f4eed1 upstream. Just as with the 5570 (and the other Dell laptops), this enables the two subwoofer speakers on the Dell Precision 5530 together with the main ones, significantly increasing the audio quality. I've tested this myself on a 5530 and can confirm it's working as expected. Signed-off-by: Callum Osmotherly Cc: Link: https://lore.kernel.org/r/YyMjQO3mhyXlMbCf@piranha Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -9134,6 +9134,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HE= ADSET_MIC), SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HE= ADSET_MIC), SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_L= INEOUT_VERB), + SND_PCI_QUIRK(0x1028, 0x087d, "Dell Precision 5530", ALC289_FIXUP_DUAL_SP= K), SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO= _MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_P= RESENCE), SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 385F2C32771 for ; Mon, 26 Sep 2022 11:40:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238233AbiIZLkG (ORCPT ); Mon, 26 Sep 2022 07:40:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238305AbiIZLix (ORCPT ); Mon, 26 Sep 2022 07:38:53 -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 CB4261108; Mon, 26 Sep 2022 03:44: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 5311260C05; Mon, 26 Sep 2022 10:44:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4037EC433C1; Mon, 26 Sep 2022 10:44:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189088; bh=o5v81wX05L5AJeJTH1zhHV+Ku4bmxWuYIuMAGDLZUiA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gJG0f1niT+RxdCmdg7DRLeEmjaOgv8sJOZ7X3qpucrTIvo061o6J+c0ztAy5I/LjB oLEPsv7Y4Zj86KD56tXaEcgKlUn+L9eUAFaegs8Wgs57DShwm45ulscbWF8Z5YJHCX 5dX7hyJQ84HEJ3E8ADqqxCNZ3uFtfBZj2SBIq5sE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Houldsworth , Takashi Iwai Subject: [PATCH 5.19 038/207] ALSA: hda/realtek: Add a quirk for HP OMEN 16 (8902) mute LED Date: Mon, 26 Sep 2022 12:10:27 +0200 Message-Id: <20220926100808.323920701@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Houldsworth commit 496322302bf1e58dc2ff134173527493105f51ab upstream. Similair to the HP OMEN 15, the HP OMEN 16 also needs ALC285_FIXUP_HP_MUTE_LED for the mute LED to work. [ Rearranged the entry in PCI SSID order by tiwai ] Signed-off-by: Daniel Houldsworth Cc: Link: https://lore.kernel.org/r/20220918171300.24693-1-dhould3@gmail.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -9279,6 +9279,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_F= IXUP_HP_MUTE_LED), SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_F= IXUP_HP_LIMIT_INT_MIC_BOOST), SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", A= LC287_FIXUP_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED), SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS= 35L41_SPI_2_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41= _SPI_2_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41= _SPI_2_HP_GPIO_LED), From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BADC6C07E9D for ; Mon, 26 Sep 2022 11:43:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238464AbiIZLnV (ORCPT ); Mon, 26 Sep 2022 07:43:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238379AbiIZLmX (ORCPT ); Mon, 26 Sep 2022 07:42:23 -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 8639571BCC; Mon, 26 Sep 2022 03:45: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 ams.source.kernel.org (Postfix) with ESMTPS id E8900B80936; Mon, 26 Sep 2022 10:44:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 459D4C433D6; Mon, 26 Sep 2022 10:44:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189091; bh=Q74uf3s621jYqCQHgIEhJcf7RNGBb1f0pLKmEvNefl4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KgRvGvOSVoBfjIvzQHG9CIiM/26Qr+g12BoaEG0Hu/h3mmwINxq39aBwWwIoRI39p eCEt2Pw7piMPKyKhIoDJqU4iPCcMRxltGdNc83tgckeW69N4RcnovWLquF9uvCV8gX +OplgaSiBBk8UnuTrfL4boqV6T/qc3N/uEOCp+RM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Raghunathan Srinivasan , Yi Liu , Jerry Snitselaar , Kevin Tian , Lu Baolu , Joerg Roedel Subject: [PATCH 5.19 039/207] iommu/vt-d: Check correct capability for sagaw determination Date: Mon, 26 Sep 2022 12:10:28 +0200 Message-Id: <20220926100808.370493079@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yi Liu commit 154897807050c1161cb2660e502fc0470d46b986 upstream. Check 5-level paging capability for 57 bits address width instead of checking 1GB large page capability. Fixes: 53fc7ad6edf2 ("iommu/vt-d: Correctly calculate sagaw value of IOMMU") Cc: stable@vger.kernel.org Reported-by: Raghunathan Srinivasan Signed-off-by: Yi Liu Reviewed-by: Jerry Snitselaar Reviewed-by: Kevin Tian Reviewed-by: Raghunathan Srinivasan Link: https://lore.kernel.org/r/20220916071212.2223869-2-yi.l.liu@intel.com Signed-off-by: Lu Baolu Signed-off-by: Joerg Roedel Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/iommu/intel/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -419,7 +419,7 @@ static unsigned long __iommu_calculate_s { unsigned long fl_sagaw, sl_sagaw; =20 - fl_sagaw =3D BIT(2) | (cap_fl1gp_support(iommu->cap) ? BIT(3) : 0); + fl_sagaw =3D BIT(2) | (cap_5lp_support(iommu->cap) ? BIT(3) : 0); sl_sagaw =3D cap_sagaw(iommu->cap); =20 /* Second level only. */ From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FE11C32771 for ; Mon, 26 Sep 2022 11:35:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238063AbiIZLfg (ORCPT ); Mon, 26 Sep 2022 07:35:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238173AbiIZLeU (ORCPT ); Mon, 26 Sep 2022 07:34:20 -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 B8A386E2E2; Mon, 26 Sep 2022 03:43:24 -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 ED922B80972; Mon, 26 Sep 2022 10:43:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EB5AC433D7; Mon, 26 Sep 2022 10:43:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188995; bh=xBh58Z4hP5/JW9QmDnwWHRoFmnAs6QTEtY4ElTwJe8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CLFPJNX+ulF7UyOmBekEF2bM8hWfZsOUAtB+11ZxQ3LDxDQIF08h0zzajxzCZ+W7X d+63tn3nAsZgUylPASOD6wa0BRf5NGA5vuKE4BcgE8z24hrX4oepY2dDYn+8ZKEDy5 9uknRYLf/CLxEoiES/8ji0RGplyV/5PIjNg9IiEw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yuezhang Mo , Andy Wu , Aoyama Wataru , Sungjong Seo , Namjae Jeon Subject: [PATCH 5.19 040/207] exfat: fix overflow for large capacity partition Date: Mon, 26 Sep 2022 12:10:29 +0200 Message-Id: <20220926100808.419018985@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yuezhang Mo commit 2e9ceb6728f1dc2fa4b5d08f37d88cbc49a20a62 upstream. Using int type for sector index, there will be overflow in a large capacity partition. For example, if storage with sector size of 512 bytes and partition capacity is larger than 2TB, there will be overflow. Fixes: 1b6138385499 ("exfat: reduce block requests when zeroing a cluster") Cc: stable@vger.kernel.org # v5.19+ Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu Reviewed-by: Aoyama Wataru Acked-by: Sungjong Seo Signed-off-by: Namjae Jeon Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/exfat/fatent.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/exfat/fatent.c b/fs/exfat/fatent.c index ee0b7cf51157..41ae4cce1f42 100644 --- a/fs/exfat/fatent.c +++ b/fs/exfat/fatent.c @@ -270,8 +270,7 @@ int exfat_zeroed_cluster(struct inode *dir, unsigned in= t clu) struct super_block *sb =3D dir->i_sb; struct exfat_sb_info *sbi =3D EXFAT_SB(sb); struct buffer_head *bh; - sector_t blknr, last_blknr; - int i; + sector_t blknr, last_blknr, i; =20 blknr =3D exfat_cluster_to_sector(sbi, clu); last_blknr =3D blknr + sbi->sect_per_clus; --=20 2.37.3 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DAA5C32771 for ; Mon, 26 Sep 2022 11:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238059AbiIZLf0 (ORCPT ); Mon, 26 Sep 2022 07:35:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238146AbiIZLeM (ORCPT ); Mon, 26 Sep 2022 07:34:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B14866E2DE; Mon, 26 Sep 2022 03:43: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 415D060A52; Mon, 26 Sep 2022 10:43:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56196C433C1; Mon, 26 Sep 2022 10:43:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188998; bh=jLm3OD3DQ5HM9meF13VdBawooU2t/bfBfnoqYP3gKJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z/zDM+9hdd+EwBtJQKXIOzT2aE0lyhtbKU6gJ6yrkgsL0FeZ2GCUxOon/w/ShJxZj SwJeDwwa7gr43EnKExB0fGGLYBAMtBho4ACJE2z2bDF/s+nlh+H8Ek5GYI5mveocLl c4G7Lequoi6xKzEcOBBPHliRvMpDuBtYvN4kHo1c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josef Bacik , Filipe Manana , David Sterba Subject: [PATCH 5.19 041/207] btrfs: fix hang during unmount when stopping block group reclaim worker Date: Mon, 26 Sep 2022 12:10:30 +0200 Message-Id: <20220926100808.459198084@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Filipe Manana commit 8a1f1e3d1eecf9d2359a2709e276743a67e145db upstream. During early unmount, at close_ctree(), we try to stop the block group reclaim task with cancel_work_sync(), but that may hang if the block group reclaim task is currently at btrfs_relocate_block_group() waiting for the flag BTRFS_FS_UNFINISHED_DROPS to be cleared from fs_info->flags. During unmount we only clear that flag later, after trying to stop the block group reclaim task. Fix that by clearing BTRFS_FS_UNFINISHED_DROPS before trying to stop the block group reclaim task and after setting BTRFS_FS_CLOSING_START, so that if the reclaim task is waiting on that bit, it will stop immediately after being woken, because it sees the filesystem is closing (with a call to btrfs_fs_closing()), and then returns immediately with -EINTR. Fixes: 31e70e527806c5 ("btrfs: fix hang during unmount when block group rec= laim task is running") CC: stable@vger.kernel.org # 5.15+ Reviewed-by: Josef Bacik Signed-off-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/btrfs/disk-io.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -4587,6 +4587,17 @@ void __cold close_ctree(struct btrfs_fs_ set_bit(BTRFS_FS_CLOSING_START, &fs_info->flags); =20 /* + * If we had UNFINISHED_DROPS we could still be processing them, so + * clear that bit and wake up relocation so it can stop. + * We must do this before stopping the block group reclaim task, because + * at btrfs_relocate_block_group() we wait for this bit, and after the + * wait we stop with -EINTR if btrfs_fs_closing() returns non-zero - we + * have just set BTRFS_FS_CLOSING_START, so btrfs_fs_closing() will + * return 1. + */ + btrfs_wake_unfinished_drop(fs_info); + + /* * We may have the reclaim task running and relocating a data block group, * in which case it may create delayed iputs. So stop it before we park * the cleaner kthread otherwise we can get new delayed iputs after @@ -4604,12 +4615,6 @@ void __cold close_ctree(struct btrfs_fs_ */ kthread_park(fs_info->cleaner_kthread); =20 - /* - * If we had UNFINISHED_DROPS we could still be processing them, so - * clear that bit and wake up relocation so it can stop. - */ - btrfs_wake_unfinished_drop(fs_info); - /* wait for the qgroup rescan worker to stop */ btrfs_qgroup_wait_for_completion(fs_info, false); From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD552C07E9D for ; Mon, 26 Sep 2022 11:35:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238068AbiIZLfj (ORCPT ); Mon, 26 Sep 2022 07:35:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238175AbiIZLeU (ORCPT ); Mon, 26 Sep 2022 07:34:20 -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 CC9676E2F3; Mon, 26 Sep 2022 03:43:25 -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 439BD60B6A; Mon, 26 Sep 2022 10:43:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5156EC433C1; Mon, 26 Sep 2022 10:43:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189001; bh=IwoZo9ErO1qaB5Lo6wIVc4jR3I3bfifsx1XX83v91Gw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pH6/OId5B5bmtUlDyScGz5BPuYYzpeapTAq1s6DU/0Ll5S347deY2lSbU0pMNWRoZ oZ27x+JlWCCNpR+LxwVLiMmwuMlVg3xTF6vR/7Kb3BHY/0ik5exJnesesUoHogfyQT zAHHyij8uRA44YXp0N3hk4zfacm5WLasRMw7JCKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josef Bacik , Filipe Manana , David Sterba Subject: [PATCH 5.19 042/207] btrfs: fix hang during unmount when stopping a space reclaim worker Date: Mon, 26 Sep 2022 12:10:31 +0200 Message-Id: <20220926100808.505914872@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Filipe Manana commit a362bb864b8db4861977d00bd2c3222503ccc34b upstream. Often when running generic/562 from fstests we can hang during unmount, resulting in a trace like this: Sep 07 11:52:00 debian9 unknown: run fstests generic/562 at 2022-09-07 11= :52:00 Sep 07 11:55:32 debian9 kernel: INFO: task umount:49438 blocked for more = than 120 seconds. Sep 07 11:55:32 debian9 kernel: Not tainted 6.0.0-rc2-btrfs-next-12= 2 #1 Sep 07 11:55:32 debian9 kernel: "echo 0 > /proc/sys/kernel/hung_task_time= out_secs" disables this message. Sep 07 11:55:32 debian9 kernel: task:umount state:D stack: 0 = pid:49438 ppid: 25683 flags:0x00004000 Sep 07 11:55:32 debian9 kernel: Call Trace: Sep 07 11:55:32 debian9 kernel: Sep 07 11:55:32 debian9 kernel: __schedule+0x3c8/0xec0 Sep 07 11:55:32 debian9 kernel: ? rcu_read_lock_sched_held+0x12/0x70 Sep 07 11:55:32 debian9 kernel: schedule+0x5d/0xf0 Sep 07 11:55:32 debian9 kernel: schedule_timeout+0xf1/0x130 Sep 07 11:55:32 debian9 kernel: ? lock_release+0x224/0x4a0 Sep 07 11:55:32 debian9 kernel: ? lock_acquired+0x1a0/0x420 Sep 07 11:55:32 debian9 kernel: ? trace_hardirqs_on+0x2c/0xd0 Sep 07 11:55:32 debian9 kernel: __wait_for_common+0xac/0x200 Sep 07 11:55:32 debian9 kernel: ? usleep_range_state+0xb0/0xb0 Sep 07 11:55:32 debian9 kernel: __flush_work+0x26d/0x530 Sep 07 11:55:32 debian9 kernel: ? flush_workqueue_prep_pwqs+0x140/0x140 Sep 07 11:55:32 debian9 kernel: ? trace_clock_local+0xc/0x30 Sep 07 11:55:32 debian9 kernel: __cancel_work_timer+0x11f/0x1b0 Sep 07 11:55:32 debian9 kernel: ? close_ctree+0x12b/0x5b3 [btrfs] Sep 07 11:55:32 debian9 kernel: ? __trace_bputs+0x10b/0x170 Sep 07 11:55:32 debian9 kernel: close_ctree+0x152/0x5b3 [btrfs] Sep 07 11:55:32 debian9 kernel: ? evict_inodes+0x166/0x1c0 Sep 07 11:55:32 debian9 kernel: generic_shutdown_super+0x71/0x120 Sep 07 11:55:32 debian9 kernel: kill_anon_super+0x14/0x30 Sep 07 11:55:32 debian9 kernel: btrfs_kill_super+0x12/0x20 [btrfs] Sep 07 11:55:32 debian9 kernel: deactivate_locked_super+0x2e/0xa0 Sep 07 11:55:32 debian9 kernel: cleanup_mnt+0x100/0x160 Sep 07 11:55:32 debian9 kernel: task_work_run+0x59/0xa0 Sep 07 11:55:32 debian9 kernel: exit_to_user_mode_prepare+0x1a6/0x1b0 Sep 07 11:55:32 debian9 kernel: syscall_exit_to_user_mode+0x16/0x40 Sep 07 11:55:32 debian9 kernel: do_syscall_64+0x48/0x90 Sep 07 11:55:32 debian9 kernel: entry_SYSCALL_64_after_hwframe+0x63/0xcd Sep 07 11:55:32 debian9 kernel: RIP: 0033:0x7fcde59a57a7 Sep 07 11:55:32 debian9 kernel: RSP: 002b:00007ffe914217c8 EFLAGS: 000002= 46 ORIG_RAX: 00000000000000a6 Sep 07 11:55:32 debian9 kernel: RAX: 0000000000000000 RBX: 00007fcde5ae82= 64 RCX: 00007fcde59a57a7 Sep 07 11:55:32 debian9 kernel: RDX: 0000000000000000 RSI: 00000000000000= 00 RDI: 000055b57556cdd0 Sep 07 11:55:32 debian9 kernel: RBP: 000055b57556cba0 R08: 00000000000000= 00 R09: 00007ffe91420570 Sep 07 11:55:32 debian9 kernel: R10: 0000000000000000 R11: 00000000000002= 46 R12: 0000000000000000 Sep 07 11:55:32 debian9 kernel: R13: 000055b57556cdd0 R14: 000055b57556cc= b8 R15: 0000000000000000 Sep 07 11:55:32 debian9 kernel: What happens is the following: 1) The cleaner kthread tries to start a transaction to delete an unused block group, but the metadata reservation can not be satisfied right away, so a reservation ticket is created and it starts the async metadata reclaim task (fs_info->async_reclaim_work); 2) Writeback for all the filler inodes with an i_size of 2K starts (generic/562 creates a lot of 2K files with the goal of filling metadata space). We try to create an inline extent for them, but we fail when trying to insert the inline extent with -ENOSPC (at cow_file_range_inline()) - since this is not critical, we fallback to non-inline mode (back to cow_file_range()), reserve extents, create extent maps and create the ordered extents; 3) An unmount starts, enters close_ctree(); 4) The async reclaim task is flushing stuff, entering the flush states one by one, until it reaches RUN_DELAYED_IPUTS. There it runs all current delayed iputs. After running the delayed iputs and before calling btrfs_wait_on_delayed_iputs(), one or more ordered extents complete, and btrfs_add_delayed_iput() is called for each one through btrfs_finish_ordered_io() -> btrfs_put_ordered_extent(). This results in bumping fs_info->nr_delayed_iputs from 0 to some positive value. So the async reclaim task blocks at btrfs_wait_on_delayed_iputs() waiting for fs_info->nr_delayed_iputs to become 0; 5) The current transaction is committed by the transaction kthread, we then start unpinning extents and end up calling btrfs_try_granting_tickets() through unpin_extent_range(), since we released some space. This results in satisfying the ticket created by the cleaner kthread at step 1, waking up the cleaner kthread; 6) At close_ctree() we ask the cleaner kthread to park; 7) The cleaner kthread starts the transaction, deletes the unused block group, and then calls kthread_should_park(), which returns true, so it parks. And at this point we have the delayed iputs added by the completion of the ordered extents still pending; 8) Then later at close_ctree(), when we call: cancel_work_sync(&fs_info->async_reclaim_work); We hang forever, since the cleaner was parked and no one else can run delayed iputs after that, while the reclaim task is waiting for the remaining delayed iputs to be completed. Fix this by waiting for all ordered extents to complete and running the delayed iputs before attempting to stop the async reclaim tasks. Note that we can not wait for ordered extents with btrfs_wait_ordered_roots() (or other similar functions) because that waits for the BTRFS_ORDERED_COMPLETE flag to be set on an ordered extent, but the delayed iput is added after that, when doing the final btrfs_put_ordered_extent(). So instead wait for the work queues used for executing ordered extent completion to be empty, which works because we do the final put on an ordered extent at btrfs_finish_ordered_io() (while we are in the unmount context). Fixes: d6fd0ae25c6495 ("Btrfs: fix missing delayed iputs on unmount") CC: stable@vger.kernel.org # 5.15+ Reviewed-by: Josef Bacik Signed-off-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/btrfs/disk-io.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -4637,6 +4637,31 @@ void __cold close_ctree(struct btrfs_fs_ /* clear out the rbtree of defraggable inodes */ btrfs_cleanup_defrag_inodes(fs_info); =20 + /* + * After we parked the cleaner kthread, ordered extents may have + * completed and created new delayed iputs. If one of the async reclaim + * tasks is running and in the RUN_DELAYED_IPUTS flush state, then we + * can hang forever trying to stop it, because if a delayed iput is + * added after it ran btrfs_run_delayed_iputs() and before it called + * btrfs_wait_on_delayed_iputs(), it will hang forever since there is + * no one else to run iputs. + * + * So wait for all ongoing ordered extents to complete and then run + * delayed iputs. This works because once we reach this point no one + * can either create new ordered extents nor create delayed iputs + * through some other means. + * + * Also note that btrfs_wait_ordered_roots() is not safe here, because + * it waits for BTRFS_ORDERED_COMPLETE to be set on an ordered extent, + * but the delayed iput for the respective inode is made only when doing + * the final btrfs_put_ordered_extent() (which must happen at + * btrfs_finish_ordered_io() when we are unmounting). + */ + btrfs_flush_workqueue(fs_info->endio_write_workers); + /* Ordered extents for free space inodes. */ + btrfs_flush_workqueue(fs_info->endio_freespace_worker); + btrfs_run_delayed_iputs(fs_info); + cancel_work_sync(&fs_info->async_reclaim_work); cancel_work_sync(&fs_info->async_data_reclaim_work); cancel_work_sync(&fs_info->preempt_reclaim_work); From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51D6FC32771 for ; Mon, 26 Sep 2022 11:35:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234273AbiIZLfS (ORCPT ); Mon, 26 Sep 2022 07:35:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238140AbiIZLeL (ORCPT ); Mon, 26 Sep 2022 07:34:11 -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 91A676DFB4; Mon, 26 Sep 2022 03:43:30 -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 35BBF60C41; Mon, 26 Sep 2022 10:43:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47845C433B5; Mon, 26 Sep 2022 10:43:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189004; bh=5rApP3s+hqY64Ey6r7vcgj8Y9gYyzKQTvi/sbRmv/PI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z6cnxKXK6LROac4+U5BJl+65j4dDKmHQZF80iJ/aLLFM58j9/DufcVaVOGZWY3ylV t6vEVAG6aRtQHZeKk0wJjDXn1xs0FUFHCi9sAXME6JaPK8CWA5wpZyEVmERHL9YPA8 IIMYx77FJWBImA0j5wK8pxamY1/cWoVX9ETEPD6I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naohiro Aota , David Sterba Subject: [PATCH 5.19 043/207] btrfs: zoned: wait for extent buffer IOs before finishing a zone Date: Mon, 26 Sep 2022 12:10:32 +0200 Message-Id: <20220926100808.543420988@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota commit 2dd7e7bc02829eded71be2342a93dc035f5223f9 upstream. Before sending REQ_OP_ZONE_FINISH to a zone, we need to ensure that ongoing IOs already finished. Or, we will see a "Zone Is Full" error for the IOs, as the ZONE_FINISH command makes the zone full. We ensure that with btrfs_wait_block_group_reservations() and btrfs_wait_ordered_roots() for a data block group. And, for a metadata block group, the comparison of alloc_offset vs meta_write_pointer mostly ensures IOs for the allocated region already sent. However, there still can be a little time frame where the IOs are sent but not yet completed. Introduce wait_eb_writebacks() to ensure such IOs are completed for a metadata block group. It walks the buffer_radix to find extent buffers in the block group and calls wait_on_extent_buffer_writeback() on them. Fixes: afba2bc036b0 ("btrfs: zoned: implement active zone tracking") CC: stable@vger.kernel.org # 5.19+ Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/btrfs/zoned.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 62e7007a7e46..73c6929f7be6 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -1918,10 +1918,44 @@ out_unlock: return ret; } =20 +static void wait_eb_writebacks(struct btrfs_block_group *block_group) +{ + struct btrfs_fs_info *fs_info =3D block_group->fs_info; + const u64 end =3D block_group->start + block_group->length; + struct radix_tree_iter iter; + struct extent_buffer *eb; + void __rcu **slot; + + rcu_read_lock(); + radix_tree_for_each_slot(slot, &fs_info->buffer_radix, &iter, + block_group->start >> fs_info->sectorsize_bits) { + eb =3D radix_tree_deref_slot(slot); + if (!eb) + continue; + if (radix_tree_deref_retry(eb)) { + slot =3D radix_tree_iter_retry(&iter); + continue; + } + + if (eb->start < block_group->start) + continue; + if (eb->start >=3D end) + break; + + slot =3D radix_tree_iter_resume(slot, &iter); + rcu_read_unlock(); + wait_on_extent_buffer_writeback(eb); + rcu_read_lock(); + } + rcu_read_unlock(); +} + static int do_zone_finish(struct btrfs_block_group *block_group, bool full= y_written) { struct btrfs_fs_info *fs_info =3D block_group->fs_info; struct map_lookup *map; + const bool is_metadata =3D (block_group->flags & + (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_SYSTEM)); int ret =3D 0; int i; =20 @@ -1932,8 +1966,7 @@ static int do_zone_finish(struct btrfs_block_group *b= lock_group, bool fully_writ } =20 /* Check if we have unwritten allocated space */ - if ((block_group->flags & - (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_SYSTEM)) && + if (is_metadata && block_group->start + block_group->alloc_offset > block_group->meta_wr= ite_pointer) { spin_unlock(&block_group->lock); return -EAGAIN; @@ -1958,6 +1991,9 @@ static int do_zone_finish(struct btrfs_block_group *b= lock_group, bool fully_writ /* No need to wait for NOCOW writers. Zoned mode does not allow that */ btrfs_wait_ordered_roots(fs_info, U64_MAX, block_group->start, block_group->length); + /* Wait for extent buffers to be written. */ + if (is_metadata) + wait_eb_writebacks(block_group); =20 spin_lock(&block_group->lock); =20 --=20 2.37.3 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16586C6FA86 for ; Mon, 26 Sep 2022 11:37:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238160AbiIZLhL (ORCPT ); Mon, 26 Sep 2022 07:37:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238077AbiIZLft (ORCPT ); Mon, 26 Sep 2022 07:35:49 -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 7D44C4D25C; Mon, 26 Sep 2022 03:43:34 -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 4E17260B7E; Mon, 26 Sep 2022 10:43:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40C6EC433D7; Mon, 26 Sep 2022 10:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189007; bh=B6U0drhn08g0LmIo7aANssbc+0zXfg4+1s/TNYvoYp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y/mWgycI3E8anMR7prUm0yYbqJfO5weC1LC69CsbFxvYEfE3jK6CNTd7O4d+UEzam SpEf4KxQ0HMQI36DKBdyQaXKbxF6zPpQ4UD3cwmcvWCJN8LjM3bX8JIqiaEPuaRFPP xBpl+Waw/iQ6TQ8clEs5c2nwupr2WeFA8toXg5Vs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Namhyung Kim , Ian Rogers , Jiri Olsa , Arnaldo Carvalho de Melo Subject: [PATCH 5.19 044/207] libperf evlist: Fix polling of system-wide events Date: Mon, 26 Sep 2022 12:10:33 +0200 Message-Id: <20220926100808.590969680@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Adrian Hunter commit 6cc447964555df209c590756bd804d3bb9ce1fe0 upstream. Originally, (refer commit f90d194a867a5a1d ("perf evlist: Do not poll events that use the system_wide flag") there wasn't much reason to poll system-wide events because: 1. The mmaps get "merged" via set-output anyway (the per-cpu case) 2. perf reads all mmaps when any event is woken 3. system-wide mmaps do not fill up as fast as the mmaps for user selected events But there was 1 reason not to poll which was that it prevented correct termination due to POLLHUP on all user selected events. That issue is now easily resolved by using fdarray_flag__nonfilterable. With the advent of commit ae4f8ae16a078964 ("libperf evlist: Allow mixing per-thread and per-cpu mmaps"), system-wide mmaps can be used also in the per-thread case where reason 1 does not apply. Fix the omission of system-wide events from polling by using the fdarray_flag__nonfilterable flag. Example: Before: $ perf record --no-bpf-event -vvv -e intel_pt// --per-thread uname 2>er= r.txt Linux $ grep 'sys_perf_event_open.*=3D\|pollfd' err.txt sys_perf_event_open: pid 155076 cpu -1 group_fd -1 flags 0x8 =3D 5 sys_perf_event_open: pid 155076 cpu -1 group_fd -1 flags 0x8 =3D 6 sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 =3D 7 sys_perf_event_open: pid -1 cpu 1 group_fd -1 flags 0x8 =3D 9 sys_perf_event_open: pid -1 cpu 2 group_fd -1 flags 0x8 =3D 10 sys_perf_event_open: pid -1 cpu 3 group_fd -1 flags 0x8 =3D 11 sys_perf_event_open: pid -1 cpu 4 group_fd -1 flags 0x8 =3D 12 sys_perf_event_open: pid -1 cpu 5 group_fd -1 flags 0x8 =3D 13 sys_perf_event_open: pid -1 cpu 6 group_fd -1 flags 0x8 =3D 14 sys_perf_event_open: pid -1 cpu 7 group_fd -1 flags 0x8 =3D 15 thread_data[0x55fb43c29e80]: pollfd[0] <- event_fd=3D5 thread_data[0x55fb43c29e80]: pollfd[1] <- event_fd=3D6 thread_data[0x55fb43c29e80]: pollfd[2] <- non_perf_event fd=3D4 After: $ perf record --no-bpf-event -vvv -e intel_pt// --per-thread uname 2>er= r.txt Linux $ grep 'sys_perf_event_open.*=3D\|pollfd' err.txt sys_perf_event_open: pid 156316 cpu -1 group_fd -1 flags 0x8 =3D 5 sys_perf_event_open: pid 156316 cpu -1 group_fd -1 flags 0x8 =3D 6 sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 =3D 7 sys_perf_event_open: pid -1 cpu 1 group_fd -1 flags 0x8 =3D 9 sys_perf_event_open: pid -1 cpu 2 group_fd -1 flags 0x8 =3D 10 sys_perf_event_open: pid -1 cpu 3 group_fd -1 flags 0x8 =3D 11 sys_perf_event_open: pid -1 cpu 4 group_fd -1 flags 0x8 =3D 12 sys_perf_event_open: pid -1 cpu 5 group_fd -1 flags 0x8 =3D 13 sys_perf_event_open: pid -1 cpu 6 group_fd -1 flags 0x8 =3D 14 sys_perf_event_open: pid -1 cpu 7 group_fd -1 flags 0x8 =3D 15 thread_data[0x55cc19e58e80]: pollfd[0] <- event_fd=3D5 thread_data[0x55cc19e58e80]: pollfd[1] <- event_fd=3D6 thread_data[0x55cc19e58e80]: pollfd[2] <- event_fd=3D7 thread_data[0x55cc19e58e80]: pollfd[3] <- event_fd=3D9 thread_data[0x55cc19e58e80]: pollfd[4] <- event_fd=3D10 thread_data[0x55cc19e58e80]: pollfd[5] <- event_fd=3D11 thread_data[0x55cc19e58e80]: pollfd[6] <- event_fd=3D12 thread_data[0x55cc19e58e80]: pollfd[7] <- event_fd=3D13 thread_data[0x55cc19e58e80]: pollfd[8] <- event_fd=3D14 thread_data[0x55cc19e58e80]: pollfd[9] <- event_fd=3D15 thread_data[0x55cc19e58e80]: pollfd[10] <- non_perf_event fd=3D4 Fixes: ae4f8ae16a078964 ("libperf evlist: Allow mixing per-thread and per-c= pu mmaps") Signed-off-by: Adrian Hunter Acked-by: Namhyung Kim Cc: Ian Rogers Cc: Jiri Olsa Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220915122612.81738-3-adrian.hunter@intel.= com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- tools/lib/perf/evlist.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/lib/perf/evlist.c b/tools/lib/perf/evlist.c index 6b1bafe267a4..8ec5b9f344e0 100644 --- a/tools/lib/perf/evlist.c +++ b/tools/lib/perf/evlist.c @@ -441,6 +441,7 @@ mmap_per_evsel(struct perf_evlist *evlist, struct perf_= evlist_mmap_ops *ops, =20 perf_evlist__for_each_entry(evlist, evsel) { bool overwrite =3D evsel->attr.write_backward; + enum fdarray_flags flgs; struct perf_mmap *map; int *output, fd, cpu; =20 @@ -504,8 +505,8 @@ mmap_per_evsel(struct perf_evlist *evlist, struct perf_= evlist_mmap_ops *ops, =20 revent =3D !overwrite ? POLLIN : 0; =20 - if (!evsel->system_wide && - perf_evlist__add_pollfd(evlist, fd, map, revent, fdarray_flag__defau= lt) < 0) { + flgs =3D evsel->system_wide ? fdarray_flag__nonfilterable : fdarray_flag= __default; + if (perf_evlist__add_pollfd(evlist, fd, map, revent, flgs) < 0) { perf_mmap__put(map); return -1; } --=20 2.37.3 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A933C07E9D for ; Mon, 26 Sep 2022 11:36:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238139AbiIZLga (ORCPT ); Mon, 26 Sep 2022 07:36:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234297AbiIZLeq (ORCPT ); Mon, 26 Sep 2022 07:34:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68FDA54C9A; Mon, 26 Sep 2022 03:43:34 -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 5C9E860A5F; Mon, 26 Sep 2022 10:43:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 519DBC433C1; Mon, 26 Sep 2022 10:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189010; bh=h62gcAl4gT4CrilNk44RC8TlqH/0u0SPMz0hKFHNtUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1T5QjBlFcwVF1b6zeLfksdd1pas6cVT8L9H/03mTywJhIybfMQK+47bY3Sh7vunt5 ouxOe8RdlEjCh4VlynOkC+M5s3cQ7QIF6AdW+3cafp8V2TNwjTPPh4EQTYMo9Y4dDY J1nUQ18BMvRQ64wt349mDM8g/SI8sedILR2TCrMI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Neukum , Dongliang Mu , Johan Hovold Subject: [PATCH 5.19 045/207] media: flexcop-usb: fix endpoint type check Date: Mon, 26 Sep 2022 12:10:34 +0200 Message-Id: <20220926100808.634174529@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold commit 763679f0eeff0185fc431498849bbc1c24460875 upstream. Commit d725d20e81c2 ("media: flexcop-usb: sanity checking of endpoint type") tried to add an endpoint type sanity check for the single isochronous endpoint but instead broke the driver by checking the wrong descriptor or random data beyond the last endpoint descriptor. Make sure to check the right endpoint descriptor. Fixes: d725d20e81c2 ("media: flexcop-usb: sanity checking of endpoint type") Cc: Oliver Neukum Cc: stable@vger.kernel.org # 5.9 Reported-by: Dongliang Mu Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20220822151027.27026-1-johan@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/media/usb/b2c2/flexcop-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/media/usb/b2c2/flexcop-usb.c +++ b/drivers/media/usb/b2c2/flexcop-usb.c @@ -511,7 +511,7 @@ static int flexcop_usb_init(struct flexc =20 if (fc_usb->uintf->cur_altsetting->desc.bNumEndpoints < 1) return -ENODEV; - if (!usb_endpoint_is_isoc_in(&fc_usb->uintf->cur_altsetting->endpoint[1].= desc)) + if (!usb_endpoint_is_isoc_in(&fc_usb->uintf->cur_altsetting->endpoint[0].= desc)) return -ENODEV; =20 switch (fc_usb->udev->speed) { From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 828BEC32771 for ; Mon, 26 Sep 2022 11:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238072AbiIZLfp (ORCPT ); Mon, 26 Sep 2022 07:35:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238185AbiIZLeV (ORCPT ); Mon, 26 Sep 2022 07:34:21 -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 8F27D6E2DD; Mon, 26 Sep 2022 03:43: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 ams.source.kernel.org (Postfix) with ESMTPS id 256CBB80760; Mon, 26 Sep 2022 10:43:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D14FC433C1; Mon, 26 Sep 2022 10:43:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189013; bh=Tt8vRQ1lbptlmI6m8w3SgZ4Pr7q1NF3YJLz7lC9QTNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q3YvK0WLv9huP1CEkewaiB5ZFt49gLJHVgmzrC/kwutHV5yVMmWQFmu7Dkf86hpGd 3/55yZlICgv7njLxR13x59Virm7zDbc8wjKxxgZTid1A2zQ0XzNhcCJZtF9ydKsaha ealn/M2ks+YRoHDo+E4L3H0N5Y9dpVBGajwl8NlI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Sven Peter , William Wu Subject: [PATCH 5.19 046/207] usb: dwc3: core: leave default DMA if the controller does not support 64-bit DMA Date: Mon, 26 Sep 2022 12:10:35 +0200 Message-Id: <20220926100808.673256315@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: William Wu commit 91062e663b261815573ce00967b1895a99e668df upstream. On some DWC3 controllers (e.g. Rockchip SoCs), the DWC3 core doesn't support 64-bit DMA address width. In this case, this driver should use the default 32-bit mask. Otherwise, the DWC3 controller will break if it runs on above 4GB physical memory environment. This patch reads the DWC_USB3_AWIDTH bits of GHWPARAMS0 which used for the DMA address width, and only configure 64-bit DMA mask if the DWC_USB3_AWIDTH is 64. Fixes: 45d39448b4d0 ("usb: dwc3: support 64 bit DMA in platform driver") Cc: stable Reviewed-by: Sven Peter Signed-off-by: William Wu Link: https://lore.kernel.org/r/20220901083446.3799754-1-william.wu@rock-ch= ips.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/usb/dwc3/core.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1718,12 +1718,6 @@ static int dwc3_probe(struct platform_de =20 dwc3_get_properties(dwc); =20 - if (!dwc->sysdev_is_parent) { - ret =3D dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(64)); - if (ret) - return ret; - } - dwc->reset =3D devm_reset_control_array_get_optional_shared(dev); if (IS_ERR(dwc->reset)) return PTR_ERR(dwc->reset); @@ -1789,6 +1783,13 @@ static int dwc3_probe(struct platform_de platform_set_drvdata(pdev, dwc); dwc3_cache_hwparams(dwc); =20 + if (!dwc->sysdev_is_parent && + DWC3_GHWPARAMS0_AWIDTH(dwc->hwparams.hwparams0) =3D=3D 64) { + ret =3D dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(64)); + if (ret) + goto disable_clks; + } + spin_lock_init(&dwc->lock); mutex_init(&dwc->mutex); From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C51A6C32771 for ; Mon, 26 Sep 2022 11:36:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238097AbiIZLgH (ORCPT ); Mon, 26 Sep 2022 07:36:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238259AbiIZLec (ORCPT ); Mon, 26 Sep 2022 07:34: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 B9AB254CA1; Mon, 26 Sep 2022 03:43:37 -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 6F92760B6A; Mon, 26 Sep 2022 10:43:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C4FFC433D7; Mon, 26 Sep 2022 10:43:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189016; bh=O9SJA4ghkAux3cvtpQ0yAtf9EdNN19N+uoX2sLICkTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GsX4KT+jMDdAjl3nT03djd0YVGdYZVY/G9am7DbzouXipsG7+oNHeulCs1suJI546 YnJ5dIkBlHAWsHa65bmuee+WRrVNjUZGcyHWuC7OZ2pYwa6LbxPIr626ylxHifqVv1 jwVZ9mCtXfUhCp+JI3FPlue+Fv+NEbzfEciU3ABc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gil Fine , Mika Westerberg Subject: [PATCH 5.19 047/207] thunderbolt: Add support for Intel Maple Ridge single port controller Date: Mon, 26 Sep 2022 12:10:36 +0200 Message-Id: <20220926100808.724222167@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gil Fine commit 14c7d905283744809e6b82efae2f490660a11cda upstream. Add support for Maple Ridge discrete USB4 host controller from Intel which has a single USB4 port (versus the already supported dual port Maple Ridge USB4 host controller). Cc: stable@vger.kernel.org Signed-off-by: Gil Fine Signed-off-by: Mika Westerberg Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/thunderbolt/icm.c | 1 + drivers/thunderbolt/nhi.h | 1 + 2 files changed, 2 insertions(+) --- a/drivers/thunderbolt/icm.c +++ b/drivers/thunderbolt/icm.c @@ -2527,6 +2527,7 @@ struct tb *icm_probe(struct tb_nhi *nhi) tb->cm_ops =3D &icm_icl_ops; break; =20 + case PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_2C_NHI: case PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_4C_NHI: icm->is_supported =3D icm_tgl_is_supported; icm->get_mode =3D icm_ar_get_mode; --- a/drivers/thunderbolt/nhi.h +++ b/drivers/thunderbolt/nhi.h @@ -55,6 +55,7 @@ extern const struct tb_nhi_ops icl_nhi_o * need for the PCI quirk anymore as we will use ICM also on Apple * hardware. */ +#define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_2C_NHI 0x1134 #define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_4C_NHI 0x1137 #define PCI_DEVICE_ID_INTEL_WIN_RIDGE_2C_NHI 0x157d #define PCI_DEVICE_ID_INTEL_WIN_RIDGE_2C_BRIDGE 0x157e From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0EFDC32771 for ; Mon, 26 Sep 2022 11:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238151AbiIZLgx (ORCPT ); Mon, 26 Sep 2022 07:36:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236179AbiIZLe5 (ORCPT ); Mon, 26 Sep 2022 07:34: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 861256E8B6; Mon, 26 Sep 2022 03:43:44 -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 9699E60A52; Mon, 26 Sep 2022 10:43:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70195C433C1; Mon, 26 Sep 2022 10:43:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189020; bh=jrvdF3Rauso5cJYEO2kOLy1/uCOL4ml8bo9/7BiKQnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eKsVhY6Qj9uEnc3wgqAkeQbVYuK/5f0WETvkuF/njyHLh/Cn68js+PBq1EEdKMLIk TZszqdBzqxEu47sPTXtWAFVnpx7pymTr2YbYBqD0JngcqUMqLpvQ2TAhigZpFY+EQ1 A/UE9jXJtbYQK2hwGHAB/ZHGS/HsDpM6c67jlkck= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , "Jason A. Donenfeld" Subject: [PATCH 5.19 048/207] efi: x86: Wipe setup_data on pure EFI boot Date: Mon, 26 Sep 2022 12:10:37 +0200 Message-Id: <20220926100808.760413331@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel commit 63bf28ceb3ebbe76048c3fb2987996ca1ae64f83 upstream. When booting the x86 kernel via EFI using the LoadImage/StartImage boot services [as opposed to the deprecated EFI handover protocol], the setup header is taken from the image directly, and given that EFI's LoadImage has no Linux/x86 specific knowledge regarding struct bootparams or struct setup_header, any absolute addresses in the setup header must originate from the file and not from a prior loading stage. Since we cannot generally predict where LoadImage() decides to load an image (*), such absolute addresses must be treated as suspect: even if a prior boot stage intended to make them point somewhere inside the [signed] image, there is no way to validate that, and if they point at an arbitrary location in memory, the setup_data nodes will not be covered by any signatures or TPM measurements either, and could be made to contain an arbitrary sequence of SETUP_xxx nodes, which could interfere quite badly with the early x86 boot sequence. (*) Note that, while LoadImage() does take a buffer/size tuple in addition to a device path, which can be used to provide the image contents directly, it will re-allocate such images, as the memory footprint of an image is generally larger than the PE/COFF file representation. Cc: # v5.10+ Link: https://lore.kernel.org/all/20220904165321.1140894-1-Jason@zx2c4.com/ Signed-off-by: Ard Biesheuvel Acked-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/firmware/efi/libstub/x86-stub.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/firmware/efi/libstub/x86-stub.c +++ b/drivers/firmware/efi/libstub/x86-stub.c @@ -517,6 +517,13 @@ efi_status_t __efiapi efi_pe_entry(efi_h hdr->ramdisk_image =3D 0; hdr->ramdisk_size =3D 0; =20 + /* + * Disregard any setup data that was provided by the bootloader: + * setup_data could be pointing anywhere, and we have no way of + * authenticating or validating the payload. + */ + hdr->setup_data =3D 0; + efi_stub_entry(handle, sys_table_arg, boot_params); /* not reached */ From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3313C32771 for ; Mon, 26 Sep 2022 11:41:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236329AbiIZLl2 (ORCPT ); Mon, 26 Sep 2022 07:41:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238349AbiIZLk4 (ORCPT ); Mon, 26 Sep 2022 07:40:56 -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 151CF550B5; Mon, 26 Sep 2022 03:45:18 -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 98B47B802C5; Mon, 26 Sep 2022 10:43:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AA36C433C1; Mon, 26 Sep 2022 10:43:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189023; bh=Qts+mTwxPMEZO9kijhoy/64pFEzmYfB6q0q5Kwgo2VU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=abSjpDQBtPheaP6QS0JwlvVbgpPuEe65ie2X8wXnvD2ODds83cdf0818jfjbMZvQp 44/MkyptpR5/nsMUcBhvRAaEO8Rth3nsbFhVpip0a4Qi0di9LGWyhXrKZ5Kz3tqq/s kD2n0vV8FnQU+g2mDA9EVarhuZxL4JrFvUusnNBk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , Ilias Apalodimas , Peter Jones Subject: [PATCH 5.19 049/207] efi: libstub: check Shim mode using MokSBStateRT Date: Mon, 26 Sep 2022 12:10:38 +0200 Message-Id: <20220926100808.810093249@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel commit 5f56a74cc0a6d9b9f8ba89cea29cd7c4774cb2b1 upstream. We currently check the MokSBState variable to decide whether we should treat UEFI secure boot as being disabled, even if the firmware thinks otherwise. This is used by shim to indicate that it is not checking signatures on boot images. In the kernel, we use this to relax lockdown policies. However, in cases where shim is not even being used, we don't want this variable to interfere with lockdown, given that the variable may be non-volatile and therefore persist across a reboot. This means setting it once will persistently disable lockdown checks on a given system. So switch to the mirrored version of this variable, called MokSBStateRT, which is supposed to be volatile, and this is something we can check. Cc: # v4.19+ Signed-off-by: Ard Biesheuvel Reviewed-by: Ilias Apalodimas Reviewed-by: Peter Jones Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/firmware/efi/libstub/secureboot.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/firmware/efi/libstub/secureboot.c +++ b/drivers/firmware/efi/libstub/secureboot.c @@ -14,7 +14,7 @@ =20 /* SHIM variables */ static const efi_guid_t shim_guid =3D EFI_SHIM_LOCK_GUID; -static const efi_char16_t shim_MokSBState_name[] =3D L"MokSBState"; +static const efi_char16_t shim_MokSBState_name[] =3D L"MokSBStateRT"; =20 static efi_status_t get_var(efi_char16_t *name, efi_guid_t *vendor, u32 *a= ttr, unsigned long *data_size, void *data) @@ -43,8 +43,8 @@ enum efi_secureboot_mode efi_get_secureb =20 /* * See if a user has put the shim into insecure mode. If so, and if the - * variable doesn't have the runtime attribute set, we might as well - * honor that. + * variable doesn't have the non-volatile attribute set, we might as + * well honor that. */ size =3D sizeof(moksbstate); status =3D get_efi_var(shim_MokSBState_name, &shim_guid, @@ -53,7 +53,7 @@ enum efi_secureboot_mode efi_get_secureb /* If it fails, we don't care why. Default to secure */ if (status !=3D EFI_SUCCESS) goto secure_boot_enabled; - if (!(attr & EFI_VARIABLE_RUNTIME_ACCESS) && moksbstate =3D=3D 1) + if (!(attr & EFI_VARIABLE_NON_VOLATILE) && moksbstate =3D=3D 1) return efi_secureboot_mode_disabled; =20 secure_boot_enabled: From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95FDAC32771 for ; Mon, 26 Sep 2022 11:37:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235089AbiIZLhO (ORCPT ); Mon, 26 Sep 2022 07:37:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238081AbiIZLft (ORCPT ); Mon, 26 Sep 2022 07:35:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 338646EF04; Mon, 26 Sep 2022 03:43:50 -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 81BD2B8095B; Mon, 26 Sep 2022 10:43:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4C83C433C1; Mon, 26 Sep 2022 10:43:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189029; bh=hbX0O4j5USK+7RKpbhjOSEOCaH0sBE6gjVM88scBssA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ru6Os3WQv+crTxS24IqmSwkuYbSEWls9F+cu75VkBzcWo/+Rbv9HDHwzv8KFYRIkO bP9udvc7Ni6U9I9Bp2pBLc8rNU6UlHB8wkKKL3rmJx6ffrAfu+YPT2RJRsQhD8YxWJ onzWpy9gjX1EPRX7oW2a95GSCo95TWe3jjsD4L+o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Fietkau , Kalle Valo Subject: [PATCH 5.19 050/207] wifi: mt76: fix reading current per-tid starting sequence number for aggregation Date: Mon, 26 Sep 2022 12:10:39 +0200 Message-Id: <20220926100808.862244223@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Felix Fietkau commit c3a510e2b53785df31d882a773c4c0780b4c825f upstream. The code was accidentally shifting register values down by tid % 32 instead= of (tid * field_size) % 32. Cc: stable@vger.kernel.org Fixes: a28bef561a5c ("mt76: mt7615: re-enable offloading of sequence number= assignment") Signed-off-by: Felix Fietkau Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220826182329.18155-1-nbd@nbd.name Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -1138,7 +1138,7 @@ u32 mt7615_mac_get_sta_tid_sn(struct mt7 offset %=3D 32; =20 val =3D mt76_rr(dev, addr); - val >>=3D (tid % 32); + val >>=3D offset; =20 if (offset > 20) { addr +=3D 4; From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9002DC32771 for ; Mon, 26 Sep 2022 11:57:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238924AbiIZL46 (ORCPT ); Mon, 26 Sep 2022 07:56:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238998AbiIZLyP (ORCPT ); Mon, 26 Sep 2022 07:54:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 999A058083; Mon, 26 Sep 2022 03:50:07 -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 7D418B8094E; Mon, 26 Sep 2022 10:43:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2A1BC433D6; Mon, 26 Sep 2022 10:43:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189032; bh=rFFd39b08CJ6QS5q+IzM2CHll7mwEFUDzEmip5CHelw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pypL8grXo0T2u/pw5Hc8vMmE9ig2KTs3uc0Q1Nh1qtE+uXn9sjFDP3HboR2voh4C1 XxJXJaDydHalqDC5ZGLfRcqpCxOcpcWIbMq0vKIXqY0VlyjKuoQZabWfwNZDLEdRgp v7D1PssWwMw4MWCGZ2WBDnov6/b7Nn5ObA/1GWdM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wei Yongjun , Bartosz Golaszewski Subject: [PATCH 5.19 051/207] gpio: mockup: fix NULL pointer dereference when removing debugfs Date: Mon, 26 Sep 2022 12:10:40 +0200 Message-Id: <20220926100808.907992147@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski commit b7df41a6f79dfb18ba2203f8c5f0e9c0b9b57f68 upstream. We now remove the device's debugfs entries when unbinding the driver. This now causes a NULL-pointer dereference on module exit because the platform devices are unregistered *after* the global debugfs directory has been recursively removed. Fix it by unregistering the devices first. Fixes: 303e6da99429 ("gpio: mockup: remove gpio debugfs when remove device") Cc: Wei Yongjun Cc: stable@vger.kernel.org Signed-off-by: Bartosz Golaszewski Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpio/gpio-mockup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpio/gpio-mockup.c +++ b/drivers/gpio/gpio-mockup.c @@ -597,9 +597,9 @@ static int __init gpio_mockup_init(void) =20 static void __exit gpio_mockup_exit(void) { + gpio_mockup_unregister_pdevs(); debugfs_remove_recursive(gpio_mockup_dbg_dir); platform_driver_unregister(&gpio_mockup_driver); - gpio_mockup_unregister_pdevs(); } =20 module_init(gpio_mockup_init); From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C381C32771 for ; Mon, 26 Sep 2022 11:37:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238174AbiIZLhW (ORCPT ); Mon, 26 Sep 2022 07:37:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238101AbiIZLgP (ORCPT ); Mon, 26 Sep 2022 07:36:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04B1EB494; Mon, 26 Sep 2022 03:44:01 -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 A2A69B8095D; Mon, 26 Sep 2022 10:43:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE6B2C433C1; Mon, 26 Sep 2022 10:43:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189035; bh=FNlNUpO7zOVpbzBzSiXTkd1MoY2CKoYDpVut8xj5Jag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i/l1YqAhjNVDGRWH1sS9UtWHTfpxVbcZjhZa/mB+e8miEJ0NCppL+jlbBV/YemA7+ 2+sPo6//AmLY8foA9oT8N+Zj1Pz5X5ZVDbXwAAN5iDTzTqkZ5f5CVDnzg98+DQ+mjr M+UBaZT3lHEQJjxof6Ig99cb/kqkPVIusgB8wM6Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Bartosz Golaszewski Subject: [PATCH 5.19 052/207] gpio: mockup: Fix potential resource leakage when register a chip Date: Mon, 26 Sep 2022 12:10:41 +0200 Message-Id: <20220926100808.957917375@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andy Shevchenko commit 02743c4091ccfb246f5cdbbe3f44b152d5d12933 upstream. If creation of software node fails, the locally allocated string array is left unfreed. Free it on error path. Fixes: 6fda593f3082 ("gpio: mockup: Convert to use software nodes") Cc: stable@vger.kernel.org Signed-off-by: Andy Shevchenko Signed-off-by: Bartosz Golaszewski Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpio/gpio-mockup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/gpio/gpio-mockup.c +++ b/drivers/gpio/gpio-mockup.c @@ -533,8 +533,10 @@ static int __init gpio_mockup_register_c } =20 fwnode =3D fwnode_create_software_node(properties, NULL); - if (IS_ERR(fwnode)) + if (IS_ERR(fwnode)) { + kfree_strarray(line_names, ngpio); return PTR_ERR(fwnode); + } =20 pdevinfo.name =3D "gpio-mockup"; pdevinfo.id =3D idx; From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EAD7C32771 for ; Mon, 26 Sep 2022 11:38:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238113AbiIZLiA (ORCPT ); Mon, 26 Sep 2022 07:38:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238082AbiIZLhL (ORCPT ); Mon, 26 Sep 2022 07:37:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 998A81C11B; Mon, 26 Sep 2022 03:44:04 -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 C07E6B80972; Mon, 26 Sep 2022 10:43:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DFF8C433D6; Mon, 26 Sep 2022 10:43:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189038; bh=d2gwwyn7sUx/cFG3rWOZQeZ+/sihKRv0+wPHQx4XLZ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yXsjB/t8i7opbs2kAYSCMQmokifqYCptC4QpVohWH4zFmZg0g2aatGYi2Zfk0zPVm r4RbJ4BmFI3ecT+xRzu/YfBkWQU1FZEw9oPUTd+/LlFiZFmbR7jdlfzq3SMxSP42aj JY5qWpOXpee9AKIRHoL4ddCFq5LThdwKZjCSpAUo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Li , Kent Gibson , Bartosz Golaszewski Subject: [PATCH 5.19 053/207] gpiolib: cdev: Set lineevent_state::irq after IRQ register successfully Date: Mon, 26 Sep 2022 12:10:42 +0200 Message-Id: <20220926100808.996403154@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Meng Li commit 69bef19d6b9700e96285f4b4e28691cda3dcd0d1 upstream. When running gpio test on nxp-ls1028 platform with below command gpiomon --num-events=3D3 --rising-edge gpiochip1 25 There will be a warning trace as below: Call trace: free_irq+0x204/0x360 lineevent_free+0x64/0x70 gpio_ioctl+0x598/0x6a0 __arm64_sys_ioctl+0xb4/0x100 invoke_syscall+0x5c/0x130 ...... el0t_64_sync+0x1a0/0x1a4 The reason of this issue is that calling request_threaded_irq() function failed, and then lineevent_free() is invoked to release the resource. Since the lineevent_state::irq was already set, so the subsequent invocation of free_irq() would trigger the above warning call trace. To fix this issue, set the lineevent_state::irq after the IRQ register successfully. Fixes: 468242724143 ("gpiolib: cdev: refactor lineevent cleanup into lineev= ent_free") Cc: stable@vger.kernel.org Signed-off-by: Meng Li Reviewed-by: Kent Gibson Signed-off-by: Bartosz Golaszewski Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpio/gpiolib-cdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/gpio/gpiolib-cdev.c +++ b/drivers/gpio/gpiolib-cdev.c @@ -1975,7 +1975,6 @@ static int lineevent_create(struct gpio_ ret =3D -ENODEV; goto out_free_le; } - le->irq =3D irq; =20 if (eflags & GPIOEVENT_REQUEST_RISING_EDGE) irqflags |=3D test_bit(FLAG_ACTIVE_LOW, &desc->flags) ? @@ -1989,7 +1988,7 @@ static int lineevent_create(struct gpio_ init_waitqueue_head(&le->wait); =20 /* Request a thread to read the events */ - ret =3D request_threaded_irq(le->irq, + ret =3D request_threaded_irq(irq, lineevent_irq_handler, lineevent_irq_thread, irqflags, @@ -1998,6 +1997,8 @@ static int lineevent_create(struct gpio_ if (ret) goto out_free_le; =20 + le->irq =3D irq; + fd =3D get_unused_fd_flags(O_RDONLY | O_CLOEXEC); if (fd < 0) { ret =3D fd; From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F894C6FA83 for ; Mon, 26 Sep 2022 11:41:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238410AbiIZLls (ORCPT ); Mon, 26 Sep 2022 07:41:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238293AbiIZLk6 (ORCPT ); Mon, 26 Sep 2022 07:40:58 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F8154D268; Mon, 26 Sep 2022 03:45:21 -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 sin.source.kernel.org (Postfix) with ESMTPS id 8C69BCE1101; Mon, 26 Sep 2022 10:44:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26D39C433D6; Mon, 26 Sep 2022 10:44:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189042; bh=4OhIFTaTvw+Ay+oPVwGCPzJwcA7iAszt7mvg8/EjYfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wjSi6Q2T2Fg8kG5knXz8Ee7PD3txm6c6IZsEBSRHtT0y0Tgt9jx5gU9foYO7y+XOC aYIG8AqdC4YLL61Ru43epFm0AnP347hbSKaoNhwfuVNMOGKpNhTRakSVeCOaxIMsCi Vpiyf3BAec9JLBIy517fX+3RspT30cMcAXEwrtOw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , Palmer Dabbelt Subject: [PATCH 5.19 054/207] riscv: fix a nasty sigreturn bug... Date: Mon, 26 Sep 2022 12:10:43 +0200 Message-Id: <20220926100809.036039036@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Al Viro commit 762df359aa5849e010ef04c3ed79d57588ce17d9 upstream. riscv has an equivalent of arm bug fixed by 653d48b22166 ("arm: fix really nasty sigreturn bug"); if signal gets caught by an interrupt that hits when we have the right value in a0 (-513), *and* another signal gets delivered upon sigreturn() (e.g. included into the blocked mask for the first signal and posted while the handler had been running), the syscall restart logics will see regs->cause equal to EXC_SYSCALL (we are in a syscall, after all) and a0 already restored to its original value (-513, which happens to be -ERESTARTNOINTR) and assume that we need to apply the usual syscall restart logics. Signed-off-by: Al Viro Fixes: e2c0cdfba7f6 ("RISC-V: User-facing API") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/YxJEiSq%2FCGaL6Gm9@ZenIV/ Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/riscv/kernel/signal.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/riscv/kernel/signal.c +++ b/arch/riscv/kernel/signal.c @@ -124,6 +124,8 @@ SYSCALL_DEFINE0(rt_sigreturn) if (restore_altstack(&frame->uc.uc_stack)) goto badframe; =20 + regs->cause =3D -1UL; + return regs->a0; =20 badframe: From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44631C07E9D for ; Mon, 26 Sep 2022 12:06:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239293AbiIZMGr (ORCPT ); Mon, 26 Sep 2022 08:06:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239045AbiIZMDW (ORCPT ); Mon, 26 Sep 2022 08:03:22 -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 478A87CAB9; Mon, 26 Sep 2022 03:54:02 -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 8AE7660AF0; Mon, 26 Sep 2022 10:44:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B956C433B5; Mon, 26 Sep 2022 10:44:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189045; bh=jN9KKvCki6cYrlMLOPZxNTrmQsWhVjW4jDwmuoUfl0A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=08owrhqOvZbvTS4RLUknuDt+uTBikGb1CD/kksxfUXE4eBx6tIpKGWsblzdmQW9Wb wcfdnkWuSX6Sd/B64bKiCvH7+k7Yx+e5b5vfepxHEjfUXqLC6/bAbjAJe6bOSQU1Kq LgCLszLmuSZjVkAF048l9PXxuo8ieAjwaUStxNMM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Heiko Stuebner , Palmer Dabbelt Subject: [PATCH 5.19 055/207] riscv: fix RISCV_ISA_SVPBMT kconfig dependency warning Date: Mon, 26 Sep 2022 12:10:44 +0200 Message-Id: <20220926100809.082416166@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Randy Dunlap commit 225e47ea20ea4f37031131f4fa7a6c281fac6657 upstream. RISCV_ISA_SVPBMT selects RISCV_ALTERNATIVE which depends on !XIP_KERNEL. Therefore RISCV_ISA_SVPBMT should also depend on !XIP_KERNEL so quieten this kconfig warning: WARNING: unmet direct dependencies detected for RISCV_ALTERNATIVE Depends on [n]: !XIP_KERNEL [=3Dy] Selected by [y]: - RISCV_ISA_SVPBMT [=3Dy] && 64BIT [=3Dy] && MMU [=3Dy] Fixes: ff689fd21cb1 ("riscv: add RISC-V Svpbmt extension support") Signed-off-by: Randy Dunlap Cc: stable@vger.kernel.org Reviewed-by: Heiko Stuebner Link: https://lore.kernel.org/r/20220709014929.14221-1-rdunlap@infradead.or= g/ Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/riscv/Kconfig | 1 + 1 file changed, 1 insertion(+) --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -361,6 +361,7 @@ config RISCV_ISA_C config RISCV_ISA_SVPBMT bool "SVPBMT extension support" depends on 64BIT && MMU + depends on !XIP_KERNEL select RISCV_ALTERNATIVE default y help From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDA1AC07E9D for ; Mon, 26 Sep 2022 11:41:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238249AbiIZLlP (ORCPT ); Mon, 26 Sep 2022 07:41:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238213AbiIZLkr (ORCPT ); Mon, 26 Sep 2022 07:40:47 -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 0EB8754CAB; Mon, 26 Sep 2022 03:45:16 -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 A695760B4A; Mon, 26 Sep 2022 10:44:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA022C433D6; Mon, 26 Sep 2022 10:44:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189048; bh=7JnsuAXEvBceyJsJFdQODT+KhmgkDfvrhwdZoOUtVDw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iUOOOqZhldmHl1SXzNHmLVUn2jhpB5MoiIqFM5nwDMu6KlWgbEkZTagGIEPHeEtIy EMrUeySG5A+weh2B9yTEu300cQUTaWMwS3QoGkVgB2Wf3HYWgsBxBbTQOtrOgX2Wg7 2Lpx88awrJkuwTRXiz7Vf67bw/SSGZb/5BjQMVMM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Wilson , Janusz Krzysztofik , Andi Shyti , Rodrigo Vivi , stable@kernel.org Subject: [PATCH 5.19 056/207] drm/i915/gem: Flush contexts on driver release Date: Mon, 26 Sep 2022 12:10:45 +0200 Message-Id: <20220926100809.117685854@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Janusz Krzysztofik commit 5ce8f7444f8fbb5adee644590c0e4e1890ab004c upstream. Due to i915_perf assuming that it can use the i915_gem_context reference to protect its i915->gem.contexts.list iteration, we need to defer removal of the context from the list until last reference to the context is put. However, there is a risk of triggering kernel warning on contexts list not empty at driver release time if we deleagate that task to a worker for i915_gem_context_release_work(), unless that work is flushed first. Unfortunately, it is not flushed on driver release. Fix it. Instead of additionally calling flush_workqueue(), either directly or via a new dedicated wrapper around it, replace last call to i915_gem_drain_freed_objects() with existing i915_gem_drain_workqueue() that performs both tasks. Fixes: 75eefd82581f ("drm/i915: Release i915_gem_context from a worker") Suggested-by: Chris Wilson Signed-off-by: Janusz Krzysztofik Reviewed-by: Andi Shyti Cc: stable@kernel.org # v5.16+ Signed-off-by: Andi Shyti Link: https://patchwork.freedesktop.org/patch/msgid/20220916092403.201355-2= -janusz.krzysztofik@linux.intel.com (cherry picked from commit 1cec34442408a77ba5396b19725fed2c398005c3) Signed-off-by: Rodrigo Vivi Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/i915/i915_gem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1191,7 +1191,8 @@ void i915_gem_driver_release(struct drm_ =20 intel_uc_cleanup_firmwares(&to_gt(dev_priv)->uc); =20 - i915_gem_drain_freed_objects(dev_priv); + /* Flush any outstanding work, including i915_gem_context.release_work. */ + i915_gem_drain_workqueue(dev_priv); =20 drm_WARN_ON(&dev_priv->drm, !list_empty(&dev_priv->gem.contexts.list)); } From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14471C32771 for ; Mon, 26 Sep 2022 11:38:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238014AbiIZLi3 (ORCPT ); Mon, 26 Sep 2022 07:38:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236400AbiIZLhp (ORCPT ); Mon, 26 Sep 2022 07:37:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B54416EF1C; Mon, 26 Sep 2022 03:44:15 -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 6885CB80976; Mon, 26 Sep 2022 10:44:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A75BAC433C1; Mon, 26 Sep 2022 10:44:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189051; bh=YJBYjcC2WRnCGvMzno/Zx1BeXA5cT/QGzX6nrE2Afjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HHlaLs1DiuXAcZbuGKiaBp3dOd6Mpkwd0K6VcomYHs6KYv4Nr3iBmA87VustPscNm MJuYEJ1AA1ex1FxuTZ6NJS7yV3G262uYBpGkkRnt4xB9l3hTqOmtyPxpnQC78OJm5u xhOZMZTm7ll370O3OIhlJMWls2gFo176+TJfn8NE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Janes , Chris Wilson , Andi Shyti , Janusz Krzysztofik , Tvrtko Ursulin , Rodrigo Vivi Subject: [PATCH 5.19 057/207] drm/i915/gem: Really move i915_gem_context.link under ref protection Date: Mon, 26 Sep 2022 12:10:46 +0200 Message-Id: <20220926100809.164998197@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chris Wilson commit d119888b09bd567e07c6b93a07f175df88857e02 upstream. i915_perf assumes that it can use the i915_gem_context reference to protect its i915->gem.contexts.list iteration. However, this requires that we do not remove the context from the list until after we drop the final reference and release the struct. If, as currently, we remove the context from the list during context_close(), the link.next pointer may be poisoned while we are holding the context reference and cause a GPF: [ 4070.573157] i915 0000:00:02.0: [drm:i915_perf_open_ioctl [i915]] filteri= ng on ctx_id=3D0x1fffff ctx_id_mask=3D0x1fffff [ 4070.574881] general protection fault, probably for non-canonical address= 0xdead000000000100: 0000 [#1] PREEMPT SMP [ 4070.574897] CPU: 1 PID: 284392 Comm: amd_performance Tainted: G = E 5.17.9 #180 [ 4070.574903] Hardware name: Intel Corporation NUC7i5BNK/NUC7i5BNB, BIOS B= NKBL357.86A.0052.2017.0918.1346 09/18/2017 [ 4070.574907] RIP: 0010:oa_configure_all_contexts.isra.0+0x222/0x350 [i915] [ 4070.574982] Code: 08 e8 32 6e 10 e1 4d 8b 6d 50 b8 ff ff ff ff 49 83 ed = 50 f0 41 0f c1 04 24 83 f8 01 0f 84 e3 00 00 00 85 c0 0f 8e fa 00 00 00 <49= > 8b 45 50 48 8d 70 b0 49 8d 45 50 48 39 44 24 10 0f 85 34 fe ff [ 4070.574990] RSP: 0018:ffffc90002077b78 EFLAGS: 00010202 [ 4070.574995] RAX: 0000000000000002 RBX: 0000000000000002 RCX: 00000000000= 00000 [ 4070.575000] RDX: 0000000000000001 RSI: ffffc90002077b20 RDI: ffff88810dd= c7c68 [ 4070.575004] RBP: 0000000000000001 R08: ffff888103242648 R09: fffffffffff= ffffc [ 4070.575008] R10: ffffffff82c50bc0 R11: 0000000000025c80 R12: ffff888101b= f1860 [ 4070.575012] R13: dead0000000000b0 R14: ffffc90002077c04 R15: ffff88810be= 5cabc [ 4070.575016] FS: 00007f1ed50c0780(0000) GS:ffff88885ec80000(0000) knlGS:= 0000000000000000 [ 4070.575021] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 4070.575025] CR2: 00007f1ed5590280 CR3: 000000010ef6f005 CR4: 00000000003= 706e0 [ 4070.575029] Call Trace: [ 4070.575033] [ 4070.575037] lrc_configure_all_contexts+0x13e/0x150 [i915] [ 4070.575103] gen8_enable_metric_set+0x4d/0x90 [i915] [ 4070.575164] i915_perf_open_ioctl+0xbc0/0x1500 [i915] [ 4070.575224] ? asm_common_interrupt+0x1e/0x40 [ 4070.575232] ? i915_oa_init_reg_state+0x110/0x110 [i915] [ 4070.575290] drm_ioctl_kernel+0x85/0x110 [ 4070.575296] ? update_load_avg+0x5f/0x5e0 [ 4070.575302] drm_ioctl+0x1d3/0x370 [ 4070.575307] ? i915_oa_init_reg_state+0x110/0x110 [i915] [ 4070.575382] ? gen8_gt_irq_handler+0x46/0x130 [i915] [ 4070.575445] __x64_sys_ioctl+0x3c4/0x8d0 [ 4070.575451] ? __do_softirq+0xaa/0x1d2 [ 4070.575456] do_syscall_64+0x35/0x80 [ 4070.575461] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 4070.575467] RIP: 0033:0x7f1ed5c10397 [ 4070.575471] Code: 3c 1c e8 1c ff ff ff 85 c0 79 87 49 c7 c4 ff ff ff ff = 5b 5d 4c 89 e0 41 5c c3 66 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48= > 3d 01 f0 ff ff 73 01 c3 48 8b 0d a9 da 0d 00 f7 d8 64 89 01 48 [ 4070.575478] RSP: 002b:00007ffd65c8d7a8 EFLAGS: 00000246 ORIG_RAX: 000000= 0000000010 [ 4070.575484] RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 00007f1ed5c= 10397 [ 4070.575488] RDX: 00007ffd65c8d7c0 RSI: 0000000040106476 RDI: 00000000000= 00006 [ 4070.575492] RBP: 00005620972f9c60 R08: 000000000000000a R09: 00000000000= 00005 [ 4070.575496] R10: 000000000000000d R11: 0000000000000246 R12: 00000000000= 0000a [ 4070.575500] R13: 000000000000000d R14: 0000000000000000 R15: 00007ffd65c= 8d7c0 [ 4070.575505] [ 4070.575507] Modules linked in: nls_ascii(E) nls_cp437(E) vfat(E) fat(E) = i915(E) x86_pkg_temp_thermal(E) intel_powerclamp(E) crct10dif_pclmul(E) crc= 32_pclmul(E) crc32c_intel(E) aesni_intel(E) crypto_simd(E) intel_gtt(E) cry= ptd(E) ttm(E) rapl(E) intel_cstate(E) drm_kms_helper(E) cfbfillrect(E) sysc= opyarea(E) cfbimgblt(E) intel_uncore(E) sysfillrect(E) mei_me(E) sysimgblt(= E) i2c_i801(E) fb_sys_fops(E) mei(E) intel_pch_thermal(E) i2c_smbus(E) cfbc= opyarea(E) video(E) button(E) efivarfs(E) autofs4(E) [ 4070.575549] ---[ end trace 0000000000000000 ]--- v3: fix incorrect syntax of spin_lock() replacing spin_lock_irqsave() v2: irqsave not required in a worker, neither conversion to irq safe elsewhere (Tvrtko), - perf: it's safe to call gen8_configure_context() even if context has been closed, no need to check, - drop unrelated cleanup (Andi, Tvrtko) Reported-by: Mark Janes Closes: https://gitlab.freedesktop.org/drm/intel/issues/6222 Fixes: f8246cf4d9a9 ("drm/i915/gem: Drop free_work for GEM contexts") Signed-off-by: Chris Wilson Reviewed-by: Andi Shyti Signed-off-by: Janusz Krzysztofik Cc: Tvrtko Ursulin Cc: # v5.12+ Signed-off-by: Andi Shyti Link: https://patchwork.freedesktop.org/patch/msgid/20220916092403.201355-3= -janusz.krzysztofik@linux.intel.com (cherry picked from commit ad3aa7c31efa5a09b0dba42e66cfdf77e0db7dc2) Signed-off-by: Rodrigo Vivi Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/i915/gem/i915_gem_context.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c @@ -1269,6 +1269,10 @@ static void i915_gem_context_release_wor trace_i915_context_free(ctx); GEM_BUG_ON(!i915_gem_context_is_closed(ctx)); =20 + spin_lock(&ctx->i915->gem.contexts.lock); + list_del(&ctx->link); + spin_unlock(&ctx->i915->gem.contexts.lock); + if (ctx->syncobj) drm_syncobj_put(ctx->syncobj); =20 @@ -1514,10 +1518,6 @@ static void context_close(struct i915_ge =20 ctx->file_priv =3D ERR_PTR(-EBADF); =20 - spin_lock(&ctx->i915->gem.contexts.lock); - list_del(&ctx->link); - spin_unlock(&ctx->i915->gem.contexts.lock); - client =3D ctx->client; if (client) { spin_lock(&client->ctx_lock); From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD00BC6FA83 for ; Mon, 26 Sep 2022 11:40:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238254AbiIZLku (ORCPT ); Mon, 26 Sep 2022 07:40:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238241AbiIZLkP (ORCPT ); Mon, 26 Sep 2022 07:40:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3A2B43622; Mon, 26 Sep 2022 03:45:09 -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 ECECCB80977; Mon, 26 Sep 2022 10:44:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27C07C433D6; Mon, 26 Sep 2022 10:44:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189054; bh=3cnKQViAsr59QOz45cel/NeBAZU0KF9t1dv9+BKZaow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cSw+2tGhR23fKIH5Y6Qz7sltUe2K7mwFPHV98fye5IS7N6h2YVRFql4BQeWuksSoE 4ZdLC76X0DZiOTBNQUzwXdv8ENWmmfjjJNHvic3Dg7QcqGH2ZFsGJmIahXhR0RvQC/ 2pvzRjv7uU4LepUkyADbXvdrURWH1+okLknL9tGI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sander Eikelenboom , Juergen Gross , Jan Beulich , Oleksandr Tyshchenko Subject: [PATCH 5.19 058/207] xen/xenbus: fix xenbus_setup_ring() Date: Mon, 26 Sep 2022 12:10:47 +0200 Message-Id: <20220926100809.208451245@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Juergen Gross commit ce6b8ccdef959ba86b2711e090e84a987a000bf7 upstream. Commit 4573240f0764 ("xen/xenbus: eliminate xenbus_grant_ring()") introduced an error for initialization of multi-page rings. Cc: stable@vger.kernel.org Fixes: 4573240f0764 ("xen/xenbus: eliminate xenbus_grant_ring()") Reported-by: Sander Eikelenboom Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich Reviewed-by: Oleksandr Tyshchenko Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/xen/xenbus/xenbus_client.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus= _client.c index d5f3f763717e..d4b251925796 100644 --- a/drivers/xen/xenbus/xenbus_client.c +++ b/drivers/xen/xenbus/xenbus_client.c @@ -382,9 +382,10 @@ int xenbus_setup_ring(struct xenbus_device *dev, gfp_t= gfp, void **vaddr, unsigned long ring_size =3D nr_pages * XEN_PAGE_SIZE; grant_ref_t gref_head; unsigned int i; + void *addr; int ret; =20 - *vaddr =3D alloc_pages_exact(ring_size, gfp | __GFP_ZERO); + addr =3D *vaddr =3D alloc_pages_exact(ring_size, gfp | __GFP_ZERO); if (!*vaddr) { ret =3D -ENOMEM; goto err; @@ -401,13 +402,15 @@ int xenbus_setup_ring(struct xenbus_device *dev, gfp_= t gfp, void **vaddr, unsigned long gfn; =20 if (is_vmalloc_addr(*vaddr)) - gfn =3D pfn_to_gfn(vmalloc_to_pfn(vaddr[i])); + gfn =3D pfn_to_gfn(vmalloc_to_pfn(addr)); else - gfn =3D virt_to_gfn(vaddr[i]); + gfn =3D virt_to_gfn(addr); =20 grefs[i] =3D gnttab_claim_grant_reference(&gref_head); gnttab_grant_foreign_access_ref(grefs[i], dev->otherend_id, gfn, 0); + + addr +=3D XEN_PAGE_SIZE; } =20 return 0; --=20 2.37.3 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA8E4C32771 for ; Mon, 26 Sep 2022 11:57:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238521AbiIZL5l (ORCPT ); Mon, 26 Sep 2022 07:57:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239208AbiIZLyv (ORCPT ); Mon, 26 Sep 2022 07:54:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D53D877EAB; Mon, 26 Sep 2022 03:50:21 -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 5F4B360A55; Mon, 26 Sep 2022 10:44:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51BF6C433D6; Mon, 26 Sep 2022 10:44:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189057; bh=nDbKPYGv0WWIC0OECH+w6mx4S1VD3cKtTgv94nJ/WmA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mj9hKwcpn5688w6VqDuSsGdEPIxjeBBREbWp17NaAj6SnEXjRd/gK5xRdwPheX+Ll K0bxVVykpRp8a3bITvIMilhdni7iI+LCm0YHR+0hVgqZdT7tglaEaC0BEVoor0eKhY CN4azfgQ24FbyEFzemjWmU7NHtbCBXbg3u/+BdK8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Collingbourne , Vlastimil Babka Subject: [PATCH 5.19 059/207] kasan: call kasan_malloc() from __kmalloc_*track_caller() Date: Mon, 26 Sep 2022 12:10:48 +0200 Message-Id: <20220926100809.246523707@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Collingbourne commit 5373b8a09d6e037ee0587cb5d9fe4cc09077deeb upstream. We were failing to call kasan_malloc() from __kmalloc_*track_caller() which was causing us to sometimes fail to produce KASAN error reports for allocations made using e.g. devm_kcalloc(), as the KASAN poison was not being initialized. Fix it. Signed-off-by: Peter Collingbourne Cc: # 5.15 Signed-off-by: Vlastimil Babka Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- mm/slub.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/mm/slub.c +++ b/mm/slub.c @@ -4950,6 +4950,8 @@ void *__kmalloc_track_caller(size_t size /* Honor the call site pointer we received. */ trace_kmalloc(caller, ret, size, s->size, gfpflags); =20 + ret =3D kasan_kmalloc(s, ret, size, gfpflags); + return ret; } EXPORT_SYMBOL(__kmalloc_track_caller); @@ -4981,6 +4983,8 @@ void *__kmalloc_node_track_caller(size_t /* Honor the call site pointer we received. */ trace_kmalloc_node(caller, ret, size, s->size, gfpflags, node); =20 + ret =3D kasan_kmalloc(s, ret, size, gfpflags); + return ret; } EXPORT_SYMBOL(__kmalloc_node_track_caller); From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D67CC07E9D for ; Mon, 26 Sep 2022 11:42:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238420AbiIZLmD (ORCPT ); Mon, 26 Sep 2022 07:42:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237925AbiIZLlK (ORCPT ); Mon, 26 Sep 2022 07:41:10 -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 B5E076F562; Mon, 26 Sep 2022 03:45: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 dfw.source.kernel.org (Postfix) with ESMTPS id B258860B60; Mon, 26 Sep 2022 10:44:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0873C433D6; Mon, 26 Sep 2022 10:44:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189064; bh=si0seKvv98k5bMX+1E90yQcsN2cXUqLrbUsACStHoD8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yfpevmzsNbHb+BZoe9YFElxipzfJ6Nee4aUtSmonCq93eawYF7ymoPeeZ6nc7vKU2 pedxQkfxfM0WjcTMassqHBcfeHyzwzbtuTXtdNGI4dxH3mZCMc0g5szi8VWmsmpepD KxAtT244dSgVyRzdXh6gcqGOhK7kBdCQuhwb0LAc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Thorsten Scherer , Marc Kleine-Budde Subject: [PATCH 5.19 060/207] can: flexcan: flexcan_mailbox_read() fix return value for drop = true Date: Mon, 26 Sep 2022 12:10:49 +0200 Message-Id: <20220926100809.290756560@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marc Kleine-Budde commit a09721dd47c8468b3f2fdd73f40422699ffe26dd upstream. The following happened on an i.MX25 using flexcan with many packets on the bus: The rx-offload queue reached a length more than skb_queue_len_max. In can_rx_offload_offload_one() the drop variable was set to true which made the call to .mailbox_read() (here: flexcan_mailbox_read()) to _always_ return ERR_PTR(-ENOBUFS) and drop the rx'ed CAN frame. So can_rx_offload_offload_one() returned ERR_PTR(-ENOBUFS), too. can_rx_offload_irq_offload_fifo() looks as follows: | while (1) { | skb =3D can_rx_offload_offload_one(offload, 0); | if (IS_ERR(skb)) | continue; | if (!skb) | break; | ... | } The flexcan driver wrongly always returns ERR_PTR(-ENOBUFS) if drop is requested, even if there is no CAN frame pending. As the i.MX25 is a single core CPU, while the rx-offload processing is active, there is no thread to process packets from the offload queue. So the queue doesn't get any shorter and this results is a tight loop. Instead of always returning ERR_PTR(-ENOBUFS) if drop is requested, return NULL if no CAN frame is pending. Changes since v1: https://lore.kernel.org/all/20220810144536.389237-1-u.kle= ine-koenig@pengutronix.de - don't break in can_rx_offload_irq_offload_fifo() in case of an error, return NULL in flexcan_mailbox_read() in case of no pending CAN frame instead Fixes: 4e9c9484b085 ("can: rx-offload: Prepare for CAN FD support") Link: https://lore.kernel.org/all/20220811094254.1864367-1-mkl@pengutronix.= de Cc: stable@vger.kernel.org # v5.5 Suggested-by: Uwe Kleine-K=C3=B6nig Reviewed-by: Uwe Kleine-K=C3=B6nig Tested-by: Thorsten Scherer Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/can/flexcan/flexcan-core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/net/can/flexcan/flexcan-core.c +++ b/drivers/net/can/flexcan/flexcan-core.c @@ -941,11 +941,6 @@ static struct sk_buff *flexcan_mailbox_r u32 reg_ctrl, reg_id, reg_iflag1; int i; =20 - if (unlikely(drop)) { - skb =3D ERR_PTR(-ENOBUFS); - goto mark_as_read; - } - mb =3D flexcan_get_mb(priv, n); =20 if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_RX_MAILBOX) { @@ -974,6 +969,11 @@ static struct sk_buff *flexcan_mailbox_r reg_ctrl =3D priv->read(&mb->can_ctrl); } =20 + if (unlikely(drop)) { + skb =3D ERR_PTR(-ENOBUFS); + goto mark_as_read; + } + if (reg_ctrl & FLEXCAN_MB_CNT_EDL) skb =3D alloc_canfd_skb(offload->dev, &cfd); else From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D000C32771 for ; Mon, 26 Sep 2022 11:41:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238302AbiIZLlo (ORCPT ); Mon, 26 Sep 2022 07:41:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238287AbiIZLk6 (ORCPT ); Mon, 26 Sep 2022 07:40:58 -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 76FC84D80C; Mon, 26 Sep 2022 03:45:29 -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 AE98160BA5; Mon, 26 Sep 2022 10:44:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF1E7C433C1; Mon, 26 Sep 2022 10:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189067; bh=EbzNcFdyCzwHoRdRE4DsMCPjZPvGEdjHYWMP72mW22s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wYF5CPE5k+Flt8TuIRHmjzCqKoiGzRB8tfTFDKMVt7/haKfYgqqckT8ASySbIrZE3 Sr4RifuvUDXQY54xD+1sUz8PPaKSsBkEvnkzWJzcCzs4QHJ3f8s1nNngdiiUlCdrJg xgCGzykcONUaAFZ08UK2AAZ3jCSgR6x8E1V4f8ZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sinan Kaya , Haiyang Zhang , Dexuan Cui , Jakub Kicinski Subject: [PATCH 5.19 061/207] net: mana: Add rmb after checking owner bits Date: Mon, 26 Sep 2022 12:10:50 +0200 Message-Id: <20220926100809.340503618@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Haiyang Zhang commit 6fd2c68da55c552f86e401ebe40c4a619025ef69 upstream. Per GDMA spec, rmb is necessary after checking owner_bits, before reading EQ or CQ entries. Add rmb in these two places to comply with the specs. Cc: stable@vger.kernel.org Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network A= dapter (MANA)") Reported-by: Sinan Kaya Signed-off-by: Haiyang Zhang Reviewed-by: Dexuan Cui Link: https://lore.kernel.org/r/1662928805-15861-1-git-send-email-haiyangz@= microsoft.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/microsoft/mana/gdma_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c @@ -370,6 +370,11 @@ static void mana_gd_process_eq_events(vo break; } =20 + /* Per GDMA spec, rmb is necessary after checking owner_bits, before + * reading eqe. + */ + rmb(); + mana_gd_process_eqe(eq); =20 eq->head++; @@ -1107,6 +1112,11 @@ static int mana_gd_read_cqe(struct gdma_ if (WARN_ON_ONCE(owner_bits !=3D new_bits)) return -1; =20 + /* Per GDMA spec, rmb is necessary after checking owner_bits, before + * reading completion info + */ + rmb(); + comp->wq_num =3D cqe->cqe_info.wq_num; comp->is_sq =3D cqe->cqe_info.is_sq; memcpy(comp->cqe_data, cqe->cqe_data, GDMA_COMP_DATA_SIZE); From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB08CC32771 for ; Mon, 26 Sep 2022 11:43:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238369AbiIZLnH (ORCPT ); Mon, 26 Sep 2022 07:43:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238285AbiIZLmV (ORCPT ); Mon, 26 Sep 2022 07:42:21 -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 1A0B271736; Mon, 26 Sep 2022 03:45:46 -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 D554F60BAA; Mon, 26 Sep 2022 10:44:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF0ECC433C1; Mon, 26 Sep 2022 10:44:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189070; bh=eOChhNzF/2ujg/vJSP6nXkufiXzX4HbcSRXtcrw7yTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YKV2f5ohDtkZbcO1fITXrmK2l/zzlMk/p0aME8Bf2LBHJ8CUNQF5J7/s/r1kixLlD CG9rTnj+gbtLRmT7CQZBo+siZo2TOJDQzBqr1LQkjj/QqG5FODIYc5gmnTzmj0P1eM KqPOpKXh/Cei5GovIAbiTMM678haLX8hqdq3m+Xo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, syzbot+81684812ea68216e08c5@syzkaller.appspotmail.com, Muchun Song , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Chao Yu , David Rientjes , Vlastimil Babka Subject: [PATCH 5.19 062/207] mm/slub: fix to return errno if kmalloc() fails Date: Mon, 26 Sep 2022 12:10:51 +0200 Message-Id: <20220926100809.379448705@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chao Yu commit 7e9c323c52b379d261a72dc7bd38120a761a93cd upstream. In create_unique_id(), kmalloc(, GFP_KERNEL) can fail due to out-of-memory, if it fails, return errno correctly rather than triggering panic via BUG_ON(); kernel BUG at mm/slub.c:5893! Internal error: Oops - BUG: 0 [#1] PREEMPT SMP Call trace: sysfs_slab_add+0x258/0x260 mm/slub.c:5973 __kmem_cache_create+0x60/0x118 mm/slub.c:4899 create_cache mm/slab_common.c:229 [inline] kmem_cache_create_usercopy+0x19c/0x31c mm/slab_common.c:335 kmem_cache_create+0x1c/0x28 mm/slab_common.c:390 f2fs_kmem_cache_create fs/f2fs/f2fs.h:2766 [inline] f2fs_init_xattr_caches+0x78/0xb4 fs/f2fs/xattr.c:808 f2fs_fill_super+0x1050/0x1e0c fs/f2fs/super.c:4149 mount_bdev+0x1b8/0x210 fs/super.c:1400 f2fs_mount+0x44/0x58 fs/f2fs/super.c:4512 legacy_get_tree+0x30/0x74 fs/fs_context.c:610 vfs_get_tree+0x40/0x140 fs/super.c:1530 do_new_mount+0x1dc/0x4e4 fs/namespace.c:3040 path_mount+0x358/0x914 fs/namespace.c:3370 do_mount fs/namespace.c:3383 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount fs/namespace.c:3568 [inline] __arm64_sys_mount+0x2f8/0x408 fs/namespace.c:3568 Cc: Fixes: 81819f0fc8285 ("SLUB core") Reported-by: syzbot+81684812ea68216e08c5@syzkaller.appspotmail.com Reviewed-by: Muchun Song Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Chao Yu Acked-by: David Rientjes Signed-off-by: Vlastimil Babka Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- mm/slub.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/mm/slub.c +++ b/mm/slub.c @@ -5918,7 +5918,8 @@ static char *create_unique_id(struct kme char *name =3D kmalloc(ID_STR_LENGTH, GFP_KERNEL); char *p =3D name; =20 - BUG_ON(!name); + if (!name) + return ERR_PTR(-ENOMEM); =20 *p++ =3D ':'; /* @@ -5976,6 +5977,8 @@ static int sysfs_slab_add(struct kmem_ca * for the symlinks. */ name =3D create_unique_id(s); + if (IS_ERR(name)) + return PTR_ERR(name); } =20 s->kobj.kset =3D kset; From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B477C07E9D for ; Mon, 26 Sep 2022 11:39:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238183AbiIZLjj (ORCPT ); Mon, 26 Sep 2022 07:39:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238126AbiIZLi0 (ORCPT ); Mon, 26 Sep 2022 07:38: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 4FDF064E3; Mon, 26 Sep 2022 03:44:34 -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 E736A609FE; Mon, 26 Sep 2022 10:44:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCC57C433D6; Mon, 26 Sep 2022 10:44:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189073; bh=p3yoFLi99e3+F/7o9uOqp564XMz3GKSsA4oWUGGl+S4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PcixREsgg9YD4y/h2rerDR95JFTY1W02V36bgEsf7ZEZDZ8I/WMqvpJnDHwAMyWav RZ/p2UONvyMIcfNhmdy0nTRHwcnIB3Rx/Uwj6IqA9V0AMxMw+GG1Ecn7QNveA4bMdm 3hMWuj5JCMVbfcTbPyqHCiXKqdx8hxNo1CJVxZ18= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maurizio Lombardi , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Vlastimil Babka Subject: [PATCH 5.19 063/207] mm: slub: fix flush_cpu_slab()/__free_slab() invocations in task context. Date: Mon, 26 Sep 2022 12:10:52 +0200 Message-Id: <20220926100809.425679005@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maurizio Lombardi commit e45cc288724f0cfd497bb5920bcfa60caa335729 upstream. Commit 5a836bf6b09f ("mm: slub: move flush_cpu_slab() invocations __free_slab() invocations out of IRQ context") moved all flush_cpu_slab() invocations to the global workqueue to avoid a problem related with deactivate_slab()/__free_slab() being called from an IRQ context on PREEMPT_RT kernels. When the flush_all_cpu_locked() function is called from a task context it may happen that a workqueue with WQ_MEM_RECLAIM bit set ends up flushing the global workqueue, this will cause a dependency issue. workqueue: WQ_MEM_RECLAIM nvme-delete-wq:nvme_delete_ctrl_work [nvme_core] is flushing !WQ_MEM_RECLAIM events:flush_cpu_slab WARNING: CPU: 37 PID: 410 at kernel/workqueue.c:2637 check_flush_dependency+0x10a/0x120 Workqueue: nvme-delete-wq nvme_delete_ctrl_work [nvme_core] RIP: 0010:check_flush_dependency+0x10a/0x120[ 453.262125] Call Trace: __flush_work.isra.0+0xbf/0x220 ? __queue_work+0x1dc/0x420 flush_all_cpus_locked+0xfb/0x120 __kmem_cache_shutdown+0x2b/0x320 kmem_cache_destroy+0x49/0x100 bioset_exit+0x143/0x190 blk_release_queue+0xb9/0x100 kobject_cleanup+0x37/0x130 nvme_fc_ctrl_free+0xc6/0x150 [nvme_fc] nvme_free_ctrl+0x1ac/0x2b0 [nvme_core] Fix this bug by creating a workqueue for the flush operation with the WQ_MEM_RECLAIM bit set. Fixes: 5a836bf6b09f ("mm: slub: move flush_cpu_slab() invocations __free_sl= ab() invocations out of IRQ context") Cc: Signed-off-by: Maurizio Lombardi Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Vlastimil Babka Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- mm/slub.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/mm/slub.c +++ b/mm/slub.c @@ -310,6 +310,11 @@ static inline void stat(const struct kme */ static nodemask_t slab_nodes; =20 +/* + * Workqueue used for flush_cpu_slab(). + */ +static struct workqueue_struct *flushwq; + /******************************************************************** * Core slab cache functions *******************************************************************/ @@ -2730,7 +2735,7 @@ static void flush_all_cpus_locked(struct INIT_WORK(&sfw->work, flush_cpu_slab); sfw->skip =3D false; sfw->s =3D s; - schedule_work_on(cpu, &sfw->work); + queue_work_on(cpu, flushwq, &sfw->work); } =20 for_each_online_cpu(cpu) { @@ -4880,6 +4885,8 @@ void __init kmem_cache_init(void) =20 void __init kmem_cache_init_late(void) { + flushwq =3D alloc_workqueue("slub_flushwq", WQ_MEM_RECLAIM, 0); + WARN_ON(!flushwq); } =20 struct kmem_cache * From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE67AC6FA83 for ; Mon, 26 Sep 2022 11:47:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234907AbiIZLrX (ORCPT ); Mon, 26 Sep 2022 07:47:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238673AbiIZLoT (ORCPT ); Mon, 26 Sep 2022 07:44:19 -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 8354372FF4; Mon, 26 Sep 2022 03:46:39 -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 F3B5D6091B; Mon, 26 Sep 2022 10:46:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3DAEC433D6; Mon, 26 Sep 2022 10:46:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189198; bh=ug9Ge9ICIjyQ5FTTGPTaKvIClq9/OIhcNwJxA9pxu+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zECb0Hu1ItCpbcpso7LWpSB56Rz5OV5cpYqcDuBTg6+QfEuvwfmr6cOs6SNBQ0qnY W7y0HKQdsnddMWmamtna9+/DWoeUGwy3aO9wjqJ7vm7jb1tl9VEkO1TPaIDBA9lzjs dXse07AU4eHrimd1UftNRH60gvQRysQcnNfolBj0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leonardo Bras , Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.19 064/207] KVM: x86: Reinstate kvm_vcpu_arch.guest_supported_xcr0 Date: Mon, 26 Sep 2022 12:10:53 +0200 Message-Id: <20220926100809.463971916@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit ee519b3a2ae3027c341bce829ee8c51f4f494f5b upstream. Reinstate the per-vCPU guest_supported_xcr0 by partially reverting commit 988896bb6182; the implicit assessment that guest_supported_xcr0 is always the same as guest_fpu.fpstate->user_xfeatures was incorrect. kvm_vcpu_after_set_cpuid() isn't the only place that sets user_xfeatures, as user_xfeatures is set to fpu_user_cfg.default_features when guest_fpu is allocated via fpu_alloc_guest_fpstate() =3D> __fpstate_reset(). guest_supported_xcr0 on the other hand is zero-allocated. If userspace never invokes KVM_SET_CPUID2, supported XCR0 will be '0', whereas the allowed user XFEATURES will be non-zero. Practically speaking, the edge case likely doesn't matter as no sane userspace will live migrate a VM without ever doing KVM_SET_CPUID2. The primary motivation is to prepare for KVM intentionally and explicitly setting bits in user_xfeatures that are not set in guest_supported_xcr0. Because KVM_{G,S}ET_XSAVE can be used to svae/restore FP+SSE state even if the host doesn't support XSAVE, KVM needs to set the FP+SSE bits in user_xfeatures even if they're not allowed in XCR0, e.g. because XCR0 isn't exposed to the guest. At that point, the simplest fix is to track the two things separately (allowed save/restore vs. allowed XCR0). Fixes: 988896bb6182 ("x86/kvm/fpu: Remove kvm_vcpu_arch.guest_supported_xcr= 0") Cc: stable@vger.kernel.org Cc: Leonardo Bras Signed-off-by: Sean Christopherson Message-Id: <20220824033057.3576315-2-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/cpuid.c | 5 ++--- arch/x86/kvm/x86.c | 9 ++------- 3 files changed, 5 insertions(+), 10 deletions(-) --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -713,6 +713,7 @@ struct kvm_vcpu_arch { struct fpu_guest guest_fpu; =20 u64 xcr0; + u64 guest_supported_xcr0; =20 struct kvm_pio_request pio; void *pio_data; --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -283,7 +283,6 @@ static void kvm_vcpu_after_set_cpuid(str { struct kvm_lapic *apic =3D vcpu->arch.apic; struct kvm_cpuid_entry2 *best; - u64 guest_supported_xcr0; =20 best =3D kvm_find_cpuid_entry(vcpu, 1, 0); if (best && apic) { @@ -295,10 +294,10 @@ static void kvm_vcpu_after_set_cpuid(str kvm_apic_set_version(vcpu); } =20 - guest_supported_xcr0 =3D + vcpu->arch.guest_supported_xcr0 =3D cpuid_get_supported_xcr0(vcpu->arch.cpuid_entries, vcpu->arch.cpuid_nent= ); =20 - vcpu->arch.guest_fpu.fpstate->user_xfeatures =3D guest_supported_xcr0; + vcpu->arch.guest_fpu.fpstate->user_xfeatures =3D vcpu->arch.guest_support= ed_xcr0; =20 kvm_update_pv_runtime(vcpu); =20 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1025,15 +1025,10 @@ void kvm_load_host_xsave_state(struct kv } EXPORT_SYMBOL_GPL(kvm_load_host_xsave_state); =20 -static inline u64 kvm_guest_supported_xcr0(struct kvm_vcpu *vcpu) -{ - return vcpu->arch.guest_fpu.fpstate->user_xfeatures; -} - #ifdef CONFIG_X86_64 static inline u64 kvm_guest_supported_xfd(struct kvm_vcpu *vcpu) { - return kvm_guest_supported_xcr0(vcpu) & XFEATURE_MASK_USER_DYNAMIC; + return vcpu->arch.guest_supported_xcr0 & XFEATURE_MASK_USER_DYNAMIC; } #endif =20 @@ -1056,7 +1051,7 @@ static int __kvm_set_xcr(struct kvm_vcpu * saving. However, xcr0 bit 0 is always set, even if the * emulated CPU does not support XSAVE (see kvm_vcpu_reset()). */ - valid_bits =3D kvm_guest_supported_xcr0(vcpu) | XFEATURE_MASK_FP; + valid_bits =3D vcpu->arch.guest_supported_xcr0 | XFEATURE_MASK_FP; if (xcr0 & ~valid_bits) return 1; From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53ACAC07E9D for ; Mon, 26 Sep 2022 11:59:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239086AbiIZL7r (ORCPT ); Mon, 26 Sep 2022 07:59:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238242AbiIZL4F (ORCPT ); Mon, 26 Sep 2022 07:56:05 -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 195C879EE3; Mon, 26 Sep 2022 03:51: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 B768AB80942; Mon, 26 Sep 2022 10:44:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A2D8C433D7; Mon, 26 Sep 2022 10:44:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189097; bh=2uQhA0qYWotVtBUvYwcPC6h3qGMu2lnXzqUK+uwfSxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g6Vx4gZZlCMrzzzY2emeo7Yl6XK/gYGDGq3B62eoQPShMB1TihlmzDrHKGiuN6I8z dkS2+169X5Ds/hFLCGo3x+GrIptJnIRXoqhvNIKuT1vh1mJnjL7URIG/78FrUuY57K HtM79mFSw94FPS0seEvgFb5qNkkLLVVGE+WJf6qs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leonardo Bras , "Dr. David Alan Gilbert" , Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.19 065/207] KVM: x86: Always enable legacy FP/SSE in allowed user XFEATURES Date: Mon, 26 Sep 2022 12:10:54 +0200 Message-Id: <20220926100809.511013321@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dr. David Alan Gilbert commit a1020a25e69755a8a1a37735d674b91d6f02939f upstream. Allow FP and SSE state to be saved and restored via KVM_{G,SET}_XSAVE on XSAVE-capable hosts even if their bits are not exposed to the guest via XCR0. Failing to allow FP+SSE first showed up as a QEMU live migration failure, where migrating a VM from a pre-XSAVE host, e.g. Nehalem, to an XSAVE host failed due to KVM rejecting KVM_SET_XSAVE. However, the bug also causes problems even when migrating between XSAVE-capable hosts as KVM_GET_SAVE won't set any bits in user_xfeatures if XSAVE isn't exposed to the guest, i.e. KVM will fail to actually migrate FP+SSE. Because KVM_{G,S}ET_XSAVE are designed to allowing migrating between hosts with and without XSAVE, KVM_GET_XSAVE on a non-XSAVE (by way of fpu_copy_guest_fpstate_to_uabi()) always sets the FP+SSE bits in the header so that KVM_SET_XSAVE will work even if the new host supports XSAVE. Fixes: ad856280ddea ("x86/kvm/fpu: Limit guest user_xfeatures to supported = bits of XCR0") bz: https://bugzilla.redhat.com/show_bug.cgi?id=3D2079311 Cc: stable@vger.kernel.org Cc: Leonardo Bras Signed-off-by: Dr. David Alan Gilbert [sean: add comment, massage changelog] Signed-off-by: Sean Christopherson Message-Id: <20220824033057.3576315-3-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/x86/kvm/cpuid.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -297,7 +297,13 @@ static void kvm_vcpu_after_set_cpuid(str vcpu->arch.guest_supported_xcr0 =3D cpuid_get_supported_xcr0(vcpu->arch.cpuid_entries, vcpu->arch.cpuid_nent= ); =20 - vcpu->arch.guest_fpu.fpstate->user_xfeatures =3D vcpu->arch.guest_support= ed_xcr0; + /* + * FP+SSE can always be saved/restored via KVM_{G,S}ET_XSAVE, even if + * XSAVE/XCRO are not exposed to the guest, and even if XSAVE isn't + * supported by the host. + */ + vcpu->arch.guest_fpu.fpstate->user_xfeatures =3D vcpu->arch.guest_support= ed_xcr0 | + XFEATURE_MASK_FPSSE; =20 kvm_update_pv_runtime(vcpu); From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32AB2C07E9D for ; Mon, 26 Sep 2022 11:46:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238683AbiIZLqv (ORCPT ); Mon, 26 Sep 2022 07:46:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238570AbiIZLoC (ORCPT ); Mon, 26 Sep 2022 07:44:02 -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 8075172EDB; Mon, 26 Sep 2022 03:46: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 dfw.source.kernel.org (Postfix) with ESMTPS id 05A466091B; Mon, 26 Sep 2022 10:45:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB16BC433D6; Mon, 26 Sep 2022 10:45:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189131; bh=eT+R/HudLNEnpxDzp2iipG53Tg48r2UE4mc4cNcY5wM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mi3lY6wLJ4hiyt1sVKSLF8RjoHRpwwd+xjWaCWIvzEPBoh3iI90qe3B5jMWDyG6Vz MnSlpfoxh9ALgvXzFBxD9+xhGwot5LRqzUx5vuiEaxYfvQJxsjfSqF1PTxuoKYmDkg w6oYCa7oaDNolRSGwK0QzAhWVnS+VHBbCz6RJ0JU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vitaly Kuznetsov , Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.19 066/207] KVM: x86: Inject #UD on emulated XSETBV if XSAVES isnt enabled Date: Mon, 26 Sep 2022 12:10:55 +0200 Message-Id: <20220926100809.547576832@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit 50b2d49bafa16e6311ab2da82f5aafc5f9ada99b upstream. Inject #UD when emulating XSETBV if CR4.OSXSAVE is not set. This also covers the "XSAVE not supported" check, as setting CR4.OSXSAVE=3D1 #GPs if XSAVE is not supported (and userspace gets to keep the pieces if it forces incoherent vCPU state). Add a comment to kvm_emulate_xsetbv() to call out that the CPU checks CR4.OSXSAVE before checking for intercepts. AMD'S APM implies that #UD has priority (says that intercepts are checked before #GP exceptions), while Intel's SDM says nothing about interception priority. However, testing on hardware shows that both AMD and Intel CPUs prioritize the #UD over interception. Fixes: 02d4160fbd76 ("x86: KVM: add xsetbv to the emulator") Cc: stable@vger.kernel.org Cc: Vitaly Kuznetsov Signed-off-by: Sean Christopherson Message-Id: <20220824033057.3576315-4-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/x86/kvm/emulate.c | 3 +++ arch/x86/kvm/x86.c | 1 + 2 files changed, 4 insertions(+) --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -4134,6 +4134,9 @@ static int em_xsetbv(struct x86_emulate_ { u32 eax, ecx, edx; =20 + if (!(ctxt->ops->get_cr(ctxt, 4) & X86_CR4_OSXSAVE)) + return emulate_ud(ctxt); + eax =3D reg_read(ctxt, VCPU_REGS_RAX); edx =3D reg_read(ctxt, VCPU_REGS_RDX); ecx =3D reg_read(ctxt, VCPU_REGS_RCX); --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1079,6 +1079,7 @@ static int __kvm_set_xcr(struct kvm_vcpu =20 int kvm_emulate_xsetbv(struct kvm_vcpu *vcpu) { + /* Note, #UD due to CR4.OSXSAVE=3D0 has priority over the intercept. */ if (static_call(kvm_x86_get_cpl)(vcpu) !=3D 0 || __kvm_set_xcr(vcpu, kvm_rcx_read(vcpu), kvm_read_edx_eax(vcpu))) { kvm_inject_gp(vcpu, 0); From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4CF4C32771 for ; Mon, 26 Sep 2022 11:46:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238630AbiIZLqf (ORCPT ); Mon, 26 Sep 2022 07:46:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238520AbiIZLnl (ORCPT ); Mon, 26 Sep 2022 07:43:41 -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 12EE57286A; Mon, 26 Sep 2022 03:46: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 AC0E5B80925; Mon, 26 Sep 2022 10:46:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA312C433D6; Mon, 26 Sep 2022 10:46:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189165; bh=/8T1n28G2OkOlOq8doDkRAmA1DaEtWdSbd0oPGpyoF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CF+tl5w4EllW3z2N/SWrsbggyjWUtj0BbnCMF1Cv9bg4H/7mcPN9+RUVjJu3hgcoT /vrAbTfZ4U+aln9yGKck50R+Rkk1aQql3Qd9Z5qgO91ByIUm4VKP34kCp7KsjoXfVi VuBhKd/hboYhYHqFMJGumXapOMH+297gOYacvIuk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ilkka Koskinen , Robin Murphy , Will Deacon Subject: [PATCH 5.19 067/207] perf/arm-cmn: Add more bits to child node address offset field Date: Mon, 26 Sep 2022 12:10:56 +0200 Message-Id: <20220926100809.597544349@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ilkka Koskinen commit 05d6f6d346fea2fa4580a0c2b6be207456bebb08 upstream. CMN-600 uses bits [27:0] for child node address offset while bits [30:28] are required to be zero. For CMN-650, the child node address offset field has been increased to include bits [29:0] while leaving only bit 30 set to zero. Let's include the missing two bits and assume older implementations comply with the spec and set bits [29:28] to 0. Signed-off-by: Ilkka Koskinen Fixes: 60d1504070c2 ("perf/arm-cmn: Support new IP features") Reviewed-by: Robin Murphy Link: https://lore.kernel.org/r/20220808195455.79277-1-ilkka@os.amperecompu= ting.com Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/perf/arm-cmn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c index 80d8309652a4..b80a9b74662b 100644 --- a/drivers/perf/arm-cmn.c +++ b/drivers/perf/arm-cmn.c @@ -36,7 +36,7 @@ #define CMN_CI_CHILD_COUNT GENMASK_ULL(15, 0) #define CMN_CI_CHILD_PTR_OFFSET GENMASK_ULL(31, 16) =20 -#define CMN_CHILD_NODE_ADDR GENMASK(27, 0) +#define CMN_CHILD_NODE_ADDR GENMASK(29, 0) #define CMN_CHILD_NODE_EXTERNAL BIT(31) =20 #define CMN_MAX_DIMENSION 12 --=20 2.37.3 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90177C07E9D for ; Mon, 26 Sep 2022 11:47:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238721AbiIZLrI (ORCPT ); Mon, 26 Sep 2022 07:47:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238608AbiIZLoI (ORCPT ); Mon, 26 Sep 2022 07:44:08 -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 A9F4972B64; Mon, 26 Sep 2022 03:46: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 86360B80691; Mon, 26 Sep 2022 10:46:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5A99C433D6; Mon, 26 Sep 2022 10:46:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189180; bh=fqLtuLhz5QTIlo+A3IXwAHfAVSOavrA51A9oFc9hZAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sMgWkAI4YX9eJj7lEz07Uc3iivqV1G7Hkw9D9h9TDMesoVtJxkaY3ie0QrmUU/aP3 bkc6zl2/KHekLn4wAiC3sTOok0KnmT+eM8nFGAsgSXPPxraPrKKFiqDqHweq17jSXf rvmKDW4tDH4Rg85I7LZ8GBUXUGrQtbm7cwRVnojQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Will Deacon Subject: [PATCH 5.19 068/207] arm64: topology: fix possible overflow in amu_fie_setup() Date: Mon, 26 Sep 2022 12:10:57 +0200 Message-Id: <20220926100809.645226980@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sergey Shtylyov commit d4955c0ad77dbc684fc716387070ac24801b8bca upstream. cpufreq_get_hw_max_freq() returns max frequency in kHz as *unsigned int*, while freq_inv_set_max_ratio() gets passed this frequency in Hz as 'u64'. Multiplying max frequency by 1000 can potentially result in overflow -- multiplying by 1000ULL instead should avoid that... Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool. Fixes: cd0ed03a8903 ("arm64: use activity monitors for frequency invariance= ") Signed-off-by: Sergey Shtylyov Link: https://lore.kernel.org/r/01493d64-2bce-d968-86dc-11a122a9c07d@omp.ru Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/kernel/topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -251,7 +251,7 @@ static void amu_fie_setup(const struct c for_each_cpu(cpu, cpus) { if (!freq_counters_valid(cpu) || freq_inv_set_max_ratio(cpu, - cpufreq_get_hw_max_freq(cpu) * 1000, + cpufreq_get_hw_max_freq(cpu) * 1000ULL, arch_timer_get_rate())) return; } From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0124C07E9D for ; Mon, 26 Sep 2022 11:46:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238622AbiIZLqc (ORCPT ); Mon, 26 Sep 2022 07:46:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238480AbiIZLn3 (ORCPT ); Mon, 26 Sep 2022 07:43:29 -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 D664672B79; Mon, 26 Sep 2022 03:46:23 -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 9AC8760B4A; Mon, 26 Sep 2022 10:46:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE46EC433D6; Mon, 26 Sep 2022 10:46:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189183; bh=yoFcUTeYEhvPl4lSixwPxNGPlFeykb4pDJGSGYoKqQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t3KYgY1DFRmL4J35oz8NdKjrTiRhJEZiHiRNQHVuKI4+EZhdxHfNEy7aiov5hGXNN hILYVWVQbflo5m4M+rtSIU8qaALG2H6l1QSwrxeFNVvs4LQDyZxyrMSrzgGm2kHNWv xFT43pzW1fP/BlgGqr/yte9Wh9HprsjqF9C5rTi8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sami Tolvanen , Mark Rutland , "Mohan Rao .vanimina" , Kees Cook , Nathan Chancellor , Will Deacon Subject: [PATCH 5.19 069/207] vmlinux.lds.h: CFI: Reduce alignment of jump-table to function alignment Date: Mon, 26 Sep 2022 12:10:58 +0200 Message-Id: <20220926100809.691241282@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Will Deacon commit 13b0566962914e167cb3238fbe29ced618f07a27 upstream. Due to undocumented, hysterical raisins on x86, the CFI jump-table sections in .text are needlessly aligned to PMD_SIZE in the vmlinux linker script. When compiling a CFI-enabled arm64 kernel with a 64KiB page-size, a PMD maps 512MiB of virtual memory and so the .text section increases to a whopping 940MiB and blows the final Image up to 960MiB. Others report a link failure. Since the CFI jump-table requires only instruction alignment, reduce the alignment directives to function alignment for parity with other parts of the .text section. This reduces the size of the .text section for the aforementioned 64KiB page size arm64 kernel to 19MiB for a much more reasonable total Image size of 39MiB. Cc: Sami Tolvanen Cc: Mark Rutland Cc: "Mohan Rao .vanimina" Cc: Kees Cook Cc: Nathan Chancellor Cc: Link: https://lore.kernel.org/all/CAL_GTzigiNOMYkOPX1KDnagPhJtFNqSK=3D1USNb= S0wUL4PW6-Uw@mail.gmail.com/ Fixes: cf68fffb66d6 ("add support for Clang CFI") Reviewed-by: Mark Rutland Tested-by: Mark Rutland Reviewed-by: Sami Tolvanen Reviewed-by: Kees Cook Link: https://lore.kernel.org/r/20220922215715.13345-1-will@kernel.org Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- include/asm-generic/vmlinux.lds.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -543,10 +543,9 @@ */ #ifdef CONFIG_CFI_CLANG #define TEXT_CFI_JT \ - . =3D ALIGN(PMD_SIZE); \ + ALIGN_FUNCTION(); \ __cfi_jt_start =3D .; \ *(.text..L.cfi.jumptable .text..L.cfi.jumptable.*) \ - . =3D ALIGN(PMD_SIZE); \ __cfi_jt_end =3D .; #else #define TEXT_CFI_JT From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC699C32771 for ; Mon, 26 Sep 2022 11:46:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238691AbiIZLq4 (ORCPT ); Mon, 26 Sep 2022 07:46:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238568AbiIZLoC (ORCPT ); Mon, 26 Sep 2022 07:44:02 -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 0E03B72844; Mon, 26 Sep 2022 03:46: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 3D2B0B8085B; Mon, 26 Sep 2022 10:46:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97706C433C1; Mon, 26 Sep 2022 10:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189186; bh=UwzIwLl/LbNa756QIwWB/0/t/ekD+jEtKmOLe+CjEkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v25K6Bi+26tWMVllpmVpUcyYE3PymCUnTlPwjGSnwMfHiGcAYh/qwEI/bE+37K+Iv 4rQgEW5yTON5JoBQ6zchQInie4RkTtLa3wnLoPYzZisjapD3sQjc8Mk5BPVHzS5Hq3 1LELy/XbJUiqclHqGvX5IszLhA0/WIhU+kr4+F5M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shigeru Yoshida , Sven Eckelmann , Simon Wunderlich , Sasha Levin Subject: [PATCH 5.19 070/207] batman-adv: Fix hang up with small MTU hard-interface Date: Mon, 26 Sep 2022 12:10:59 +0200 Message-Id: <20220926100809.727360886@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shigeru Yoshida [ Upstream commit b1cb8a71f1eaec4eb77051590f7f561f25b15e32 ] The system hangs up when batman-adv soft-interface is created on hard-interface with small MTU. For example, the following commands create batman-adv soft-interface on dummy interface with zero MTU: # ip link add name dummy0 type dummy # ip link set mtu 0 dev dummy0 # ip link set up dev dummy0 # ip link add name bat0 type batadv # ip link set dev dummy0 master bat0 These commands cause the system hang up with the following messages: [ 90.578925][ T6689] batman_adv: bat0: Adding interface: dummy0 [ 90.580884][ T6689] batman_adv: bat0: The MTU of interface dummy0 is t= oo small (0) to handle the transport of batman-adv packets. Packets going o= ver this interface will be fragmented on layer2 which could impact the perf= ormance. Setting the MTU to 1560 would solve the problem. [ 90.586264][ T6689] batman_adv: bat0: Interface activated: dummy0 [ 90.590061][ T6689] batman_adv: bat0: Forced to purge local tt entries= to fit new maximum fragment MTU (-320) [ 90.595517][ T6689] batman_adv: bat0: Forced to purge local tt entries= to fit new maximum fragment MTU (-320) [ 90.598499][ T6689] batman_adv: bat0: Forced to purge local tt entries= to fit new maximum fragment MTU (-320) This patch fixes this issue by returning error when enabling hard-interface with small MTU size. Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol") Signed-off-by: Shigeru Yoshida Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- net/batman-adv/hard-interface.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interfac= e.c index b8f8da7ee3de..41c1ad33d009 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -700,6 +701,9 @@ int batadv_hardif_enable_interface(struct batadv_hard_i= face *hard_iface, int max_header_len =3D batadv_max_header_len(); int ret; =20 + if (hard_iface->net_dev->mtu < ETH_MIN_MTU + max_header_len) + return -EINVAL; + if (hard_iface->if_status !=3D BATADV_IF_NOT_IN_USE) goto out; =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE5AFC32771 for ; Mon, 26 Sep 2022 11:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236551AbiIZLrE (ORCPT ); Mon, 26 Sep 2022 07:47:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238593AbiIZLoG (ORCPT ); Mon, 26 Sep 2022 07:44:06 -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 B757B72EE5; Mon, 26 Sep 2022 03:46:29 -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 8A80C60B4A; Mon, 26 Sep 2022 10:46:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89234C433D6; Mon, 26 Sep 2022 10:46:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189189; bh=oHJrHC5swQbQx3rRPj9uqKWfZmoJftkitufj0CnE7hU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u8NCbVYG91ui20vQr2PP5099jwegd6AvStthRmuXdsACykrqxYd04yoeNhANxiGze nBZc4+c2XFZgO82fShGW1eB15Vf7dbC5z7jYgWClpsxgzeWi50BvWYitOrrbIWUN4Y 0PrbTO2YjsQMLKNGDg1G5P360zMFmqvc93xvGo90= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cristian Marussi , Sudeep Holla , Sasha Levin Subject: [PATCH 5.19 071/207] firmware: arm_scmi: Harden accesses to the reset domains Date: Mon, 26 Sep 2022 12:11:00 +0200 Message-Id: <20220926100809.774457281@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Cristian Marussi [ Upstream commit e9076ffbcaed5da6c182b144ef9f6e24554af268 ] Accessing reset domains descriptors by the index upon the SCMI drivers requests through the SCMI reset operations interface can potentially lead to out-of-bound violations if the SCMI driver misbehave. Add an internal consistency check before any such domains descriptors accesses. Link: https://lore.kernel.org/r/20220817172731.1185305-5-cristian.marussi@a= rm.com Signed-off-by: Cristian Marussi Signed-off-by: Sudeep Holla Stable-dep-of: b75c83d9b961 ("firmware: arm_scmi: Fix the asynchronous rese= t requests") Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/firmware/arm_scmi/reset.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/arm_scmi/reset.c b/drivers/firmware/arm_scmi/= reset.c index 673f3eb498f4..b0494165b1cb 100644 --- a/drivers/firmware/arm_scmi/reset.c +++ b/drivers/firmware/arm_scmi/reset.c @@ -166,8 +166,12 @@ static int scmi_domain_reset(const struct scmi_protoco= l_handle *ph, u32 domain, struct scmi_xfer *t; struct scmi_msg_reset_domain_reset *dom; struct scmi_reset_info *pi =3D ph->get_priv(ph); - struct reset_dom_info *rdom =3D pi->dom_info + domain; + struct reset_dom_info *rdom; =20 + if (domain >=3D pi->num_domains) + return -EINVAL; + + rdom =3D pi->dom_info + domain; if (rdom->async_reset) flags |=3D ASYNCHRONOUS_RESET; =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF8ACC32771 for ; Mon, 26 Sep 2022 11:47:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238707AbiIZLq7 (ORCPT ); Mon, 26 Sep 2022 07:46:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238581AbiIZLoE (ORCPT ); Mon, 26 Sep 2022 07:44:04 -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 D426472B5D; Mon, 26 Sep 2022 03:46:33 -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 54D90B802C5; Mon, 26 Sep 2022 10:46:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94D88C433D7; Mon, 26 Sep 2022 10:46:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189192; bh=+H+3e6MavXuunQEspWLbj9AiqmKe3ZMHaTE84jFSCDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EnCIi6URDlBnYO1VALuZUGVmWoe97NcCm1tt/yA4a6OE7wIwGhch9RTDZf1XJFH+B NXB5Ij6irR8d29jSDOVhg4Y8H+X/GRw1RE6TXFPnL6VdOHtReHI9/kZrP5QTO7/Y6D 1kkdf0+Oijd1VH5mRbfh7SOdgCdZJw1LVIq9NOpI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cristian Marussi , Sudeep Holla , Sasha Levin Subject: [PATCH 5.19 072/207] firmware: arm_scmi: Fix the asynchronous reset requests Date: Mon, 26 Sep 2022 12:11:01 +0200 Message-Id: <20220926100809.810922623@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Cristian Marussi [ Upstream commit b75c83d9b961fd3abf7310f8d36d5e6e9f573efb ] SCMI Reset protocol specification allows the asynchronous reset request only when an autonomous reset action is specified. Reset requests based on explicit assert/deassert of signals should not be served asynchronously. Current implementation will instead issue an asynchronous request in any case, as long as the reset domain had advertised to support asynchronous resets. Avoid requesting the asynchronous resets when the reset action is not of the autonomous type, even if the target reset domain does, in general, support the asynchronous requests. Link: https://lore.kernel.org/r/20220817172731.1185305-6-cristian.marussi@a= rm.com Fixes: 95a15d80aa0d ("firmware: arm_scmi: Add RESET protocol in SCMI v2.0") Signed-off-by: Cristian Marussi Signed-off-by: Sudeep Holla Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/firmware/arm_scmi/reset.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/arm_scmi/reset.c b/drivers/firmware/arm_scmi/= reset.c index b0494165b1cb..e9afa8cab730 100644 --- a/drivers/firmware/arm_scmi/reset.c +++ b/drivers/firmware/arm_scmi/reset.c @@ -172,7 +172,7 @@ static int scmi_domain_reset(const struct scmi_protocol= _handle *ph, u32 domain, return -EINVAL; =20 rdom =3D pi->dom_info + domain; - if (rdom->async_reset) + if (rdom->async_reset && flags & AUTONOMOUS_RESET) flags |=3D ASYNCHRONOUS_RESET; =20 ret =3D ph->xops->xfer_get_init(ph, RESET, sizeof(*dom), 0, &t); @@ -184,7 +184,7 @@ static int scmi_domain_reset(const struct scmi_protocol= _handle *ph, u32 domain, dom->flags =3D cpu_to_le32(flags); dom->reset_state =3D cpu_to_le32(state); =20 - if (rdom->async_reset) + if (flags & ASYNCHRONOUS_RESET) ret =3D ph->xops->do_xfer_with_response(ph, t); else ret =3D ph->xops->do_xfer(ph, t); --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B21F6C07E9D for ; Mon, 26 Sep 2022 11:47:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238764AbiIZLrS (ORCPT ); Mon, 26 Sep 2022 07:47:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238661AbiIZLoQ (ORCPT ); Mon, 26 Sep 2022 07:44:16 -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 2247072FE2; Mon, 26 Sep 2022 03:46:37 -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 75317B80171; Mon, 26 Sep 2022 10:46:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4E96C43144; Mon, 26 Sep 2022 10:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189195; bh=Fsd7zcjTX5P25rIZ9TJl7L+OkraK9f9sN9pCQjmwUU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eaPjkCBdbipL8ZXFWJnffsDJTfhSPIfD9Fn/pMazR3RUFb/CrB/NPJA0ZqnDDdzAO P4sY/z0c0lHW+yl0xlV1hPtuSiDTZn9Ay1z+jVtVDzBlNg3i39Xwy2PT9GatuSVcXi glgWb8H7KuiVL4YU7d/oJHrN4CA4EslR9cAiOBW0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Frattaroli , Peter Geis , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.19 073/207] arm64: dts: rockchip: Lower sd speed on quartz64-b Date: Mon, 26 Sep 2022 12:11:02 +0200 Message-Id: <20220926100809.856389118@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicolas Frattaroli [ Upstream commit 1ea90b2d293fd8b1f3377c9ed08364ff6f2a8562 ] The previously stated speed of sdr-104 is too high for the hardware to reliably communicate with some fast SD cards. Lower this to sd-uhs-sdr50 to fix this. Fixes: dcc8c66bef79 ("arm64: dts: rockchip: add Pine64 Quartz64-B device tr= ee") Signed-off-by: Nicolas Frattaroli Tested-by: Peter Geis Link: https://lore.kernel.org/r/20220721044307.48641-1-frattaroli.nicolas@g= mail.com Signed-off-by: Heiko Stuebner Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/boot/dts/rockchip/rk3566-quartz64-b.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3566-quartz64-b.dts b/arch/arm6= 4/boot/dts/rockchip/rk3566-quartz64-b.dts index 02d5f5a8ca03..528bb4e8ac77 100644 --- a/arch/arm64/boot/dts/rockchip/rk3566-quartz64-b.dts +++ b/arch/arm64/boot/dts/rockchip/rk3566-quartz64-b.dts @@ -506,7 +506,7 @@ &sdmmc0 { disable-wp; pinctrl-names =3D "default"; pinctrl-0 =3D <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; - sd-uhs-sdr104; + sd-uhs-sdr50; vmmc-supply =3D <&vcc3v3_sd>; vqmmc-supply =3D <&vccio_sd>; status =3D "okay"; --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7E69C6FA94 for ; Mon, 26 Sep 2022 11:59:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238933AbiIZL7N (ORCPT ); Mon, 26 Sep 2022 07:59:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239518AbiIZLzs (ORCPT ); Mon, 26 Sep 2022 07:55:48 -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 EFE6779A4D; Mon, 26 Sep 2022 03:51:10 -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 CCDD0B80930; Mon, 26 Sep 2022 10:45:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1441EC433D6; Mon, 26 Sep 2022 10:44:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189100; bh=dnupetVY1wWSgHC7l/1fb7zy0/8H3mjSL6UcT+AlakA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oZB91vBkEu5zekFXYT2cDZXYUwO0k2Zg4J+EtvOgzmtBeDcqGvQYhd6jtfllGW6dm DWk1sU3co7XTzNBBeyCIGOGboSs6Fv+PWLKvF9tEiL7dVPAwaIQ4X67gtve2b1vJs4 bBR/PNj6ilz2yF9ZsfLC9R/8hAUxJbbTwjb3mxoI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Douglas Anderson , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.19 074/207] arm64: dts: rockchip: Pull up wlan wake# on Gru-Bob Date: Mon, 26 Sep 2022 12:11:03 +0200 Message-Id: <20220926100809.894142591@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brian Norris [ Upstream commit e5467359a725de90b6b8d0dd865500f6373828ca ] The Gru-Bob board does not have a pull-up resistor on its WLAN_HOST_WAKE# pin, but Kevin does. The production/vendor kernel specified the pin configuration correctly as a pull-up, but this didn't get ported correctly to upstream. This means Bob's WLAN_HOST_WAKE# pin is floating, causing inconsistent wakeup behavior. Note that bt_host_wake_l has a similar dynamic, but apparently the upstream choice was to redundantly configure both internal and external pull-up on Kevin (see the "Kevin has an external pull up" comment in rk3399-gru.dtsi). This doesn't cause any functional problem, although it's perhaps wasteful. Fixes: 8559bbeeb849 ("arm64: dts: rockchip: add Google Bob") Signed-off-by: Brian Norris Reviewed-by: Douglas Anderson Link: https://lore.kernel.org/r/20220822164453.1.I75c57b48b0873766ec993bdfb= 7bc1e63da5a1637@changeid Signed-off-by: Heiko Stuebner Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts | 5 +++++ arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi | 1 + 2 files changed, 6 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts b/arch/arm64/b= oot/dts/rockchip/rk3399-gru-bob.dts index 31ebb4e5fd33..0f9cc042d9bf 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts +++ b/arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts @@ -88,3 +88,8 @@ h1_int_od_l: h1-int-od-l { }; }; }; + +&wlan_host_wake_l { + /* Kevin has an external pull up, but Bob does not. */ + rockchip,pins =3D <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>; +}; diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi b/arch= /arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi index 50d459ee4831..eed15fd61d62 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi @@ -578,6 +578,7 @@ wifi_perst_l: wifi-perst-l { }; =20 wlan_host_wake_l: wlan-host-wake-l { + /* Kevin has an external pull up, but Bob does not */ rockchip,pins =3D <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; }; }; --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6CD7C32771 for ; Mon, 26 Sep 2022 11:46:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238559AbiIZLqF (ORCPT ); Mon, 26 Sep 2022 07:46:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238460AbiIZLnS (ORCPT ); Mon, 26 Sep 2022 07:43:18 -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 2977B72861; Mon, 26 Sep 2022 03:46:15 -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 58C2A60C05; Mon, 26 Sep 2022 10:45:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CC64C433B5; Mon, 26 Sep 2022 10:45:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189103; bh=Bd4NT7bbB8cLbIQEupGQ5VfJHKOTc2fkz7gqkI6Rt4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cHt0CO0vvQvcWg2p4sP/Ye/xl5qY40dYoeVCBDn0eyJH4/ZbSJWne4vEGXxCTOJ4i 2TrKLaKSBoS0jguvugmdltLZ2ZYcLhI/IYLE0WMAOW1QqaPm7RNDm3kEgcEVZ3HWH+ ZxnqTyiex5b3hJYcGsOzWcjFdfu1TVVQhc4JUvCw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jagan Teki , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.19 075/207] arm64: dts: rockchip: Fix typo in lisense text for PX30.Core Date: Mon, 26 Sep 2022 12:11:04 +0200 Message-Id: <20220926100809.932747059@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jagan Teki [ Upstream commit 4a00c43818dcc19be97250d4c3c4a1e2f1ed4f9d ] Fix the Amarula Solutions typo mistake in lisense text added in Engicam PX30.Core SoM dtsi. Fixes: d92a7c331f53c ("arm64: dts: rockchip: Add Engicam PX30.Core SOM") Signed-off-by: Jagan Teki Link: https://lore.kernel.org/r/20220822103524.266731-1-jagan@amarulasoluti= ons.com Signed-off-by: Heiko Stuebner Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/boot/dts/rockchip/px30-engicam-px30-core.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/rockchip/px30-engicam-px30-core.dtsi b/arc= h/arm64/boot/dts/rockchip/px30-engicam-px30-core.dtsi index 7249871530ab..5eecbefa8a33 100644 --- a/arch/arm64/boot/dts/rockchip/px30-engicam-px30-core.dtsi +++ b/arch/arm64/boot/dts/rockchip/px30-engicam-px30-core.dtsi @@ -2,8 +2,8 @@ /* * Copyright (c) 2020 Fuzhou Rockchip Electronics Co., Ltd * Copyright (c) 2020 Engicam srl - * Copyright (c) 2020 Amarula Solutons - * Copyright (c) 2020 Amarula Solutons(India) + * Copyright (c) 2020 Amarula Solutions + * Copyright (c) 2020 Amarula Solutions(India) */ =20 #include --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC01AC07E9D for ; Mon, 26 Sep 2022 11:41:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238279AbiIZLlY (ORCPT ); Mon, 26 Sep 2022 07:41:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238343AbiIZLkz (ORCPT ); Mon, 26 Sep 2022 07:40:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C9A6422FB; Mon, 26 Sep 2022 03:45: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 ams.source.kernel.org (Postfix) with ESMTPS id 3F8DDB8068A; Mon, 26 Sep 2022 10:45:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77772C433C1; Mon, 26 Sep 2022 10:45:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189106; bh=XAqwW7kPk1fND/PQ5lZ7DIIBWIlLol6OGCEExEmjyZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wSOt49l9U8aTMtTbVI5fVvXwBdHBds+iqC07BEgiFLURgqaqJRrnD+pTSdDPdHxlr tG/Ktdj5zvHaiZULojHooUtn+ssN3xZE60ussU6392OLD3VjhE4Kp73h0a87EQjNDq 5RaQEOdOpUJGh3bJPAz9A+0KoZNV+QgDXOX710V0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Chen-Yu Tsai , "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 5.19 076/207] drm/mediatek: dsi: Add atomic {destroy,duplicate}_state, reset callbacks Date: Mon, 26 Sep 2022 12:11:05 +0200 Message-Id: <20220926100809.975360372@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: AngeloGioacchino Del Regno [ Upstream commit eeda05b5e92f51d9a09646ecb493f0a1e872a6ef ] Add callbacks for atomic_destroy_state, atomic_duplicate_state and atomic_reset to restore functionality of the DSI driver: this solves vblank timeouts when another bridge is present in the chain. Tested bridge chain: DSI <=3D> ANX7625 =3D> aux-bus panel Fixes: 7f6335c6a258 ("drm/mediatek: Modify dsi funcs to atomic operations") Signed-off-by: AngeloGioacchino Del Regno Tested-by: Chen-Yu Tsai Reviewed-by: N=C3=ADcolas F. R. A. Prado Tested-by: N=C3=ADcolas F. R. A. Prado Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20220721172= 727.14624-1-angelogioacchino.delregno@collabora.com/ Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/mediatek/mtk_dsi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/= mtk_dsi.c index af2f123e9a9a..e98b4aca2cb9 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -808,10 +808,13 @@ static void mtk_dsi_bridge_atomic_post_disable(struct= drm_bridge *bridge, =20 static const struct drm_bridge_funcs mtk_dsi_bridge_funcs =3D { .attach =3D mtk_dsi_bridge_attach, + .atomic_destroy_state =3D drm_atomic_helper_bridge_destroy_state, .atomic_disable =3D mtk_dsi_bridge_atomic_disable, + .atomic_duplicate_state =3D drm_atomic_helper_bridge_duplicate_state, .atomic_enable =3D mtk_dsi_bridge_atomic_enable, .atomic_pre_enable =3D mtk_dsi_bridge_atomic_pre_enable, .atomic_post_disable =3D mtk_dsi_bridge_atomic_post_disable, + .atomic_reset =3D drm_atomic_helper_bridge_reset, .mode_set =3D mtk_dsi_bridge_mode_set, }; =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0E60C32771 for ; Mon, 26 Sep 2022 11:43:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238481AbiIZLn3 (ORCPT ); Mon, 26 Sep 2022 07:43:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238307AbiIZLmZ (ORCPT ); Mon, 26 Sep 2022 07:42:25 -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 DE0AB72692; Mon, 26 Sep 2022 03:46:01 -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 918AF609FE; Mon, 26 Sep 2022 10:45:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 897FBC433D6; Mon, 26 Sep 2022 10:45:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189110; bh=A7t4uV2wOZ1LNnRMm6YGpL8nwXWxKD2W+rQwKzu+fQE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lBc+nEz65LAnTTr0GQQk3I1mJlOOZDGXMFC/pT9Qke1KZSUU8elxUrg3JewFigrZL X3pkR8uXc2O2Y5lbs7Zdn4rk6fbxRE6s/VG6XC6l718uQivN7jMffUG4VB7wHHBlgt LU/1MxLrCp76p3LxD0gMv83N1H9+420ve8/1bp/Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Vasut , Shawn Guo , Sasha Levin Subject: [PATCH 5.19 077/207] arm64: dts: imx8mm: Reverse CPLD_Dn GPIO label mapping on MX8Menlo Date: Mon, 26 Sep 2022 12:11:06 +0200 Message-Id: <20220926100810.023426281@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marek Vasut [ Upstream commit 8194a356226ce6f53e1d98b44c0436c583db89d2 ] The CPLD_Dn GPIO assignment between SoM and CPLD has now been clarified in schematic and the assignment is reversed. Update the DT to match the hardware. Fixes: 510c527b4ff57 ("arm64: dts: imx8mm: Add i.MX8M Mini Toradex Verdin b= ased Menlo board") Signed-off-by: Marek Vasut Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/boot/dts/freescale/imx8mm-mx8menlo.dts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/imx8mm-mx8menlo.dts b/arch/arm64= /boot/dts/freescale/imx8mm-mx8menlo.dts index 92eaf4ef4563..57ecdfa0dfc0 100644 --- a/arch/arm64/boot/dts/freescale/imx8mm-mx8menlo.dts +++ b/arch/arm64/boot/dts/freescale/imx8mm-mx8menlo.dts @@ -152,11 +152,11 @@ &gpio4 { * CPLD_reset is RESET_SOFT in schematic */ gpio-line-names =3D - "CPLD_D[1]", "CPLD_int", "CPLD_reset", "", - "", "CPLD_D[0]", "", "", - "", "", "", "CPLD_D[2]", - "CPLD_D[3]", "CPLD_D[4]", "CPLD_D[5]", "CPLD_D[6]", - "CPLD_D[7]", "", "", "", + "CPLD_D[6]", "CPLD_int", "CPLD_reset", "", + "", "CPLD_D[7]", "", "", + "", "", "", "CPLD_D[5]", + "CPLD_D[4]", "CPLD_D[3]", "CPLD_D[2]", "CPLD_D[1]", + "CPLD_D[0]", "", "", "", "", "", "", "", "", "", "", "KBD_intK", "", "", "", ""; --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98617C32771 for ; Mon, 26 Sep 2022 11:45:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238477AbiIZLp4 (ORCPT ); Mon, 26 Sep 2022 07:45:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238371AbiIZLnR (ORCPT ); Mon, 26 Sep 2022 07:43:17 -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 6B6A66F57F; Mon, 26 Sep 2022 03:46: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 ams.source.kernel.org (Postfix) with ESMTPS id 6B99AB8095D; Mon, 26 Sep 2022 10:45:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4111C433D6; Mon, 26 Sep 2022 10:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189113; bh=5vhpMlxTnDNWWgoNyMjjqdMNjJme4PLpALZjigsOd5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bnv3NlPuelfcy6mo4K0inuyalQUfRSSZcrx7DPpNylXfAHRZPO/9RpuekMIGAan/k Na33KIKDf6iYQujcBSgm7tz8or+gTLaMjx5mWzd0QiSMt/NjknwG+rQflfkoDR8Ib5 at3WTxmz9B4ItBfp5Zim1PbsTJuFXM542bt4xxnQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , zain wang , Brian Norris , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.19 078/207] arm64: dts: rockchip: Set RK3399-Gru PCLK_EDP to 24 MHz Date: Mon, 26 Sep 2022 12:11:07 +0200 Message-Id: <20220926100810.068830966@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: zain wang [ Upstream commit 8123437cf46ea5a0f6ca5cb3c528d8b6db97b9c2 ] We've found the AUX channel to be less reliable with PCLK_EDP at a higher rate (typically 25 MHz). This is especially important on systems with PSR-enabled panels (like Gru-Kevin), since we make heavy, constant use of AUX. According to Rockchip, using any rate other than 24 MHz can cause "problems between syncing the PHY an PCLK", which leads to all sorts of unreliabilities around register operations. Fixes: d67a38c5a623 ("arm64: dts: rockchip: move core edp from rk3399-kevin= to shared chromebook") Reviewed-by: Douglas Anderson Signed-off-by: zain wang Signed-off-by: Brian Norris Link: https://lore.kernel.org/r/20220830131212.v2.1.I98d30623f13b785ca77094= d0c0fd4339550553b6@changeid Signed-off-by: Heiko Stuebner Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi b/arch= /arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi index eed15fd61d62..af5810e5f5b7 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi @@ -244,6 +244,14 @@ &dmc { &edp { status =3D "okay"; =20 + /* + * eDP PHY/clk don't sync reliably at anything other than 24 MHz. Only + * set this here, because rk3399-gru.dtsi ensures we can generate this + * off GPLL=3D600MHz, whereas some other RK3399 boards may not. + */ + assigned-clocks =3D <&cru PCLK_EDP>; + assigned-clock-rates =3D <24000000>; + ports { edp_out: port@1 { reg =3D <1>; --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A930C32771 for ; Mon, 26 Sep 2022 11:47:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238799AbiIZLrj (ORCPT ); Mon, 26 Sep 2022 07:47:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238878AbiIZLpA (ORCPT ); Mon, 26 Sep 2022 07:45:00 -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 EA8FD7393F; Mon, 26 Sep 2022 03:47:07 -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 7E8A4B80185; Mon, 26 Sep 2022 10:45:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C66B6C43140; Mon, 26 Sep 2022 10:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189116; bh=XyojQ7fSLGv6sgp1IJlFNRcg0hwCTpYkavxuwJX689M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yxj+eVGe4Wy71YjtWrJbA2i/CMK0DBJUrcJLBK3yWt8YtjsgmUOyUp7Ojbb9fX01H Mi43XJFraZk+X8KNtJAD+LoFcyfpe/f1cyuV9i+Uz/lDJpSOKXHjisa/MQjj+rXgFA iEuZ/jCTV7aQi5MVRi2AbwT9gLaRNzU4ksPZ9Dy0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marco Felsch , Lucas Stach , Adam Ford , Shawn Guo , Sasha Levin Subject: [PATCH 5.19 079/207] arm64: dts: imx8mn: remove GPU power domain reset Date: Mon, 26 Sep 2022 12:11:08 +0200 Message-Id: <20220926100810.114790618@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marco Felsch [ Upstream commit 347155d1fa85972ac19d1bf58ae3f3ce95e51a5d ] The PGC (power gating controller) already handles the reset for the GPUMIX power domain. By specifying it within the device tree the reset it issued a 2nd time. This confuses the hardware during power up and sporadically hangs the SoC. Fix this by removing the reset property and let the hardware handle the reset. Fixes: 9a0f3b157e22e ("arm64: dts: imx8mn: Enable GPU") Signed-off-by: Marco Felsch Signed-off-by: Lucas Stach Tested-by: Adam Ford Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/boot/dts/freescale/imx8mn.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm64/boot/dts/freescale/imx8mn.dtsi b/arch/arm64/boot/dt= s/freescale/imx8mn.dtsi index e41e1d56f980..7bd4eecd592e 100644 --- a/arch/arm64/boot/dts/freescale/imx8mn.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mn.dtsi @@ -672,7 +672,6 @@ pgc_gpumix: power-domain@2 { <&clk IMX8MN_CLK_GPU_SHADER>, <&clk IMX8MN_CLK_GPU_BUS_ROOT>, <&clk IMX8MN_CLK_GPU_AHB>; - resets =3D <&src IMX8MQ_RESET_GPU_RESET>; }; =20 pgc_dispmix: power-domain@3 { --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10E8CC32771 for ; Mon, 26 Sep 2022 12:06:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239187AbiIZMGf (ORCPT ); Mon, 26 Sep 2022 08:06:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239174AbiIZMCy (ORCPT ); Mon, 26 Sep 2022 08:02:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D12577C30A; Mon, 26 Sep 2022 03:53:49 -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 E7E1160C56; Mon, 26 Sep 2022 10:45:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFB28C43470; Mon, 26 Sep 2022 10:45:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189119; bh=oi9YcisUecQI4iYkSf9P0Q/7KofFYtJRWLWhXsZagAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M7Yk0HDHcnEHO8vom1CNHV0xXxSt2Co4i25+krbNxLL2cv/OLLwgUok7FTeov9hFJ V+FTwRLU8XiI/OXqCndY/UIDW6kXbzl+/OQlLts2siA/PESC8GyPPFOBuwzJC1FTOI oyeeiB67qq3R3cauWFkMJNNH56bc49s0XKv8rFBY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Fan , Shawn Guo , Sasha Levin Subject: [PATCH 5.19 080/207] arm64: dts: imx8ulp: add #reset-cells for pcc Date: Mon, 26 Sep 2022 12:11:09 +0200 Message-Id: <20220926100810.162682338@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peng Fan [ Upstream commit 5fa383a25fd8a16a73485c90da4e3e33a78b45cf ] The binding file clock/imx8ulp-pcc-clock.yaml indicates '#reset-cells' is a required property, add it. Fixes: fe6291e96313 ("arm64: dts: imx8ulp: Add the basic dtsi file for imx8= ulp") Signed-off-by: Peng Fan Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/boot/dts/freescale/imx8ulp.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8ulp.dtsi b/arch/arm64/boot/d= ts/freescale/imx8ulp.dtsi index 09f7364dd1d0..1cd389b1b95d 100644 --- a/arch/arm64/boot/dts/freescale/imx8ulp.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8ulp.dtsi @@ -172,6 +172,7 @@ pcc3: clock-controller@292d0000 { compatible =3D "fsl,imx8ulp-pcc3"; reg =3D <0x292d0000 0x10000>; #clock-cells =3D <1>; + #reset-cells =3D <1>; }; =20 tpm5: tpm@29340000 { @@ -270,6 +271,7 @@ pcc4: clock-controller@29800000 { compatible =3D "fsl,imx8ulp-pcc4"; reg =3D <0x29800000 0x10000>; #clock-cells =3D <1>; + #reset-cells =3D <1>; }; =20 lpi2c6: i2c@29840000 { @@ -414,6 +416,7 @@ pcc5: clock-controller@2da70000 { compatible =3D "fsl,imx8ulp-pcc5"; reg =3D <0x2da70000 0x10000>; #clock-cells =3D <1>; + #reset-cells =3D <1>; }; }; =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3931EC07E9D for ; Mon, 26 Sep 2022 11:46:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238576AbiIZLqN (ORCPT ); Mon, 26 Sep 2022 07:46:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238379AbiIZLnV (ORCPT ); Mon, 26 Sep 2022 07:43:21 -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 370015508B; Mon, 26 Sep 2022 03:46:18 -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 DDAC260B55; Mon, 26 Sep 2022 10:45:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB2B4C433C1; Mon, 26 Sep 2022 10:45:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189122; bh=df8/eRBlP1PeK6BKFY7uxt1LSUL6QU9ec6A+wvlYhMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KbcXclnajl1aLjA/iPFYuHFqPs96nRZ0TaxXvwM4NVDTpxYxuellkUGZSb06FEDL8 g9VUYK7PIVFNYD3m78nHmq9lAEOcqk2g7gIaVJj/pBNZlmZXhanOua7lW/Tc5abAc5 7538RfoZdqR71SJ5MbYlVxFUurPvHkHuFizMsJ2g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Peter Ujfalusi , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 081/207] dmaengine: ti: k3-udma-private: Fix refcount leak bug in of_xudma_dev_get() Date: Mon, 26 Sep 2022 12:11:10 +0200 Message-Id: <20220926100810.203362643@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit f9fdb0b86f087c2b7f6c6168dd0985a3c1eda87e ] We should call of_node_put() for the reference returned by of_parse_phandle() in fail path or when it is not used anymore. Here we only need to move the of_node_put() before the check. Fixes: d70241913413 ("dmaengine: ti: k3-udma: Add glue layer for non DMAeng= ine users") Signed-off-by: Liang He Acked-by: Peter Ujfalusi Link: https://lore.kernel.org/r/20220720073234.1255474-1-windhl@126.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/dma/ti/k3-udma-private.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/dma/ti/k3-udma-private.c b/drivers/dma/ti/k3-udma-priv= ate.c index d4f1e4e9603a..85e00701473c 100644 --- a/drivers/dma/ti/k3-udma-private.c +++ b/drivers/dma/ti/k3-udma-private.c @@ -31,14 +31,14 @@ struct udma_dev *of_xudma_dev_get(struct device_node *n= p, const char *property) } =20 pdev =3D of_find_device_by_node(udma_node); + if (np !=3D udma_node) + of_node_put(udma_node); + if (!pdev) { pr_debug("UDMA device not found\n"); return ERR_PTR(-EPROBE_DEFER); } =20 - if (np !=3D udma_node) - of_node_put(udma_node); - ud =3D platform_get_drvdata(pdev); if (!ud) { pr_debug("UDMA has not been probed\n"); --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EEF5C32771 for ; Mon, 26 Sep 2022 11:47:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238673AbiIZLrb (ORCPT ); Mon, 26 Sep 2022 07:47:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238725AbiIZLo0 (ORCPT ); Mon, 26 Sep 2022 07:44:26 -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 CEE1B564FC; Mon, 26 Sep 2022 03:46:40 -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 940E5B80978; Mon, 26 Sep 2022 10:45:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1772C433D6; Mon, 26 Sep 2022 10:45:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189125; bh=qG/GrAL/KC/X3xbqMlKzeMjHeQKBh4vzIdmV29LdBNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r9Yy9VWLRXeqkC06eYQGJItjYMEMRUGJvjIli3PPmVmxEI1tiVoLM6lEEjHP0bTKb /A0v/HGp/p9qyom3F/JTXmF/3A5lZA/SFiuRFRHb506KCGBIsjyssXup6SPw9Tet73 oV5NcvPbNb8PnVdtif+2fkVWpO8O95kYMs1mSyPc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Riesch , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.19 082/207] arm64: dts: rockchip: fix property for usb2 phy supply on rock-3a Date: Mon, 26 Sep 2022 12:11:11 +0200 Message-Id: <20220926100810.246666091@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Riesch [ Upstream commit 43e1d6d3b45c4e7e25171ec04a10d09969b0f889 ] The property "vbus-supply" was copied from the vendor kernel but is not available in mainstream. Use correct property "phy-supply". Fixes: 254a1f6a29e7 ("arm64: dts: rockchip: add usb3 support to the radxa r= ock3 model a") Signed-off-by: Michael Riesch Link: https://lore.kernel.org/r/20220905064335.104650-1-michael.riesch@wolf= vision.net Signed-off-by: Heiko Stuebner Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts b/arch/arm64/b= oot/dts/rockchip/rk3568-rock-3a.dts index 0813c0c5abde..26912f02684c 100644 --- a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +++ b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts @@ -543,7 +543,7 @@ &usb2phy0_host { }; =20 &usb2phy0_otg { - vbus-supply =3D <&vcc5v0_usb_otg>; + phy-supply =3D <&vcc5v0_usb_otg>; status =3D "okay"; }; =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E180C32771 for ; Mon, 26 Sep 2022 12:26:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239535AbiIZM0k (ORCPT ); Mon, 26 Sep 2022 08:26:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234230AbiIZMZt (ORCPT ); Mon, 26 Sep 2022 08:25:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3F33476FD; Mon, 26 Sep 2022 04:07:01 -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 A0768B809E3; Mon, 26 Sep 2022 10:45:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9EC0C433D6; Mon, 26 Sep 2022 10:45:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189128; bh=c7JOaXN/WLY2Wp5a0pAQO8DiiZGcoD8h3orQYV0f5mc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RL6YGCJ4xto9Dv9KZ5Y3KpZi0YokolQuCORmWsF2DaZolXWrM49WAhBc1CYTJM4Ru OOvWvwM1Fvxb+WNRIOUuQaqjm4WcPstg8H3MmwXyNy8bM2jPSJc3AKaAeRfYFo1Mwz BnMGdiMSTug+D/wFxbC3cYsXUOLLucLUcpLBHlPs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Riesch , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.19 083/207] arm64: dts: rockchip: fix property for usb2 phy supply on rk3568-evb1-v10 Date: Mon, 26 Sep 2022 12:11:12 +0200 Message-Id: <20220926100810.294829989@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Riesch [ Upstream commit 1988e3ef0544bbe54cffa4ec30a5883e5a08c2b6 ] The property "vbus-supply" was copied from the vendor kernel but is not available in mainstream. Use correct property "phy-supply". Fixes: d6cfb110b0fd ("arm64: dts: rockchip: add usb3 support to rk3568-evb1= -v10") Signed-off-by: Michael Riesch Link: https://lore.kernel.org/r/20220905064335.104650-2-michael.riesch@wolf= vision.net Signed-off-by: Heiko Stuebner Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts b/arch/arm64/= boot/dts/rockchip/rk3568-evb1-v10.dts index 622be8be9813..282f5c74d5cd 100644 --- a/arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts +++ b/arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts @@ -618,7 +618,7 @@ &usb2phy0_host { }; =20 &usb2phy0_otg { - vbus-supply =3D <&vcc5v0_usb_otg>; + phy-supply =3D <&vcc5v0_usb_otg>; status =3D "okay"; }; =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68A26C6FA83 for ; Mon, 26 Sep 2022 11:42:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238240AbiIZLmk (ORCPT ); Mon, 26 Sep 2022 07:42:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238425AbiIZLmH (ORCPT ); Mon, 26 Sep 2022 07:42:07 -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 7B5176FA17; Mon, 26 Sep 2022 03:45:35 -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 2CF9D60B60; Mon, 26 Sep 2022 10:45:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21EFAC433C1; Mon, 26 Sep 2022 10:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189134; bh=xi3Al+05IP5lrRA3rkGzg5lUC6waBNVQLAeH6gktkyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KPS6hpswjxwgN6PWwOY59XHvOGXT1bLB3U+uYrk6xnrS8GxLHZ95xRIJ9A6XHbstO GSrf6hrt088yrv2MkgiKWyF6vpetNhonj6t4sA7NJGXH1ArgYTkUlbpX+h+r5S5rkr EKrQ1N+OuOHb8VvpxxqMeawoePE1pEosHoGWO09o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabio Estevam , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.19 084/207] arm64: dts: rockchip: Remove enable-active-low from rk3399-puma Date: Mon, 26 Sep 2022 12:11:13 +0200 Message-Id: <20220926100810.343141846@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fabio Estevam [ Upstream commit a994b34b9abb9c08ee09e835b4027ff2147f9d94 ] The 'enable-active-low' property is not a valid one. Only 'enable-active-high' is valid, and when this property is absent the gpio regulator will act as active low by default. Remove the invalid 'enable-active-low' property. Fixes: 2c66fc34e945 ("arm64: dts: rockchip: add RK3399-Q7 (Puma) SoM") Signed-off-by: Fabio Estevam Link: https://lore.kernel.org/r/20220827175140.1696699-1-festevam@denx.de Signed-off-by: Heiko Stuebner Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi b/arch/arm64/boo= t/dts/rockchip/rk3399-puma.dtsi index b1ac3a89f259..aa3e21bd6c8f 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi @@ -62,7 +62,6 @@ vcc3v3_sys: vcc3v3-sys { vcc5v0_host: vcc5v0-host-regulator { compatible =3D "regulator-fixed"; gpio =3D <&gpio4 RK_PA3 GPIO_ACTIVE_LOW>; - enable-active-low; pinctrl-names =3D "default"; pinctrl-0 =3D <&vcc5v0_host_en>; regulator-name =3D "vcc5v0_host"; --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 011B6C07E9D for ; Mon, 26 Sep 2022 11:47:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238738AbiIZLrN (ORCPT ); Mon, 26 Sep 2022 07:47:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238612AbiIZLoI (ORCPT ); Mon, 26 Sep 2022 07:44:08 -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 DA37572FDC; Mon, 26 Sep 2022 03:46: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 28CB7604F5; Mon, 26 Sep 2022 10:45:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A0E3C433D6; Mon, 26 Sep 2022 10:45:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189137; bh=ye4d7nWt6PaBGVeDnX10up4GLLnV0qxdz5CZ5E2WPSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zTH3O0IuaH/sXDHC+42snR9wHzh35cZSaY+De41T11dYWeQtzMIe4SXGUUbZsUGpS YYL9OfYMLYuiPH0OPdC9QGHE+cnzsL8+6qwz4QK6H0c0AEe8m/j/GF6HID1KFiT3JM FngxVbDxhiZaKGpwZlrylrBggyIvGz/30FhIbdeg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabio Estevam , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.19 085/207] arm64: dts: rockchip: Remove enable-active-low from rk3566-quartz64-a Date: Mon, 26 Sep 2022 12:11:14 +0200 Message-Id: <20220926100810.389879213@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fabio Estevam [ Upstream commit ea89926d9690f055fd8da929f6621a760e8e0f14 ] The 'enable-active-low' property is not a valid one. Only 'enable-active-high' is valid, and when this property is absent the gpio regulator will act as active low by default. Remove the invalid 'enable-active-low' property. Fixes: b33a22a1e7c4 ("arm64: dts: rockchip: add basic dts for Pine64 Quartz= 64-A") Signed-off-by: Fabio Estevam Link: https://lore.kernel.org/r/20220827175140.1696699-2-festevam@denx.de Signed-off-by: Heiko Stuebner Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts b/arch/arm6= 4/boot/dts/rockchip/rk3566-quartz64-a.dts index fa953b736642..fdbfdf3634e4 100644 --- a/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts +++ b/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts @@ -163,7 +163,6 @@ vcc5v0_usb20_otg: vcc5v0_usb20_otg { =20 vcc3v3_sd: vcc3v3_sd { compatible =3D "regulator-fixed"; - enable-active-low; gpio =3D <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; pinctrl-names =3D "default"; pinctrl-0 =3D <&vcc_sd_h>; --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76E2EC32771 for ; Mon, 26 Sep 2022 12:34:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238301AbiIZMev (ORCPT ); Mon, 26 Sep 2022 08:34:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237021AbiIZMeX (ORCPT ); Mon, 26 Sep 2022 08:34:23 -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 CD8D1E6DF4; Mon, 26 Sep 2022 04:12:23 -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 59201B802BD; Mon, 26 Sep 2022 10:45:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 601E3C433D6; Mon, 26 Sep 2022 10:45:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189141; bh=SgKUTz/NY4rxLAMButqiqiL0++jYccXz5Yp4u3aD/hM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tjgVi1Xh365gPDwNaEEdlXEWVozBdTuEIhA5g2iUEx6KJwCZ8u8LdWJBsyikqzqk3 iEM3IDTXkDjqdb1apnzpMcuMCd8uhtjtmdcGbh5YbDWcJ4GgR3K+6H+/Y+fDL3bFZW 9iGuJ4ZZAPh3ETuqjW4XK7KDBS6cajejSN1uSDmo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Philippe Schenker , Marcel Ziswiler , Shawn Guo , Sasha Levin Subject: [PATCH 5.19 086/207] arm64: dts: imx8mm-verdin: extend pmic voltages Date: Mon, 26 Sep 2022 12:11:15 +0200 Message-Id: <20220926100810.436967508@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Philippe Schenker [ Upstream commit b5a76cb38df779076a3cff624ce6a368d9bcf330 ] Currently, we limited the voltages from the PMIC very strictly. This causes an issue with one Toradex SKU that uses a consumer-grade chip that is capable of going up to 1.8GHz at 1.00V. Extend the ranges to min/max values of the SoC operating ranges (table 10) in the datasheet. Detailed explanation as follows: BUCK2: - As already described above, the SKU with the consumer-grade chip needs a voltage of at least 1.00V. 1.05V is chosen now as this is listed as the maximum. Both industrial and consumer-grade chips have an absolute maximum rating of 1.15V which makes it still safe to put 1.05V - Lower the regulator-min value to the smallest value allowed from the Quad-A53, 1.2GHz version of the SoC BUCK3: - This regulator is used for SoC input voltages VDD_GPU, VDD_VPU and VDD_DRAM. - Use the smallest value of these three inputs as the regulator-min - Use the largest value of these three inputs as the regulator-max LDO2: - This LDO is used for VDD_SNVS_0P8 SoC input voltage. As this has a single nominal input voltage just put this in the middle of 0.8V. Fixes: 6a57f224f734 ("arm64: dts: freescale: add initial support for verdin= imx8m mini") Signed-off-by: Philippe Schenker Signed-off-by: Marcel Ziswiler Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi b/arch/arm64/= boot/dts/freescale/imx8mm-verdin.dtsi index c2d4da25482f..44b473494d0f 100644 --- a/arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi @@ -359,8 +359,8 @@ reg_vdd_arm: BUCK2 { nxp,dvs-standby-voltage =3D <850000>; regulator-always-on; regulator-boot-on; - regulator-max-microvolt =3D <950000>; - regulator-min-microvolt =3D <850000>; + regulator-max-microvolt =3D <1050000>; + regulator-min-microvolt =3D <805000>; regulator-name =3D "On-module +VDD_ARM (BUCK2)"; regulator-ramp-delay =3D <3125>; }; @@ -368,8 +368,8 @@ reg_vdd_arm: BUCK2 { reg_vdd_dram: BUCK3 { regulator-always-on; regulator-boot-on; - regulator-max-microvolt =3D <950000>; - regulator-min-microvolt =3D <850000>; + regulator-max-microvolt =3D <1000000>; + regulator-min-microvolt =3D <805000>; regulator-name =3D "On-module +VDD_GPU_VPU_DDR (BUCK3)"; }; =20 @@ -408,7 +408,7 @@ reg_nvcc_snvs: LDO1 { reg_vdd_snvs: LDO2 { regulator-always-on; regulator-boot-on; - regulator-max-microvolt =3D <900000>; + regulator-max-microvolt =3D <800000>; regulator-min-microvolt =3D <800000>; regulator-name =3D "On-module +V0.8_SNVS (LDO2)"; }; --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76741C07E9D for ; Mon, 26 Sep 2022 11:47:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238792AbiIZLrg (ORCPT ); Mon, 26 Sep 2022 07:47:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238788AbiIZLom (ORCPT ); Mon, 26 Sep 2022 07:44:42 -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 F32B773934; Mon, 26 Sep 2022 03:47: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 C44E560BA5; Mon, 26 Sep 2022 10:45:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAA9BC433C1; Mon, 26 Sep 2022 10:45:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189144; bh=wYMWX1RdKzeoF4adCEB63kIZCJOyfUXgVp3rUBJ24FE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TtDxyNbdMhtQW2mz/BRAxrqr5+/jZSENsCV3E08fA1/6cC33Dzi42vOvnIMoR9UYO z0fN0SuZbgPWHRoGLWm5PxmvOFtqJ4f32hxG55kNH6jA0/DEsRrToBhpu8iN9RQ3pG UkWL2JyTTtZoOuE3CmaIf9nH3GuUldv9OQLhf36w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Igor Ryzhov , Florian Westphal , Sasha Levin Subject: [PATCH 5.19 087/207] netfilter: nf_conntrack_sip: fix ct_sip_walk_headers Date: Mon, 26 Sep 2022 12:11:16 +0200 Message-Id: <20220926100810.485028507@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Igor Ryzhov [ Upstream commit 39aebedeaaa95757f5c1f2ddb5f43fdddbf478ca ] ct_sip_next_header and ct_sip_get_header return an absolute value of matchoff, not a shift from current dataoff. So dataoff should be assigned matchoff, not incremented by it. This issue can be seen in the scenario when there are multiple Contact headers and the first one is using a hostname and other headers use IP addresses. In this case, ct_sip_walk_headers will work as follows: The first ct_sip_get_header call to will find the first Contact header but will return -1 as the header uses a hostname. But matchoff will be changed to the offset of this header. After that, dataoff should be set to matchoff, so that the next ct_sip_get_header call find the next Contact header. But instead of assigning dataoff to matchoff, it is incremented by it, which is not correct, as matchoff is an absolute value of the offset. So on the next call to the ct_sip_get_header, dataoff will be incorrect, and the next Contact header may not be found at all. Fixes: 05e3ced297fe ("[NETFILTER]: nf_conntrack_sip: introduce SIP-URI pars= ing helper") Signed-off-by: Igor Ryzhov Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- net/netfilter/nf_conntrack_sip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_= sip.c index b83dc9bf0a5d..78fd9122b70c 100644 --- a/net/netfilter/nf_conntrack_sip.c +++ b/net/netfilter/nf_conntrack_sip.c @@ -477,7 +477,7 @@ static int ct_sip_walk_headers(const struct nf_conn *ct= , const char *dptr, return ret; if (ret =3D=3D 0) break; - dataoff +=3D *matchoff; + dataoff =3D *matchoff; } *in_header =3D 0; } @@ -489,7 +489,7 @@ static int ct_sip_walk_headers(const struct nf_conn *ct= , const char *dptr, break; if (ret =3D=3D 0) return ret; - dataoff +=3D *matchoff; + dataoff =3D *matchoff; } =20 if (in_header) --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D5DCC07E9D for ; Mon, 26 Sep 2022 11:46:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238588AbiIZLqR (ORCPT ); Mon, 26 Sep 2022 07:46:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238401AbiIZLnW (ORCPT ); Mon, 26 Sep 2022 07:43:22 -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 CF7D872873; Mon, 26 Sep 2022 03:46: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 683D0B802C5; Mon, 26 Sep 2022 10:45:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE0D0C433C1; Mon, 26 Sep 2022 10:45:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189147; bh=dPxiUNwktI/6LHpnNjBpRpD+Vb/t8nqMClxe9ag4g2I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wiaZNj9yUx8QgNEBCsLBCwITzEGS0Wivu3ma6V1nv3ItEsPX1LVwB/o3+7GUpELzy HphIs9K+ltIo5/b5lvskOA3ZC/Gq3qNaWrbfxOwmMEpnl9hNIG6yg8iINVYHIMfLPM zWMn1cEbF0Ghx6/sCc09ooNObRnjSNoWO95A3uvU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Leadbeater , Florian Westphal , Sasha Levin Subject: [PATCH 5.19 088/207] netfilter: nf_conntrack_irc: Tighten matching on DCC message Date: Mon, 26 Sep 2022 12:11:17 +0200 Message-Id: <20220926100810.523597344@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: David Leadbeater [ Upstream commit e8d5dfd1d8747b56077d02664a8838c71ced948e ] CTCP messages should only be at the start of an IRC message, not anywhere within it. While the helper only decodes packes in the ORIGINAL direction, its possible to make a client send a CTCP message back by empedding one into a PING request. As-is, thats enough to make the helper believe that it saw a CTCP message. Fixes: 869f37d8e48f ("[NETFILTER]: nf_conntrack/nf_nat: add IRC helper port= ") Signed-off-by: David Leadbeater Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- net/netfilter/nf_conntrack_irc.c | 34 ++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/net/netfilter/nf_conntrack_irc.c b/net/netfilter/nf_conntrack_= irc.c index 992decbcaa5c..5703846bea3b 100644 --- a/net/netfilter/nf_conntrack_irc.c +++ b/net/netfilter/nf_conntrack_irc.c @@ -157,15 +157,37 @@ static int help(struct sk_buff *skb, unsigned int pro= toff, data =3D ib_ptr; data_limit =3D ib_ptr + datalen; =20 - /* strlen("\1DCC SENT t AAAAAAAA P\1\n")=3D24 - * 5+MINMATCHLEN+strlen("t AAAAAAAA P\1\n")=3D14 */ - while (data < data_limit - (19 + MINMATCHLEN)) { - if (memcmp(data, "\1DCC ", 5)) { + /* Skip any whitespace */ + while (data < data_limit - 10) { + if (*data =3D=3D ' ' || *data =3D=3D '\r' || *data =3D=3D '\n') + data++; + else + break; + } + + /* strlen("PRIVMSG x ")=3D10 */ + if (data < data_limit - 10) { + if (strncasecmp("PRIVMSG ", data, 8)) + goto out; + data +=3D 8; + } + + /* strlen(" :\1DCC SENT t AAAAAAAA P\1\n")=3D26 + * 7+MINMATCHLEN+strlen("t AAAAAAAA P\1\n")=3D26 + */ + while (data < data_limit - (21 + MINMATCHLEN)) { + /* Find first " :", the start of message */ + if (memcmp(data, " :", 2)) { data++; continue; } + data +=3D 2; + + /* then check that place only for the DCC command */ + if (memcmp(data, "\1DCC ", 5)) + goto out; data +=3D 5; - /* we have at least (19+MINMATCHLEN)-5 bytes valid data left */ + /* we have at least (21+MINMATCHLEN)-(2+5) bytes valid data left */ =20 iph =3D ip_hdr(skb); pr_debug("DCC found in master %pI4:%u %pI4:%u\n", @@ -181,7 +203,7 @@ static int help(struct sk_buff *skb, unsigned int proto= ff, pr_debug("DCC %s detected\n", dccprotos[i]); =20 /* we have at least - * (19+MINMATCHLEN)-5-dccprotos[i].matchlen bytes valid + * (21+MINMATCHLEN)-7-dccprotos[i].matchlen bytes valid * data left (=3D=3D 14/13 bytes) */ if (parse_dcc(data, data_limit, &dcc_ip, &dcc_port, &addr_beg_p, &addr_end_p)) { --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0A8CC32771 for ; Mon, 26 Sep 2022 11:46:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238598AbiIZLqW (ORCPT ); Mon, 26 Sep 2022 07:46:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238405AbiIZLnY (ORCPT ); Mon, 26 Sep 2022 07:43:24 -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 78C1372B47; Mon, 26 Sep 2022 03:46:18 -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 75CECB8068A; Mon, 26 Sep 2022 10:45:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADCFBC433C1; Mon, 26 Sep 2022 10:45:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189150; bh=Rlz1uuBrqfQ6EF641OQ2/zzhC5dy/G4tP1g7Ph7c544=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cVpsmMJFFUsS0gSuj3R+1evgX4KdKNbPcmLEdy8cy1a5sTALuZl1j+64RlsfB2h7w jOG6KIhk3J38Xn3iQDhZ5JP4uGfr3NC/amaAPvspXiVNXyMnaR3aiLb6M3Q2ac1QvG TyMO88sQCkqj6vWWss+hNfzJ8+xxPr4a/lTQ9gLQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso , Florian Westphal , Sasha Levin Subject: [PATCH 5.19 089/207] netfilter: nfnetlink_osf: fix possible bogus match in nf_osf_find() Date: Mon, 26 Sep 2022 12:11:18 +0200 Message-Id: <20220926100810.572089330@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pablo Neira Ayuso [ Upstream commit 559c36c5a8d730c49ef805a72b213d3bba155cc8 ] nf_osf_find() incorrectly returns true on mismatch, this leads to copying uninitialized memory area in nft_osf which can be used to leak stale kernel stack data to userspace. Fixes: 22c7652cdaa8 ("netfilter: nft_osf: Add version option support") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- net/netfilter/nfnetlink_osf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/netfilter/nfnetlink_osf.c b/net/netfilter/nfnetlink_osf.c index 0fa2e2030427..ee6840bd5933 100644 --- a/net/netfilter/nfnetlink_osf.c +++ b/net/netfilter/nfnetlink_osf.c @@ -269,6 +269,7 @@ bool nf_osf_find(const struct sk_buff *skb, struct nf_osf_hdr_ctx ctx; const struct tcphdr *tcp; struct tcphdr _tcph; + bool found =3D false; =20 memset(&ctx, 0, sizeof(ctx)); =20 @@ -283,10 +284,11 @@ bool nf_osf_find(const struct sk_buff *skb, =20 data->genre =3D f->genre; data->version =3D f->version; + found =3D true; break; } =20 - return true; + return found; } EXPORT_SYMBOL_GPL(nf_osf_find); =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52D7EC07E9D for ; Mon, 26 Sep 2022 11:49:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238951AbiIZLsm (ORCPT ); Mon, 26 Sep 2022 07:48:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238654AbiIZLqo (ORCPT ); Mon, 26 Sep 2022 07:46:44 -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 B468974CDC; Mon, 26 Sep 2022 03:47:30 -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 A9AE960C41; Mon, 26 Sep 2022 10:45:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD373C433D6; Mon, 26 Sep 2022 10:45:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189153; bh=AxCMt/ANClaQoCG6b0NU/yzunWIxmxLfOMnEhAJ6OZk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xr/t66AJ67pzv/x6g8V7zo5PNQ6CZV2/0r3CyJtmS9XFkKsU7oQjbQoi2EML4oi3J rrJ0gCavXvgxHzUmCxKVE0UJlCnOxicUVAx2fZd9cIAT0oiHBghAJSwNi9Y9lkmg/3 16FBtKOGpU2cqLrn3nJq7QBXrjA46D8zdoNoFKfM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Ertman , Helena Anna Dubel , Tony Nguyen , Sasha Levin Subject: [PATCH 5.19 090/207] ice: Dont double unplug aux on peer initiated reset Date: Mon, 26 Sep 2022 12:11:19 +0200 Message-Id: <20220926100810.617881253@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Ertman [ Upstream commit 23c619190318376769ad7b61504c2ea0703fb783 ] In the IDC callback that is accessed when the aux drivers request a reset, the function to unplug the aux devices is called. This function is also called in the ice_prepare_for_reset function. This double call is causing a "scheduling while atomic" BUG. [ 662.676430] ice 0000:4c:00.0 rocep76s0: cqp opcode =3D 0x1 maj_err_code = =3D 0xffff min_err_code =3D 0x8003 [ 662.676609] ice 0000:4c:00.0 rocep76s0: [Modify QP Cmd Error][op_code=3D= 8] status=3D-29 waiting=3D1 completion_err=3D1 maj=3D0xffff min=3D0x8003 [ 662.815006] ice 0000:4c:00.0 rocep76s0: ICE OICR event notification: oic= r =3D 0x10000003 [ 662.815014] ice 0000:4c:00.0 rocep76s0: critical PE Error, GLPE_CRITERR= =3D0x00011424 [ 662.815017] ice 0000:4c:00.0 rocep76s0: Requesting a reset [ 662.815475] BUG: scheduling while atomic: swapper/37/0/0x00010002 [ 662.815475] BUG: scheduling while atomic: swapper/37/0/0x00010002 [ 662.815477] Modules linked in: rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_res= olver nfs lockd grace fscache netfs rfkill 8021q garp mrp stp llc vfat fat = rpcrdma intel_rapl_msr intel_rapl_common sunrpc i10nm_edac rdma_ucm nfit ib= _srpt libnvdimm ib_isert iscsi_target_mod x86_pkg_temp_thermal intel_powerc= lamp coretemp target_core_mod snd_hda_intel ib_iser snd_intel_dspcfg libisc= si snd_intel_sdw_acpi scsi_transport_iscsi kvm_intel iTCO_wdt rdma_cm snd_h= da_codec kvm iw_cm ipmi_ssif iTCO_vendor_support snd_hda_core irqbypass crc= t10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hwdep snd_seq snd_seq_de= vice rapl snd_pcm snd_timer isst_if_mbox_pci pcspkr isst_if_mmio irdma inte= l_uncore idxd acpi_ipmi joydev isst_if_common snd mei_me idxd_bus ipmi_si s= oundcore i2c_i801 mei ipmi_devintf i2c_smbus i2c_ismt ipmi_msghandler acpi_= power_meter acpi_pad rv(OE) ib_uverbs ib_cm ib_core xfs libcrc32c ast i2c_a= lgo_bit drm_vram_helper drm_kms_helper syscopyarea sysfillrect sysimgblt fb= _sys_fops drm_ttm_helpe r ttm [ 662.815546] nvme nvme_core ice drm crc32c_intel i40e t10_pi wmi pinctrl= _emmitsburg dm_mirror dm_region_hash dm_log dm_mod fuse [ 662.815557] Preemption disabled at: [ 662.815558] [<0000000000000000>] 0x0 [ 662.815563] CPU: 37 PID: 0 Comm: swapper/37 Kdump: loaded Tainted: G S = OE 5.17.1 #2 [ 662.815566] Hardware name: Intel Corporation D50DNP/D50DNP, BIOS SE5C630= 1.86B.6624.D18.2111021741 11/02/2021 [ 662.815568] Call Trace: [ 662.815572] [ 662.815574] dump_stack_lvl+0x33/0x42 [ 662.815581] __schedule_bug.cold.147+0x7d/0x8a [ 662.815588] __schedule+0x798/0x990 [ 662.815595] schedule+0x44/0xc0 [ 662.815597] schedule_preempt_disabled+0x14/0x20 [ 662.815600] __mutex_lock.isra.11+0x46c/0x490 [ 662.815603] ? __ibdev_printk+0x76/0xc0 [ib_core] [ 662.815633] device_del+0x37/0x3d0 [ 662.815639] ice_unplug_aux_dev+0x1a/0x40 [ice] [ 662.815674] ice_schedule_reset+0x3c/0xd0 [ice] [ 662.815693] irdma_iidc_event_handler.cold.7+0xb6/0xd3 [irdma] [ 662.815712] ? bitmap_find_next_zero_area_off+0x45/0xa0 [ 662.815719] ice_send_event_to_aux+0x54/0x70 [ice] [ 662.815741] ice_misc_intr+0x21d/0x2d0 [ice] [ 662.815756] __handle_irq_event_percpu+0x4c/0x180 [ 662.815762] handle_irq_event_percpu+0xf/0x40 [ 662.815764] handle_irq_event+0x34/0x60 [ 662.815766] handle_edge_irq+0x9a/0x1c0 [ 662.815770] __common_interrupt+0x62/0x100 [ 662.815774] common_interrupt+0xb4/0xd0 [ 662.815779] [ 662.815780] [ 662.815780] asm_common_interrupt+0x1e/0x40 [ 662.815785] RIP: 0010:cpuidle_enter_state+0xd6/0x380 [ 662.815789] Code: 49 89 c4 0f 1f 44 00 00 31 ff e8 65 d7 95 ff 45 84 ff = 74 12 9c 58 f6 c4 02 0f 85 64 02 00 00 31 ff e8 ae c5 9c ff fb 45 85 f6 <0f= > 88 12 01 00 00 49 63 d6 4c 2b 24 24 48 8d 04 52 48 8d 04 82 49 [ 662.815791] RSP: 0018:ff2c2c4f18edbe80 EFLAGS: 00000202 [ 662.815793] RAX: ff280805df140000 RBX: 0000000000000002 RCX: 00000000000= 0001f [ 662.815795] RDX: 0000009a52da2d08 RSI: ffffffff93f8240b RDI: ffffffff93f= 53ee7 [ 662.815796] RBP: ff5e2bd11ff41928 R08: 0000000000000000 R09: 00000000000= 2f8c0 [ 662.815797] R10: 0000010c3f18e2cf R11: 000000000000000f R12: 0000009a52d= a2d08 [ 662.815798] R13: ffffffff94ad7e20 R14: 0000000000000002 R15: 00000000000= 00000 [ 662.815801] cpuidle_enter+0x29/0x40 [ 662.815803] do_idle+0x261/0x2b0 [ 662.815807] cpu_startup_entry+0x19/0x20 [ 662.815809] start_secondary+0x114/0x150 [ 662.815813] secondary_startup_64_no_verify+0xd5/0xdb [ 662.815818] [ 662.815846] bad: scheduling from the idle thread! [ 662.815849] CPU: 37 PID: 0 Comm: swapper/37 Kdump: loaded Tainted: G S = W OE 5.17.1 #2 [ 662.815852] Hardware name: Intel Corporation D50DNP/D50DNP, BIOS SE5C630= 1.86B.6624.D18.2111021741 11/02/2021 [ 662.815853] Call Trace: [ 662.815855] [ 662.815856] dump_stack_lvl+0x33/0x42 [ 662.815860] dequeue_task_idle+0x20/0x30 [ 662.815863] __schedule+0x1c3/0x990 [ 662.815868] schedule+0x44/0xc0 [ 662.815871] schedule_preempt_disabled+0x14/0x20 [ 662.815873] __mutex_lock.isra.11+0x3a8/0x490 [ 662.815876] ? __ibdev_printk+0x76/0xc0 [ib_core] [ 662.815904] device_del+0x37/0x3d0 [ 662.815909] ice_unplug_aux_dev+0x1a/0x40 [ice] [ 662.815937] ice_schedule_reset+0x3c/0xd0 [ice] [ 662.815961] irdma_iidc_event_handler.cold.7+0xb6/0xd3 [irdma] [ 662.815979] ? bitmap_find_next_zero_area_off+0x45/0xa0 [ 662.815985] ice_send_event_to_aux+0x54/0x70 [ice] [ 662.816011] ice_misc_intr+0x21d/0x2d0 [ice] [ 662.816033] __handle_irq_event_percpu+0x4c/0x180 [ 662.816037] handle_irq_event_percpu+0xf/0x40 [ 662.816039] handle_irq_event+0x34/0x60 [ 662.816042] handle_edge_irq+0x9a/0x1c0 [ 662.816045] __common_interrupt+0x62/0x100 [ 662.816048] common_interrupt+0xb4/0xd0 [ 662.816052] [ 662.816053] [ 662.816054] asm_common_interrupt+0x1e/0x40 [ 662.816057] RIP: 0010:cpuidle_enter_state+0xd6/0x380 [ 662.816060] Code: 49 89 c4 0f 1f 44 00 00 31 ff e8 65 d7 95 ff 45 84 ff = 74 12 9c 58 f6 c4 02 0f 85 64 02 00 00 31 ff e8 ae c5 9c ff fb 45 85 f6 <0f= > 88 12 01 00 00 49 63 d6 4c 2b 24 24 48 8d 04 52 48 8d 04 82 49 [ 662.816063] RSP: 0018:ff2c2c4f18edbe80 EFLAGS: 00000202 [ 662.816065] RAX: ff280805df140000 RBX: 0000000000000002 RCX: 00000000000= 0001f [ 662.816067] RDX: 0000009a52da2d08 RSI: ffffffff93f8240b RDI: ffffffff93f= 53ee7 [ 662.816068] RBP: ff5e2bd11ff41928 R08: 0000000000000000 R09: 00000000000= 2f8c0 [ 662.816070] R10: 0000010c3f18e2cf R11: 000000000000000f R12: 0000009a52d= a2d08 [ 662.816071] R13: ffffffff94ad7e20 R14: 0000000000000002 R15: 00000000000= 00000 [ 662.816075] cpuidle_enter+0x29/0x40 [ 662.816077] do_idle+0x261/0x2b0 [ 662.816080] cpu_startup_entry+0x19/0x20 [ 662.816083] start_secondary+0x114/0x150 [ 662.816087] secondary_startup_64_no_verify+0xd5/0xdb [ 662.816091] [ 662.816169] bad: scheduling from the idle thread! The correct place to unplug the aux devices for a reset is in the prepare_for_reset function, as this is a common place for all reset flows. It also has built in protection from being called twice in a single reset instance before the aux devices are replugged. Fixes: f9f5301e7e2d4 ("ice: Register auxiliary device to provide RDMA") Signed-off-by: Dave Ertman Tested-by: Helena Anna Dubel Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/intel/ice/ice_main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethern= et/intel/ice/ice_main.c index 4c6bb7482b36..0b567e8e3674 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -2399,8 +2399,6 @@ int ice_schedule_reset(struct ice_pf *pf, enum ice_re= set_req reset) return -EBUSY; } =20 - ice_unplug_aux_dev(pf); - switch (reset) { case ICE_RESET_PFR: set_bit(ICE_PFR_REQ, pf->state); --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 931FAC07E9D for ; Mon, 26 Sep 2022 11:46:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238650AbiIZLqn (ORCPT ); Mon, 26 Sep 2022 07:46:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238532AbiIZLnn (ORCPT ); Mon, 26 Sep 2022 07:43:43 -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 A007D72B70; Mon, 26 Sep 2022 03:46: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 ams.source.kernel.org (Postfix) with ESMTPS id 8EE54B802C7; Mon, 26 Sep 2022 10:45:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0B91C433D6; Mon, 26 Sep 2022 10:45:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189156; bh=2hLsJWGAQFTznAbHWLTE6GPksFM8PJHIBk/dzmbwijk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gJDyIeSmGbsRAQNN8FoErApJenVlgSQcehqF/d2w/41NzIxRQLS399cuGgKSi7Xfj ZCntlm0mmwqhk6LJ50xEJIywZNBe6xVojRdvufZlwg5Fnmeahm29S/s8CJu/R6aH4k slP0SoZXlghfgNCD6Hupodkz09+6hpx//BCjlcdw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ding Hui , Anatolii Gerasymenko , Tony Nguyen , Sasha Levin , Arpana Arland Subject: [PATCH 5.19 091/207] ice: Fix crash by keep old cfg when update TCs more than queues Date: Mon, 26 Sep 2022 12:11:20 +0200 Message-Id: <20220926100810.667021865@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ding Hui [ Upstream commit a509702cac95a8b450228a037c8542f57e538e5b ] There are problems if allocated queues less than Traffic Classes. Commit a632b2a4c920 ("ice: ethtool: Prohibit improper channel config for DCB") already disallow setting less queues than TCs. Another case is if we first set less queues, and later update more TCs config due to LLDP, ice_vsi_cfg_tc() will failed but left dirty num_txq/rxq and tc_cfg in vsi, that will cause invalid pointer access. [ 95.968089] ice 0000:3b:00.1: More TCs defined than queues/rings allocat= ed. [ 95.968092] ice 0000:3b:00.1: Trying to use more Rx queues (8), than wer= e allocated (1)! [ 95.968093] ice 0000:3b:00.1: Failed to config TC for VSI index: 0 [ 95.969621] general protection fault: 0000 [#1] SMP NOPTI [ 95.969705] CPU: 1 PID: 58405 Comm: lldpad Kdump: loaded Tainted: G = U W O --------- -t - 4.18.0 #1 [ 95.969867] Hardware name: O.E.M/BC11SPSCB10, BIOS 8.23 12/30/2021 [ 95.969992] RIP: 0010:devm_kmalloc+0xa/0x60 [ 95.970052] Code: 5c ff ff ff 31 c0 5b 5d 41 5c c3 b8 f4 ff ff ff eb f4 = 0f 1f 40 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 89 d1 <8b= > 97 60 02 00 00 48 8d 7e 18 48 39 f7 72 3f 55 89 ce 53 48 8b 4c [ 95.970344] RSP: 0018:ffffc9003f553888 EFLAGS: 00010206 [ 95.970425] RAX: dead000000000200 RBX: ffffea003c425b00 RCX: 00000000006= 080c0 [ 95.970536] RDX: 00000000006080c0 RSI: 0000000000000200 RDI: dead0000000= 00200 [ 95.970648] RBP: dead000000000200 R08: 00000000000463c0 R09: ffff888ffa9= 00000 [ 95.970760] R10: 0000000000000000 R11: 0000000000000002 R12: ffff888ff6b= 40100 [ 95.970870] R13: ffff888ff6a55018 R14: 0000000000000000 R15: ffff888ff6a= 55460 [ 95.970981] FS: 00007f51b7d24700(0000) GS:ffff88903ee80000(0000) knlGS:= 0000000000000000 [ 95.971108] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 95.971197] CR2: 00007fac5410d710 CR3: 0000000f2c1de002 CR4: 00000000007= 606e0 [ 95.971309] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 00000000000= 00000 [ 95.971419] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 00000000000= 00400 [ 95.971530] PKRU: 55555554 [ 95.971573] Call Trace: [ 95.971622] ice_setup_rx_ring+0x39/0x110 [ice] [ 95.971695] ice_vsi_setup_rx_rings+0x54/0x90 [ice] [ 95.971774] ice_vsi_open+0x25/0x120 [ice] [ 95.971843] ice_open_internal+0xb8/0x1f0 [ice] [ 95.971919] ice_ena_vsi+0x4f/0xd0 [ice] [ 95.971987] ice_dcb_ena_dis_vsi.constprop.5+0x29/0x90 [ice] [ 95.972082] ice_pf_dcb_cfg+0x29a/0x380 [ice] [ 95.972154] ice_dcbnl_setets+0x174/0x1b0 [ice] [ 95.972220] dcbnl_ieee_set+0x89/0x230 [ 95.972279] ? dcbnl_ieee_del+0x150/0x150 [ 95.972341] dcb_doit+0x124/0x1b0 [ 95.972392] rtnetlink_rcv_msg+0x243/0x2f0 [ 95.972457] ? dcb_doit+0x14d/0x1b0 [ 95.972510] ? __kmalloc_node_track_caller+0x1d3/0x280 [ 95.972591] ? rtnl_calcit.isra.31+0x100/0x100 [ 95.972661] netlink_rcv_skb+0xcf/0xf0 [ 95.972720] netlink_unicast+0x16d/0x220 [ 95.972781] netlink_sendmsg+0x2ba/0x3a0 [ 95.975891] sock_sendmsg+0x4c/0x50 [ 95.979032] ___sys_sendmsg+0x2e4/0x300 [ 95.982147] ? kmem_cache_alloc+0x13e/0x190 [ 95.985242] ? __wake_up_common_lock+0x79/0x90 [ 95.988338] ? __check_object_size+0xac/0x1b0 [ 95.991440] ? _copy_to_user+0x22/0x30 [ 95.994539] ? move_addr_to_user+0xbb/0xd0 [ 95.997619] ? __sys_sendmsg+0x53/0x80 [ 96.000664] __sys_sendmsg+0x53/0x80 [ 96.003747] do_syscall_64+0x5b/0x1d0 [ 96.006862] entry_SYSCALL_64_after_hwframe+0x65/0xca Only update num_txq/rxq when passed check, and restore tc_cfg if setup queue map failed. Fixes: a632b2a4c920 ("ice: ethtool: Prohibit improper channel config for DC= B") Signed-off-by: Ding Hui Reviewed-by: Anatolii Gerasymenko Tested-by: Arpana Arland (A Contingent worker at= Intel) Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/intel/ice/ice_lib.c | 42 +++++++++++++++--------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/etherne= t/intel/ice/ice_lib.c index 6c4e1d45235e..1169fd7811b0 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -911,7 +911,7 @@ static void ice_set_dflt_vsi_ctx(struct ice_hw *hw, str= uct ice_vsi_ctx *ctxt) */ static int ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ct= xt) { - u16 offset =3D 0, qmap =3D 0, tx_count =3D 0, pow =3D 0; + u16 offset =3D 0, qmap =3D 0, tx_count =3D 0, rx_count =3D 0, pow =3D 0; u16 num_txq_per_tc, num_rxq_per_tc; u16 qcount_tx =3D vsi->alloc_txq; u16 qcount_rx =3D vsi->alloc_rxq; @@ -978,23 +978,25 @@ static int ice_vsi_setup_q_map(struct ice_vsi *vsi, s= truct ice_vsi_ctx *ctxt) * at least 1) */ if (offset) - vsi->num_rxq =3D offset; + rx_count =3D offset; else - vsi->num_rxq =3D num_rxq_per_tc; + rx_count =3D num_rxq_per_tc; =20 - if (vsi->num_rxq > vsi->alloc_rxq) { + if (rx_count > vsi->alloc_rxq) { dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Rx queues (%u), th= an were allocated (%u)!\n", - vsi->num_rxq, vsi->alloc_rxq); + rx_count, vsi->alloc_rxq); return -EINVAL; } =20 - vsi->num_txq =3D tx_count; - if (vsi->num_txq > vsi->alloc_txq) { + if (tx_count > vsi->alloc_txq) { dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Tx queues (%u), th= an were allocated (%u)!\n", - vsi->num_txq, vsi->alloc_txq); + tx_count, vsi->alloc_txq); return -EINVAL; } =20 + vsi->num_txq =3D tx_count; + vsi->num_rxq =3D rx_count; + if (vsi->type =3D=3D ICE_VSI_VF && vsi->num_txq !=3D vsi->num_rxq) { dev_dbg(ice_pf_to_dev(vsi->back), "VF VSI should have same number of Tx = and Rx queues. Hence making them equal\n"); /* since there is a chance that num_rxq could have been changed @@ -3487,6 +3489,7 @@ ice_vsi_setup_q_map_mqprio(struct ice_vsi *vsi, struc= t ice_vsi_ctx *ctxt, u16 pow, offset =3D 0, qcount_tx =3D 0, qcount_rx =3D 0, qmap; u16 tc0_offset =3D vsi->mqprio_qopt.qopt.offset[0]; int tc0_qcount =3D vsi->mqprio_qopt.qopt.count[0]; + u16 new_txq, new_rxq; u8 netdev_tc =3D 0; int i; =20 @@ -3527,21 +3530,24 @@ ice_vsi_setup_q_map_mqprio(struct ice_vsi *vsi, str= uct ice_vsi_ctx *ctxt, } } =20 - /* Set actual Tx/Rx queue pairs */ - vsi->num_txq =3D offset + qcount_tx; - if (vsi->num_txq > vsi->alloc_txq) { + new_txq =3D offset + qcount_tx; + if (new_txq > vsi->alloc_txq) { dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Tx queues (%u), th= an were allocated (%u)!\n", - vsi->num_txq, vsi->alloc_txq); + new_txq, vsi->alloc_txq); return -EINVAL; } =20 - vsi->num_rxq =3D offset + qcount_rx; - if (vsi->num_rxq > vsi->alloc_rxq) { + new_rxq =3D offset + qcount_rx; + if (new_rxq > vsi->alloc_rxq) { dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Rx queues (%u), th= an were allocated (%u)!\n", - vsi->num_rxq, vsi->alloc_rxq); + new_rxq, vsi->alloc_rxq); return -EINVAL; } =20 + /* Set actual Tx/Rx queue pairs */ + vsi->num_txq =3D new_txq; + vsi->num_rxq =3D new_rxq; + /* Setup queue TC[0].qmap for given VSI context */ ctxt->info.tc_mapping[0] =3D cpu_to_le16(qmap); ctxt->info.q_mapping[0] =3D cpu_to_le16(vsi->rxq_map[0]); @@ -3573,6 +3579,7 @@ int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc) { u16 max_txqs[ICE_MAX_TRAFFIC_CLASS] =3D { 0 }; struct ice_pf *pf =3D vsi->back; + struct ice_tc_cfg old_tc_cfg; struct ice_vsi_ctx *ctx; struct device *dev; int i, ret =3D 0; @@ -3597,6 +3604,7 @@ int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc) max_txqs[i] =3D vsi->num_txq; } =20 + memcpy(&old_tc_cfg, &vsi->tc_cfg, sizeof(old_tc_cfg)); vsi->tc_cfg.ena_tc =3D ena_tc; vsi->tc_cfg.numtc =3D num_tc; =20 @@ -3613,8 +3621,10 @@ int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc) else ret =3D ice_vsi_setup_q_map(vsi, ctx); =20 - if (ret) + if (ret) { + memcpy(&vsi->tc_cfg, &old_tc_cfg, sizeof(vsi->tc_cfg)); goto out; + } =20 /* must to indicate which section of VSI context are being modified */ ctx->info.valid_sections =3D cpu_to_le16(ICE_AQ_VSI_PROP_RXQ_MAP_VALID); --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3FBFC07E9D for ; Mon, 26 Sep 2022 11:47:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238850AbiIZLrz (ORCPT ); Mon, 26 Sep 2022 07:47:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238989AbiIZLp0 (ORCPT ); Mon, 26 Sep 2022 07:45: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 29E7D7330B; Mon, 26 Sep 2022 03:47: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 F208B60A37; Mon, 26 Sep 2022 10:45:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD466C433C1; Mon, 26 Sep 2022 10:45:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189159; bh=19KlRLI+ImLM1gK/lv/gMMi8YiwPQlSzvAQZM4tGZNc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Siaseete7FaqQhVZvO/Fb9m49qFTwHZHMwJkLc6OYJqCLI5ZrGLKE8ikgNqdfhv3z e0w3HNyvUjgOp2nIXmmOJ5l+jYT1LvXfIU+kQRZhv9JtuPYqeFfUsl8Rjo0hweSc13 wODS0PFU+C9uQdxR1pGjaLUUyBfWiW90mgMCVxqc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brett Creeley , Norbert Zulinski , Mateusz Palczewski , Konrad Jankowski , Tony Nguyen , Sasha Levin Subject: [PATCH 5.19 092/207] iavf: Fix cached head and tail value for iavf_get_tx_pending Date: Mon, 26 Sep 2022 12:11:21 +0200 Message-Id: <20220926100810.715575081@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brett Creeley [ Upstream commit 809f23c0423a43266e47a7dc67e95b5cb4d1cbfc ] The underlying hardware may or may not allow reading of the head or tail registers and it really makes no difference if we use the software cached values. So, always used the software cached values. Fixes: 9c6c12595b73 ("i40e: Detection and recovery of TX queue hung logic m= oved to service_task from tx_timeout") Signed-off-by: Brett Creeley Co-developed-by: Norbert Zulinski Signed-off-by: Norbert Zulinski Signed-off-by: Mateusz Palczewski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/intel/iavf/iavf_txrx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_txrx.c b/drivers/net/ethe= rnet/intel/iavf/iavf_txrx.c index 06d18797d25a..4c3f3f419110 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_txrx.c +++ b/drivers/net/ethernet/intel/iavf/iavf_txrx.c @@ -114,8 +114,11 @@ u32 iavf_get_tx_pending(struct iavf_ring *ring, bool i= n_sw) { u32 head, tail; =20 + /* underlying hardware might not allow access and/or always return + * 0 for the head/tail registers so just use the cached values + */ head =3D ring->next_to_clean; - tail =3D readl(ring->tail); + tail =3D ring->next_to_use; =20 if (head !=3D tail) return (head < tail) ? --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FCF1C07E9D for ; Mon, 26 Sep 2022 11:46:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238638AbiIZLqi (ORCPT ); Mon, 26 Sep 2022 07:46:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238523AbiIZLnm (ORCPT ); Mon, 26 Sep 2022 07:43:42 -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 B45F672ECB; Mon, 26 Sep 2022 03:46: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 A8CCAB8013C; Mon, 26 Sep 2022 10:46:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F284CC433D6; Mon, 26 Sep 2022 10:46:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189162; bh=bmroqRKWsjXUI/29mh4EiyjfVVI8ExrtCJQ14Y306Mg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R+y4O8jZml9NJF6wwd9Oey2X3aFT5/fuOg7MYZLxn3PUksF+HLH6hbUnMwHA7MKHi YBtBKNkThwT1w9yPfCRu5RAZI39OfpDYVMJFjX+8LojNKhhFl2alDuhwHDV+Uy/dXk gyQAzwXUumOV9q+OBNro2zaGucTkcZfMYk1zIn5E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lu Wei , Eric Dumazet , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 093/207] ipvlan: Fix out-of-bound bugs caused by unset skb->mac_header Date: Mon, 26 Sep 2022 12:11:22 +0200 Message-Id: <20220926100810.760620649@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lu Wei [ Upstream commit 81225b2ea161af48e093f58e8dfee6d705b16af4 ] If an AF_PACKET socket is used to send packets through ipvlan and the default xmit function of the AF_PACKET socket is changed from dev_queue_xmit() to packet_direct_xmit() via setsockopt() with the option name of PACKET_QDISC_BYPASS, the skb->mac_header may not be reset and remains as the initial value of 65535, this may trigger slab-out-of-bounds bugs as following: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D UG: KASAN: slab-out-of-bounds in ipvlan_xmit_mode_l2+0xdb/0x330 [ipvlan] PU: 2 PID: 1768 Comm: raw_send Kdump: loaded Not tainted 6.0.0-rc4+ #6 ardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-1.fc33 all Trace: print_address_description.constprop.0+0x1d/0x160 print_report.cold+0x4f/0x112 kasan_report+0xa3/0x130 ipvlan_xmit_mode_l2+0xdb/0x330 [ipvlan] ipvlan_start_xmit+0x29/0xa0 [ipvlan] __dev_direct_xmit+0x2e2/0x380 packet_direct_xmit+0x22/0x60 packet_snd+0x7c9/0xc40 sock_sendmsg+0x9a/0xa0 __sys_sendto+0x18a/0x230 __x64_sys_sendto+0x74/0x90 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd The root cause is: 1. packet_snd() only reset skb->mac_header when sock->type is SOCK_RAW and skb->protocol is not specified as in packet_parse_headers() 2. packet_direct_xmit() doesn't reset skb->mac_header as dev_queue_xmit() In this case, skb->mac_header is 65535 when ipvlan_xmit_mode_l2() is called. So when ipvlan_xmit_mode_l2() gets mac header with eth_hdr() which use "skb->head + skb->mac_header", out-of-bound access occurs. This patch replaces eth_hdr() with skb_eth_hdr() in ipvlan_xmit_mode_l2() and reset mac header in multicast to solve this out-of-bound bug. Fixes: 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.") Signed-off-by: Lu Wei Reviewed-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ipvlan/ipvlan_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_c= ore.c index 6ffb27419e64..c58123e13689 100644 --- a/drivers/net/ipvlan/ipvlan_core.c +++ b/drivers/net/ipvlan/ipvlan_core.c @@ -495,7 +495,6 @@ static int ipvlan_process_v6_outbound(struct sk_buff *s= kb) =20 static int ipvlan_process_outbound(struct sk_buff *skb) { - struct ethhdr *ethh =3D eth_hdr(skb); int ret =3D NET_XMIT_DROP; =20 /* The ipvlan is a pseudo-L2 device, so the packets that we receive @@ -505,6 +504,8 @@ static int ipvlan_process_outbound(struct sk_buff *skb) if (skb_mac_header_was_set(skb)) { /* In this mode we dont care about * multicast and broadcast traffic */ + struct ethhdr *ethh =3D eth_hdr(skb); + if (is_multicast_ether_addr(ethh->h_dest)) { pr_debug_ratelimited( "Dropped {multi|broad}cast of type=3D[%x]\n", @@ -589,7 +590,7 @@ static int ipvlan_xmit_mode_l3(struct sk_buff *skb, str= uct net_device *dev) static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev) { const struct ipvl_dev *ipvlan =3D netdev_priv(dev); - struct ethhdr *eth =3D eth_hdr(skb); + struct ethhdr *eth =3D skb_eth_hdr(skb); struct ipvl_addr *addr; void *lyr3h; int addr_type; @@ -619,6 +620,7 @@ static int ipvlan_xmit_mode_l2(struct sk_buff *skb, str= uct net_device *dev) return dev_forward_skb(ipvlan->phy_dev, skb); =20 } else if (is_multicast_ether_addr(eth->h_dest)) { + skb_reset_mac_header(skb); ipvlan_skb_crossing_ns(skb, NULL); ipvlan_multicast_enqueue(ipvlan->port, skb, true); return NET_XMIT_SUCCESS; --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B41FC6FA86 for ; Mon, 26 Sep 2022 11:45:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238084AbiIZLpf (ORCPT ); Mon, 26 Sep 2022 07:45:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238152AbiIZLmj (ORCPT ); Mon, 26 Sep 2022 07:42:39 -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 514987284E; Mon, 26 Sep 2022 03:46:09 -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 F10AB60BB7; Mon, 26 Sep 2022 10:46:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3CEBC433D6; Mon, 26 Sep 2022 10:46:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189168; bh=IqouZZ8ALTmkXXsRU/GXzfeJuXOM+fFuyOIgpdT7MMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k5fFAJzzVf/8rzPngVIfrZwO9vaG/Jj2fsBRoZsYOzERwFpKhSUkBqUDxuPk2uBej /He0+5QjmNX7LaTc/FIOqTT7MsMenWLrg0OpgHA90JQ8Csu1OGnwT/y+2aCvzJ2VhE UBgA8Ay+7DI5tHMr0i/tjkmN8j6yz67AYvQHkxoc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ludovic Cintrat , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 094/207] net: core: fix flow symmetric hash Date: Mon, 26 Sep 2022 12:11:23 +0200 Message-Id: <20220926100810.810141018@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ludovic Cintrat [ Upstream commit 64ae13ed478428135cddc2f1113dff162d8112d4 ] __flow_hash_consistentify() wrongly swaps ipv4 addresses in few cases. This function is indirectly used by __skb_get_hash_symmetric(), which is used to fanout packets in AF_PACKET. Intrusion detection systems may be impacted by this issue. __flow_hash_consistentify() computes the addresses difference then swaps them if the difference is negative. In few cases src - dst and dst - src are both negative. The following snippet mimics __flow_hash_consistentify(): ``` #include #include int main(int argc, char** argv) { int diffs_d, diffd_s; uint32_t dst =3D 0xb225a8c0; /* 178.37.168.192 --> 192.168.37.178 */ uint32_t src =3D 0x3225a8c0; /* 50.37.168.192 --> 192.168.37.50 */ uint32_t dst2 =3D 0x3325a8c0; /* 51.37.168.192 --> 192.168.37.51 */ diffs_d =3D src - dst; diffd_s =3D dst - src; printf("src:%08x dst:%08x, diff(s-d)=3D%d(0x%x) diff(d-s)=3D%d(0x%x)\n= ", src, dst, diffs_d, diffs_d, diffd_s, diffd_s); diffs_d =3D src - dst2; diffd_s =3D dst2 - src; printf("src:%08x dst:%08x, diff(s-d)=3D%d(0x%x) diff(d-s)=3D%d(0x%x)\n= ", src, dst2, diffs_d, diffs_d, diffd_s, diffd_s); return 0; } ``` Results: src:3225a8c0 dst:b225a8c0, \ diff(s-d)=3D-2147483648(0x80000000) \ diff(d-s)=3D-2147483648(0x80000000) src:3225a8c0 dst:3325a8c0, \ diff(s-d)=3D-16777216(0xff000000) \ diff(d-s)=3D16777216(0x1000000) In the first case the addresses differences are always < 0, therefore __flow_hash_consistentify() always swaps, thus dst->src and src->dst packets have differents hashes. Fixes: c3f8324188fa8 ("net: Add full IPv6 addresses to flow_keys") Signed-off-by: Ludovic Cintrat Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- net/core/flow_dissector.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 6aee04f75e3e..bcba61ef5b37 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -1572,9 +1572,8 @@ static inline void __flow_hash_consistentify(struct f= low_keys *keys) =20 switch (keys->control.addr_type) { case FLOW_DISSECTOR_KEY_IPV4_ADDRS: - addr_diff =3D (__force u32)keys->addrs.v4addrs.dst - - (__force u32)keys->addrs.v4addrs.src; - if (addr_diff < 0) + if ((__force u32)keys->addrs.v4addrs.dst < + (__force u32)keys->addrs.v4addrs.src) swap(keys->addrs.v4addrs.src, keys->addrs.v4addrs.dst); =20 if ((__force u16)keys->ports.dst < --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4348C32771 for ; Mon, 26 Sep 2022 11:46:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238671AbiIZLqr (ORCPT ); Mon, 26 Sep 2022 07:46:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238536AbiIZLno (ORCPT ); Mon, 26 Sep 2022 07:43:44 -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 B38C872ED4; Mon, 26 Sep 2022 03:46:27 -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 8F06DB80881; Mon, 26 Sep 2022 10:46:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01322C433C1; Mon, 26 Sep 2022 10:46:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189171; bh=Sm780qRk8F+ZTcd1ZBEChuYNOc8jrNgphySWx4jsQeI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YAMBuTX5GovGadW9Pd5JaW0zdki8nFbG/kOile2PGNfKTFAhtz0UvKs23Mx9p7gml QhmTHlEOHQBJA2VGyoA23O+JVH4CxL9oYl7hBPHa4R+CB/nxW+ZHHTGpVDxcG346Nb dXP5gh/2gm5jDksvMrtFRnfzWMA1qF7dnvFfAdh8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Emmanuel Grumbach , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 095/207] wifi: iwlwifi: Mark IWLMEI as broken Date: Mon, 26 Sep 2022 12:11:24 +0200 Message-Id: <20220926100810.858005608@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Toke H=C3=B8iland-J=C3=B8rgensen [ Upstream commit 8997f5c8a62760db69fd5c56116705796322c8ed ] The iwlmei driver breaks iwlwifi when returning from suspend. The interface ends up in the 'down' state after coming back from suspend. And iwd doesn't touch the interface state, but wpa_supplicant does, so the bug only happens= on iwd. The bug report[0] has been open for four months now, and no fix seems to be forthcoming. Since just disabling the iwlmei driver works as a workaround, let's mark the config option as broken until it can be fixed properly. [0] https://bugzilla.kernel.org/show_bug.cgi?id=3D215937 Fixes: 2da4366f9e2c ("iwlwifi: mei: add the driver to allow cooperation wit= h CSME") Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen Acked-by: Emmanuel Grumbach Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220907134450.1183045-1-toke@toke.dk Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/wireless/intel/iwlwifi/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/intel/iwlwifi/Kconfig b/drivers/net/wirel= ess/intel/iwlwifi/Kconfig index a647a406b87b..b20409f8c13a 100644 --- a/drivers/net/wireless/intel/iwlwifi/Kconfig +++ b/drivers/net/wireless/intel/iwlwifi/Kconfig @@ -140,6 +140,7 @@ config IWLMEI depends on INTEL_MEI depends on PM depends on CFG80211 + depends on BROKEN help Enables the iwlmei kernel module. =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D302C32771 for ; Mon, 26 Sep 2022 11:48:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238904AbiIZLsV (ORCPT ); Mon, 26 Sep 2022 07:48:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238514AbiIZLp7 (ORCPT ); Mon, 26 Sep 2022 07:45:59 -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 6441B74BB8; Mon, 26 Sep 2022 03:47:27 -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 02B4960A36; Mon, 26 Sep 2022 10:46:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1272BC433C1; Mon, 26 Sep 2022 10:46:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189174; bh=J/fD2m4D+RAJIbJ4ywOImke5ptOLROIsQy4z/Q0yhfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h/eo2cm+sOPOifoapjDiCahAh9cIiDQqypXjasoRFpkVeqJ6M2QINareJFUQdmVm3 CTAru0CkRofwwjJXJZzxjZvMYApCsAX0NB0isWUC94pdyK5cfOxaGnpekwkojdogPZ 1nzTNPtUL63OcLzJynBQlD/+Gib5pwVV959w4va4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabio Estevam , Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 5.19 096/207] arm64: dts: tqma8mqml: Include phy-imx8-pcie.h header Date: Mon, 26 Sep 2022 12:11:25 +0200 Message-Id: <20220926100810.894474099@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fabio Estevam [ Upstream commit 70ae49c5ac876f0f4689889588544104209c09c4 ] imx8mm-tqma8mqml.dtsi has PCIe support, so it should include . Otherwise, there are build errors when this SoM dtsi is included on customers' carrier boards. While at it, remove the PCI header from imx8mm-tqma8mqml-mba8mx.dts, which is now unneeded. Fixes: 1d84283101fc ("arm64: dts: tqma8mqml: add PCIe support") Signed-off-by: Fabio Estevam Reviewed-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts | 1 - arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml.dtsi | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts b/ar= ch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts index 286d2df01cfa..7e0aeb2db305 100644 --- a/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts +++ b/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts @@ -5,7 +5,6 @@ =20 /dts-v1/; =20 -#include #include "imx8mm-tqma8mqml.dtsi" #include "mba8mx.dtsi" =20 diff --git a/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml.dtsi b/arch/arm= 64/boot/dts/freescale/imx8mm-tqma8mqml.dtsi index 16ee9b5179e6..f649dfacb4b6 100644 --- a/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml.dtsi @@ -3,6 +3,7 @@ * Copyright 2020-2021 TQ-Systems GmbH */ =20 +#include #include "imx8mm.dtsi" =20 / { --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8AF76C6FA86 for ; Mon, 26 Sep 2022 11:46:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234743AbiIZLqB (ORCPT ); Mon, 26 Sep 2022 07:46:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238393AbiIZLnT (ORCPT ); Mon, 26 Sep 2022 07:43:19 -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 5CD4072B44; Mon, 26 Sep 2022 03:46:18 -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 DD75360BB7; Mon, 26 Sep 2022 10:46:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1302C433C1; Mon, 26 Sep 2022 10:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189177; bh=MhokY/H6jfSXEfkQdM9jnFl2MffCeSY9uW8BvSqVvUc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tLyUSJz8L+JKxXxhV2qbAsxp6wRBty3VJ8pwmOo4zU59xT74g8VxpxFQiZfbPI1gM qXb93YWT2ZfNAgQipGVj+LF0WnVomrkTUBJTuiezrcGlE9WlMJ2E5+YrVYy0h8EPJE gmsiu9jOD8Q6Y92uAOTxociSBCPmKXssevpmj2LU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yongqiang Niu , Allen-KH Cheng , Matthias Brugger , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 5.19 097/207] drm/mediatek: Fix wrong dither settings Date: Mon, 26 Sep 2022 12:11:26 +0200 Message-Id: <20220926100810.938068386@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Allen-KH Cheng [ Upstream commit 87fd9294e63e8fa7532b5e65b534c3001c654ef8 ] The width and height arguments in the cmdq packet for mtk_dither_config() are inverted. We fix the incorrect width and height for dither settings in mtk_dither_config(). Fixes: 73d3724745db ("drm/mediatek: Adjust to the alphabetic order for medi= atek-drm") Co-developed-by: Yongqiang Niu Signed-off-by: Yongqiang Niu Signed-off-by: Allen-KH Cheng Reviewed-by: Matthias Brugger Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20220908141= 205.18256-1-allen-kh.cheng@mediatek.com/ Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/= mediatek/mtk_drm_ddp_comp.c index 5d7504a72b11..e244aa408d9d 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c @@ -151,7 +151,7 @@ static void mtk_dither_config(struct device *dev, unsig= ned int w, { struct mtk_ddp_comp_dev *priv =3D dev_get_drvdata(dev); =20 - mtk_ddp_write(cmdq_pkt, h << 16 | w, &priv->cmdq_reg, priv->regs, DISP_RE= G_DITHER_SIZE); + mtk_ddp_write(cmdq_pkt, w << 16 | h, &priv->cmdq_reg, priv->regs, DISP_RE= G_DITHER_SIZE); mtk_ddp_write(cmdq_pkt, DITHER_RELAY_MODE, &priv->cmdq_reg, priv->regs, DISP_REG_DITHER_CFG); mtk_dither_set_common(priv->regs, &priv->cmdq_reg, bpc, DISP_REG_DITHER_C= FG, --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3844C6FA99 for ; Mon, 26 Sep 2022 11:59:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239517AbiIZL7G (ORCPT ); Mon, 26 Sep 2022 07:59:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238933AbiIZLyG (ORCPT ); Mon, 26 Sep 2022 07:54:06 -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 8BF851CFFC; Mon, 26 Sep 2022 03:49: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 ams.source.kernel.org (Postfix) with ESMTPS id 291C7B80171; Mon, 26 Sep 2022 10:48:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8409FC433D6; Mon, 26 Sep 2022 10:48:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189297; bh=9oFRFRIYT/AScc+7IeOp9jcmRxFBv+WVHTU+h3hZUaM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wgGgdIxIm50jzphqYoI1dFB7IHoaPWw3DNGlq7O9nzRtLpwv0SstXOU28Z1hFXpLT 6bOeFdKEopMV1p84DUTS7wpOsqeFGtG0Bef0OttLnFs8DCeXLByCQMpScgGNnhb6KA bvELjwhrX1jFhSrxaIVgBAMYKWlN9iYyL4pAdRTw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tim Harvey , Shawn Guo , Sasha Levin Subject: [PATCH 5.19 098/207] arm64: dts: imx8mp-venice-gw74xx: fix CAN STBY polarity Date: Mon, 26 Sep 2022 12:11:27 +0200 Message-Id: <20220926100810.977543818@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tim Harvey [ Upstream commit e4ef0885632ed485961ac0962ad01be4ec9ec658 ] The CAN STBY poarlity is active-low. Specify it as such by removing the 'enable-active-high' property and updating the gpio property. Fixes: 7899eb6cb15d ("arm64: dts: imx: Add i.MX8M Plus Gateworks gw7400 dts= support") Signed-off-by: Tim Harvey Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts b/arch/= arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts index 6630ec561dc2..4c729ac89625 100644 --- a/arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts +++ b/arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts @@ -123,8 +123,7 @@ reg_can2_stby: regulator-can2-stby { pinctrl-names =3D "default"; pinctrl-0 =3D <&pinctrl_reg_can>; regulator-name =3D "can2_stby"; - gpio =3D <&gpio3 19 GPIO_ACTIVE_HIGH>; - enable-active-high; + gpio =3D <&gpio3 19 GPIO_ACTIVE_LOW>; regulator-min-microvolt =3D <3300000>; regulator-max-microvolt =3D <3300000>; }; --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65A58C32771 for ; Mon, 26 Sep 2022 11:49:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238696AbiIZLtx (ORCPT ); Mon, 26 Sep 2022 07:49:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238830AbiIZLrt (ORCPT ); Mon, 26 Sep 2022 07:47:49 -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 6AB3974E0F; Mon, 26 Sep 2022 03:47:49 -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 D0F9A60A52; Mon, 26 Sep 2022 10:46:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D711EC433D7; Mon, 26 Sep 2022 10:46:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189201; bh=lwIyZVjOONZyJJFJ4pdVzDJFnzigEmBDRnrq+V3xZHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W5gp80oRQzUS78LgNr4e+BNSjpVoBwXuEFNFYBC5Xp1GEnMG8EYSnHyHjYb/NdiBT VQdWQLO91iSndY3gVSRdOMrSvaiyo5suxGBxQks5IXYVytIpp9fID4M20y+Kv6xYLH Ax7yO1qSlnMZ99fR87gFDnArVfSmSY9vXmDp3MoM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tim Harvey , Shawn Guo , Sasha Levin Subject: [PATCH 5.19 099/207] arm64: dts: imx8mp-venice-gw74xx: fix ksz9477 cpu port Date: Mon, 26 Sep 2022 12:11:28 +0200 Message-Id: <20220926100811.019228816@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tim Harvey [ Upstream commit c3681de3b8f2e8aff0306e2d6c129ca15b70b79d ] The CPU uplink port on the KSZ9477 is P5 not P6 - fix this. Fixes: 7899eb6cb15d ("arm64: dts: imx: Add i.MX8M Plus Gateworks gw7400 dts= support") Signed-off-by: Tim Harvey Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts b/arch/= arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts index 4c729ac89625..3df7ee9a2fe1 100644 --- a/arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts +++ b/arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts @@ -510,8 +510,8 @@ lan5: port@4 { local-mac-address =3D [00 00 00 00 00 00]; }; =20 - port@6 { - reg =3D <6>; + port@5 { + reg =3D <5>; label =3D "cpu"; ethernet =3D <&fec>; phy-mode =3D "rgmii-id"; --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCA2AC32771 for ; Mon, 26 Sep 2022 12:09:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239346AbiIZMJs (ORCPT ); Mon, 26 Sep 2022 08:09:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235272AbiIZMIU (ORCPT ); Mon, 26 Sep 2022 08:08:20 -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 C683D7FE46; Mon, 26 Sep 2022 03:56:07 -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 B72E6B802C5; Mon, 26 Sep 2022 10:47:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1331DC433D6; Mon, 26 Sep 2022 10:47:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189233; bh=bcAJ4z+RO/wsgHLdxnKwfFtoMvVcRDNQlF5P/39RL6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bYR3a68FD1S7J8esMZBXW55QiK5HYKNxAluagndrglfo0Y0t3H5EeRG1drFkejFok Y10ZsRlzYLNnvMW6h4GVS0znoB2Img92kkEZTd4fuUq1ZLCntRkjYDflTUitBAFYWg CApDiUkfWA9kEFN6ySomlfY3qMQ7kkrwr7nEsq2s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Horatiu Vultur , Claudiu Beznea , Sasha Levin Subject: [PATCH 5.19 100/207] ARM: dts: lan966x: Fix the interrupt number for internal PHYs Date: Mon, 26 Sep 2022 12:11:29 +0200 Message-Id: <20220926100811.060351218@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Horatiu Vultur [ Upstream commit f5fc22cbbdcd349402faaddf1a07eb8403658ae8 ] According to the datasheet the interrupts for internal PHYs are 80 and 81. Fixes: 6ad69e07def67c ("ARM: dts: lan966x: add MIIM nodes") Signed-off-by: Horatiu Vultur Signed-off-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220912192629.461452-1-horatiu.vultur@micr= ochip.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm/boot/dts/lan966x.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/lan966x.dtsi b/arch/arm/boot/dts/lan966x.dtsi index 38e90a31d2dd..25c19f9d0a12 100644 --- a/arch/arm/boot/dts/lan966x.dtsi +++ b/arch/arm/boot/dts/lan966x.dtsi @@ -515,13 +515,13 @@ mdio1: mdio@e200413c { =20 phy0: ethernet-phy@1 { reg =3D <1>; - interrupts =3D ; + interrupts =3D ; status =3D "disabled"; }; =20 phy1: ethernet-phy@2 { reg =3D <2>; - interrupts =3D ; + interrupts =3D ; status =3D "disabled"; }; }; --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 782F2C07E9D for ; Mon, 26 Sep 2022 12:12:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236771AbiIZMMl (ORCPT ); Mon, 26 Sep 2022 08:12:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239301AbiIZMMQ (ORCPT ); Mon, 26 Sep 2022 08:12:16 -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 5348383BD0; Mon, 26 Sep 2022 03:58: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 6AFC360A36; Mon, 26 Sep 2022 10:47:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 658ECC433B5; Mon, 26 Sep 2022 10:47:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189265; bh=MaRHsgu6x1R5SWPGz555MhiLnxi/cADJmYE8LEBbTcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PWS6jO3XDuYvAnxU7bsNFdGM1P6gRSPMX6fvq0kbL/qXErEmnsAWB8rjDCxogXCpB nDHhAUdJQpoJP7xV7Et4YniVdAnwscH8RWjkrXJNSv3TKSMCvFhccZBy3sMob8/0gE NfX7896VWOeLYcgtA7TLI+thx7PlorDSmnCh3nYk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ioana Ciornei , Andrew Lunn , Paolo Abeni , Sasha Levin Subject: [PATCH 5.19 101/207] net: phy: aquantia: wait for the suspend/resume operations to finish Date: Mon, 26 Sep 2022 12:11:30 +0200 Message-Id: <20220926100811.109439140@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ioana Ciornei [ Upstream commit ca2dccdeeb49a7e408112d681bf447984c845292 ] The Aquantia datasheet notes that after issuing a Processor-Intensive MDIO operation, like changing the low-power state of the device, the driver should wait for the operation to finish before issuing a new MDIO command. The new aqr107_wait_processor_intensive_op() function is added which can be used after these kind of MDIO operations. At the moment, we are only adding it at the end of the suspend/resume calls. The issue was identified on a board featuring the AQR113C PHY, on which commands like 'ip link (..) up / down' issued without any delays between them would render the link on the PHY to remain down. The issue was easy to reproduce with a one-liner: $ ip link set dev ethX down; ip link set dev ethX up; \ ip link set dev ethX down; ip link set dev ethX up; Fixes: ac9e81c230eb ("net: phy: aquantia: add suspend / resume callbacks fo= r AQR107 family") Signed-off-by: Ioana Ciornei Reviewed-by: Andrew Lunn Link: https://lore.kernel.org/r/20220906130451.1483448-1-ioana.ciornei@nxp.= com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/phy/aquantia_main.c | 53 ++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/aquantia_main.c b/drivers/net/phy/aquantia_mai= n.c index c7047f5d7a9b..8bc0957a0f6d 100644 --- a/drivers/net/phy/aquantia_main.c +++ b/drivers/net/phy/aquantia_main.c @@ -90,6 +90,9 @@ #define VEND1_GLOBAL_FW_ID_MAJOR GENMASK(15, 8) #define VEND1_GLOBAL_FW_ID_MINOR GENMASK(7, 0) =20 +#define VEND1_GLOBAL_GEN_STAT2 0xc831 +#define VEND1_GLOBAL_GEN_STAT2_OP_IN_PROG BIT(15) + #define VEND1_GLOBAL_RSVD_STAT1 0xc885 #define VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID GENMASK(7, 4) #define VEND1_GLOBAL_RSVD_STAT1_PROV_ID GENMASK(3, 0) @@ -124,6 +127,12 @@ #define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL2 BIT(1) #define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL3 BIT(0) =20 +/* Sleep and timeout for checking if the Processor-Intensive + * MDIO operation is finished + */ +#define AQR107_OP_IN_PROG_SLEEP 1000 +#define AQR107_OP_IN_PROG_TIMEOUT 100000 + struct aqr107_hw_stat { const char *name; int reg; @@ -596,16 +605,52 @@ static void aqr107_link_change_notify(struct phy_devi= ce *phydev) phydev_info(phydev, "Aquantia 1000Base-T2 mode active\n"); } =20 +static int aqr107_wait_processor_intensive_op(struct phy_device *phydev) +{ + int val, err; + + /* The datasheet notes to wait at least 1ms after issuing a + * processor intensive operation before checking. + * We cannot use the 'sleep_before_read' parameter of read_poll_timeout + * because that just determines the maximum time slept, not the minimum. + */ + usleep_range(1000, 5000); + + err =3D phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, + VEND1_GLOBAL_GEN_STAT2, val, + !(val & VEND1_GLOBAL_GEN_STAT2_OP_IN_PROG), + AQR107_OP_IN_PROG_SLEEP, + AQR107_OP_IN_PROG_TIMEOUT, false); + if (err) { + phydev_err(phydev, "timeout: processor-intensive MDIO operation\n"); + return err; + } + + return 0; +} + static int aqr107_suspend(struct phy_device *phydev) { - return phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1, - MDIO_CTRL1_LPOWER); + int err; + + err =3D phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1, + MDIO_CTRL1_LPOWER); + if (err) + return err; + + return aqr107_wait_processor_intensive_op(phydev); } =20 static int aqr107_resume(struct phy_device *phydev) { - return phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1, - MDIO_CTRL1_LPOWER); + int err; + + err =3D phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1, + MDIO_CTRL1_LPOWER); + if (err) + return err; + + return aqr107_wait_processor_intensive_op(phydev); } =20 static int aqr107_probe(struct phy_device *phydev) --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6504CC32771 for ; Mon, 26 Sep 2022 11:51:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238592AbiIZLvI (ORCPT ); Mon, 26 Sep 2022 07:51:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238663AbiIZLt3 (ORCPT ); Mon, 26 Sep 2022 07:49:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8DFC74DD9; Mon, 26 Sep 2022 03:48:02 -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 089C1B802C7; Mon, 26 Sep 2022 10:48:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55CB8C433B5; Mon, 26 Sep 2022 10:48:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189280; bh=Ct3miofx3F/zPwYmpdA0sas9EW659SuBF+YogFlBK7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jlch9tFw2PBu0K9YKwXPTvoP/x8L1xQZTk613enFthi6aSNr6XDYQgCmLJnhIiOJt hsVoz63gHHU/DhWIpVdk1tCYk7GSxAJK+3SuzyKG6ov712KItH9XkplbLRokLwh8DW 3pz94xwjSEdastSUsYmz7d7Y4Ihabgby1DI41+OQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tim Harvey , Shawn Guo , Sasha Levin Subject: [PATCH 5.19 102/207] arm64: dts: imx8mp-venice-gw74xx: fix port/phy validation Date: Mon, 26 Sep 2022 12:11:31 +0200 Message-Id: <20220926100811.157024871@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tim Harvey [ Upstream commit f7fc391a5e28216150ab5390df35032309ead7e5 ] Since commit 65ac79e18120 ("net: dsa: microchip: add the phylink get_caps") the phy-mode must be set otherwise the switch driver will assume "NA" mode and invalidate the port. Fixes: 7899eb6cb15d ("arm64: dts: imx: Add i.MX8M Plus Gateworks gw7400 dts= support") Signed-off-by: Tim Harvey Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts b/arch/= arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts index 3df7ee9a2fe1..211e6a1b296e 100644 --- a/arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts +++ b/arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts @@ -483,30 +483,35 @@ ports { lan1: port@0 { reg =3D <0>; label =3D "lan1"; + phy-mode =3D "internal"; local-mac-address =3D [00 00 00 00 00 00]; }; =20 lan2: port@1 { reg =3D <1>; label =3D "lan2"; + phy-mode =3D "internal"; local-mac-address =3D [00 00 00 00 00 00]; }; =20 lan3: port@2 { reg =3D <2>; label =3D "lan3"; + phy-mode =3D "internal"; local-mac-address =3D [00 00 00 00 00 00]; }; =20 lan4: port@3 { reg =3D <3>; label =3D "lan4"; + phy-mode =3D "internal"; local-mac-address =3D [00 00 00 00 00 00]; }; =20 lan5: port@4 { reg =3D <4>; label =3D "lan5"; + phy-mode =3D "internal"; local-mac-address =3D [00 00 00 00 00 00]; }; =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39DC6C07E9D for ; Mon, 26 Sep 2022 11:50:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238265AbiIZLuB (ORCPT ); Mon, 26 Sep 2022 07:50:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239007AbiIZLtB (ORCPT ); Mon, 26 Sep 2022 07:49:01 -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 2E24874E2D; Mon, 26 Sep 2022 03:48:04 -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 DB13060A52; Mon, 26 Sep 2022 10:48:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F25BFC433C1; Mon, 26 Sep 2022 10:48:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189283; bh=3XRtdySgANUF062d5PdoQWsO2QH60vfd36w+DOJ8NRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G9cdGlcgDWff5bi0HO3Fk8i31rF45nlMKJDOv2hV9/n86vezckUV6rUjhwdlsF/e5 TY7ITe7Hb+XPXv2qgxj0IGMnTasHF4PUl/crwoZywkPTUSii5aK29Z5zVRQDIeag/P TeNRtXTZiWbcTXdDtGopK2uxeSYrEMuvuNcFMqfU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Rafael Mendonca , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 103/207] scsi: qla2xxx: Fix memory leak in __qlt_24xx_handle_abts() Date: Mon, 26 Sep 2022 12:11:32 +0200 Message-Id: <20220926100811.206373132@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rafael Mendonca [ Upstream commit 601be20fc6a1b762044d2398befffd6bf236cebf ] Commit 8f394da36a36 ("scsi: qla2xxx: Drop TARGET_SCF_LOOKUP_LUN_FROM_TAG") made the __qlt_24xx_handle_abts() function return early if tcm_qla2xxx_find_cmd_by_tag() didn't find a command, but it missed to clean up the allocated memory for the management command. Link: https://lore.kernel.org/r/20220914024924.695604-1-rafaelmendsr@gmail.= com Fixes: 8f394da36a36 ("scsi: qla2xxx: Drop TARGET_SCF_LOOKUP_LUN_FROM_TAG") Reviewed-by: Himanshu Madhani Signed-off-by: Rafael Mendonca Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/scsi/qla2xxx/qla_target.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_t= arget.c index 62666df1a59e..4acff4e84b90 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -2151,8 +2151,10 @@ static int __qlt_24xx_handle_abts(struct scsi_qla_ho= st *vha, =20 abort_cmd =3D ha->tgt.tgt_ops->find_cmd_by_tag(sess, le32_to_cpu(abts->exchange_addr_to_abort)); - if (!abort_cmd) + if (!abort_cmd) { + mempool_free(mcmd, qla_tgt_mgmt_cmd_mempool); return -EIO; + } mcmd->unpacked_lun =3D abort_cmd->se_cmd.orig_fe_lun; =20 if (abort_cmd->qpair) { --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92CF3C32771 for ; Mon, 26 Sep 2022 12:07:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239363AbiIZMHG (ORCPT ); Mon, 26 Sep 2022 08:07:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239528AbiIZMEZ (ORCPT ); Mon, 26 Sep 2022 08:04:25 -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 8EE2DBB5; Mon, 26 Sep 2022 03:54:34 -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 AA77C60B6A; Mon, 26 Sep 2022 10:48:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7291C433D6; Mon, 26 Sep 2022 10:48:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189286; bh=4c+/ITZT6UkmkH+5mODA/xzxisTVTWlBXItVtDn7Gtw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JXfFfcasicZocpN1inUDMoZyV9xr0tzQ4gXCQneHsSHIBbOMjJIsf1LDrjNxNa5ja CwEh4E4auP07YaoxPU41WJGe3UcYUeCooT8XNVO7NAvgL4wtmnEmwBDPr81LPTf3Q5 GK19ygbtyB6u6UPvQ8JpcamlW7TwMnbOTpgMGkec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sreekanth Reddy , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 104/207] scsi: mpt3sas: Fix return value check of dma_get_required_mask() Date: Mon, 26 Sep 2022 12:11:33 +0200 Message-Id: <20220926100811.254873896@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sreekanth Reddy [ Upstream commit e0e0747de0ea3dd87cdbb0393311e17471a9baf1 ] Fix the incorrect return value check of dma_get_required_mask(). Due to this incorrect check, the driver was always setting the DMA mask to 63 bit. Link: https://lore.kernel.org/r/20220913120538.18759-2-sreekanth.reddy@broa= dcom.com Fixes: ba27c5cf286d ("scsi: mpt3sas: Don't change the DMA coherent mask aft= er allocations") Signed-off-by: Sreekanth Reddy Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/scsi/mpt3sas/mpt3sas_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt= 3sas_base.c index 9a1ae52bb621..a6d3471a6105 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -2993,7 +2993,7 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *i= oc, struct pci_dev *pdev) =20 if (ioc->is_mcpu_endpoint || sizeof(dma_addr_t) =3D=3D 4 || ioc->use_32bit_dma || - dma_get_required_mask(&pdev->dev) <=3D 32) + dma_get_required_mask(&pdev->dev) <=3D DMA_BIT_MASK(32)) ioc->dma_mask =3D 32; /* Set 63 bit DMA mask for all SAS3 and SAS35 controllers */ else if (ioc->hba_mpi_version_belonged > MPI2_VERSION) --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5768DC07E9D for ; Mon, 26 Sep 2022 11:57:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238960AbiIZL5C (ORCPT ); Mon, 26 Sep 2022 07:57:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239038AbiIZLyU (ORCPT ); Mon, 26 Sep 2022 07:54:20 -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 867B157E2E; Mon, 26 Sep 2022 03:50: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 9FE0C60AF3; Mon, 26 Sep 2022 10:48:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2835C433D6; Mon, 26 Sep 2022 10:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189289; bh=VyzeQ3A73WzZWuQ1QIIIEVGaB9CNiZoFtGOsM/3vM0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=COipS0xnPhmXjucJSSVpRXpMMUyoSCH+OmoCKBFmdAR3BuZgq6nvpSgyxLMhakrBu wSSLlFev6SY5GKAuxLLDro2A+cEkOl9K5YEEqSsr95Iw4NuGmfSKCy5R6NELQofrRI Arkx3T3jiIn/6cQ6ufKxTGv0CJtVJQ2eZK/o37fE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Poirier , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 105/207] net: bonding: Share lacpdu_mcast_addr definition Date: Mon, 26 Sep 2022 12:11:34 +0200 Message-Id: <20220926100811.294285540@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Benjamin Poirier [ Upstream commit 1d9a143ee3408349700f44a9197b7ae0e4faae5d ] There are already a few definitions of arrays containing MULTICAST_LACPDU_ADDR and the next patch will add one more use. These all contain the same constant data so define one common instance for all bonding code. Signed-off-by: Benjamin Poirier Signed-off-by: David S. Miller Stable-dep-of: 86247aba599e ("net: bonding: Unsync device addresses on ndo_= stop") Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/bonding/bond_3ad.c | 5 +++-- drivers/net/bonding/bond_main.c | 16 ++++------------ include/net/bond_3ad.h | 2 -- include/net/bonding.h | 3 +++ 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 1f0120cbe9e8..8ad095c19f27 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c @@ -87,8 +87,9 @@ static const u8 null_mac_addr[ETH_ALEN + 2] __long_aligne= d =3D { static u16 ad_ticks_per_sec; static const int ad_delta_in_ticks =3D (AD_TIMER_INTERVAL * HZ) / 1000; =20 -static const u8 lacpdu_mcast_addr[ETH_ALEN + 2] __long_aligned =3D - MULTICAST_LACPDU_ADDR; +const u8 lacpdu_mcast_addr[ETH_ALEN + 2] __long_aligned =3D { + 0x01, 0x80, 0xC2, 0x00, 0x00, 0x02 +}; =20 /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D main 802.3ad protoc= ol functions =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ static int ad_lacpdu_send(struct port *port); diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_mai= n.c index bff0bfd10e23..b159b73f2969 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -865,12 +865,8 @@ static void bond_hw_addr_flush(struct net_device *bond= _dev, dev_uc_unsync(slave_dev, bond_dev); dev_mc_unsync(slave_dev, bond_dev); =20 - if (BOND_MODE(bond) =3D=3D BOND_MODE_8023AD) { - /* del lacpdu mc addr from mc list */ - u8 lacpdu_multicast[ETH_ALEN] =3D MULTICAST_LACPDU_ADDR; - - dev_mc_del(slave_dev, lacpdu_multicast); - } + if (BOND_MODE(bond) =3D=3D BOND_MODE_8023AD) + dev_mc_del(slave_dev, lacpdu_mcast_addr); } =20 /*--------------------------- Active slave change ------------------------= ---*/ @@ -2144,12 +2140,8 @@ int bond_enslave(struct net_device *bond_dev, struct= net_device *slave_dev, dev_uc_sync_multiple(slave_dev, bond_dev); netif_addr_unlock_bh(bond_dev); =20 - if (BOND_MODE(bond) =3D=3D BOND_MODE_8023AD) { - /* add lacpdu mc addr to mc list */ - u8 lacpdu_multicast[ETH_ALEN] =3D MULTICAST_LACPDU_ADDR; - - dev_mc_add(slave_dev, lacpdu_multicast); - } + if (BOND_MODE(bond) =3D=3D BOND_MODE_8023AD) + dev_mc_add(slave_dev, lacpdu_mcast_addr); } =20 bond->slave_cnt++; diff --git a/include/net/bond_3ad.h b/include/net/bond_3ad.h index 184105d68294..f2273bd5a4c5 100644 --- a/include/net/bond_3ad.h +++ b/include/net/bond_3ad.h @@ -15,8 +15,6 @@ #define PKT_TYPE_LACPDU cpu_to_be16(ETH_P_SLOW) #define AD_TIMER_INTERVAL 100 /*msec*/ =20 -#define MULTICAST_LACPDU_ADDR {0x01, 0x80, 0xC2, 0x00, 0x00, 0x02} - #define AD_LACP_SLOW 0 #define AD_LACP_FAST 1 =20 diff --git a/include/net/bonding.h b/include/net/bonding.h index 3b816ae8b1f3..7ac1773b9922 100644 --- a/include/net/bonding.h +++ b/include/net/bonding.h @@ -785,6 +785,9 @@ extern struct rtnl_link_ops bond_link_ops; /* exported from bond_sysfs_slave.c */ extern const struct sysfs_ops slave_sysfs_ops; =20 +/* exported from bond_3ad.c */ +extern const u8 lacpdu_mcast_addr[]; + static inline netdev_tx_t bond_tx_drop(struct net_device *dev, struct sk_b= uff *skb) { dev_core_stats_tx_dropped_inc(dev); --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E56F6C32771 for ; Mon, 26 Sep 2022 12:21:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239309AbiIZMVW (ORCPT ); Mon, 26 Sep 2022 08:21:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238811AbiIZMUv (ORCPT ); Mon, 26 Sep 2022 08:20:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E5969321E; Mon, 26 Sep 2022 04:03:18 -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 F3ECE60BB9; Mon, 26 Sep 2022 10:48:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2D8AC433C1; Mon, 26 Sep 2022 10:48:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189292; bh=TSZDcOH64cG5bLuD6I8otvohyGpc8LDVUexcXSlAN8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1Lh/Zu/QRqaEYsE19SOgqdX/DjEBRAg5PVEV3edrhpuJy9GexU/KhpCcCVvmKQ794 SyeGWEi82dKyM98THlicy9wnrqfoWxMbUOltQUI1CH1ouKFM2O729Y8V/PQCH7sLzM r2F2QM/czSwcfC1LQiRUkWS95D/D+GtjdvLNVvQM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Poirier , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 106/207] net: bonding: Unsync device addresses on ndo_stop Date: Mon, 26 Sep 2022 12:11:35 +0200 Message-Id: <20220926100811.342154958@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Benjamin Poirier [ Upstream commit 86247aba599e5b07d7e828e6edaaebb0ef2b1158 ] Netdev drivers are expected to call dev_{uc,mc}_sync() in their ndo_set_rx_mode method and dev_{uc,mc}_unsync() in their ndo_stop method. This is mentioned in the kerneldoc for those dev_* functions. The bonding driver calls dev_{uc,mc}_unsync() during ndo_uninit instead of ndo_stop. This is ineffective because address lists (dev->{uc,mc}) have already been emptied in unregister_netdevice_many() before ndo_uninit is called. This mistake can result in addresses being leftover on former bond slaves after a bond has been deleted; see test_LAG_cleanup() in the last patch in this series. Add unsync calls, via bond_hw_addr_flush(), at their expected location, bond_close(). Add dev_mc_add() call to bond_open() to match the above change. v3: * When adding or deleting a slave, only sync/unsync, add/del addresses if the bond is up. In other cases, it is taken care of at the right time by ndo_open/ndo_set_rx_mode/ndo_stop. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Benjamin Poirier Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/bonding/bond_main.c | 47 ++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_mai= n.c index b159b73f2969..83852e6719e2 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -886,7 +886,8 @@ static void bond_hw_addr_swap(struct bonding *bond, str= uct slave *new_active, if (bond->dev->flags & IFF_ALLMULTI) dev_set_allmulti(old_active->dev, -1); =20 - bond_hw_addr_flush(bond->dev, old_active->dev); + if (bond->dev->flags & IFF_UP) + bond_hw_addr_flush(bond->dev, old_active->dev); } =20 if (new_active) { @@ -897,10 +898,12 @@ static void bond_hw_addr_swap(struct bonding *bond, s= truct slave *new_active, if (bond->dev->flags & IFF_ALLMULTI) dev_set_allmulti(new_active->dev, 1); =20 - netif_addr_lock_bh(bond->dev); - dev_uc_sync(new_active->dev, bond->dev); - dev_mc_sync(new_active->dev, bond->dev); - netif_addr_unlock_bh(bond->dev); + if (bond->dev->flags & IFF_UP) { + netif_addr_lock_bh(bond->dev); + dev_uc_sync(new_active->dev, bond->dev); + dev_mc_sync(new_active->dev, bond->dev); + netif_addr_unlock_bh(bond->dev); + } } } =20 @@ -2135,13 +2138,15 @@ int bond_enslave(struct net_device *bond_dev, struc= t net_device *slave_dev, } } =20 - netif_addr_lock_bh(bond_dev); - dev_mc_sync_multiple(slave_dev, bond_dev); - dev_uc_sync_multiple(slave_dev, bond_dev); - netif_addr_unlock_bh(bond_dev); + if (bond_dev->flags & IFF_UP) { + netif_addr_lock_bh(bond_dev); + dev_mc_sync_multiple(slave_dev, bond_dev); + dev_uc_sync_multiple(slave_dev, bond_dev); + netif_addr_unlock_bh(bond_dev); =20 - if (BOND_MODE(bond) =3D=3D BOND_MODE_8023AD) - dev_mc_add(slave_dev, lacpdu_mcast_addr); + if (BOND_MODE(bond) =3D=3D BOND_MODE_8023AD) + dev_mc_add(slave_dev, lacpdu_mcast_addr); + } } =20 bond->slave_cnt++; @@ -2412,7 +2417,8 @@ static int __bond_release_one(struct net_device *bond= _dev, if (old_flags & IFF_ALLMULTI) dev_set_allmulti(slave_dev, -1); =20 - bond_hw_addr_flush(bond_dev, slave_dev); + if (old_flags & IFF_UP) + bond_hw_addr_flush(bond_dev, slave_dev); } =20 slave_disable_netpoll(slave); @@ -4186,6 +4192,9 @@ static int bond_open(struct net_device *bond_dev) /* register to receive LACPDUs */ bond->recv_probe =3D bond_3ad_lacpdu_recv; bond_3ad_initiate_agg_selection(bond, 1); + + bond_for_each_slave(bond, slave, iter) + dev_mc_add(slave->dev, lacpdu_mcast_addr); } =20 if (bond_mode_can_use_xmit_hash(bond)) @@ -4197,6 +4206,7 @@ static int bond_open(struct net_device *bond_dev) static int bond_close(struct net_device *bond_dev) { struct bonding *bond =3D netdev_priv(bond_dev); + struct slave *slave; =20 bond_work_cancel_all(bond); bond->send_peer_notif =3D 0; @@ -4204,6 +4214,19 @@ static int bond_close(struct net_device *bond_dev) bond_alb_deinitialize(bond); bond->recv_probe =3D NULL; =20 + if (bond_uses_primary(bond)) { + rcu_read_lock(); + slave =3D rcu_dereference(bond->curr_active_slave); + if (slave) + bond_hw_addr_flush(bond_dev, slave->dev); + rcu_read_unlock(); + } else { + struct list_head *iter; + + bond_for_each_slave(bond, slave, iter) + bond_hw_addr_flush(bond_dev, slave->dev); + } + return 0; } =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9600AC07E9D for ; Mon, 26 Sep 2022 11:55:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238769AbiIZLxf (ORCPT ); Mon, 26 Sep 2022 07:53:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238333AbiIZLwp (ORCPT ); Mon, 26 Sep 2022 07:52:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30A0F77551; Mon, 26 Sep 2022 03:49: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 dfw.source.kernel.org (Postfix) with ESMTPS id BA09A60A52; Mon, 26 Sep 2022 10:48:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBA77C433B5; Mon, 26 Sep 2022 10:48:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189295; bh=3IXoiwJCIaDbKrUUDVRIb5inhLm3+M4M/BB1M6oB4Yc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EL4beRqxpczSBp/EudM5XpE4j38TKSsnJZQXq0WO79jDdeU23SzL64XyKfxo8V2Vi ApKEuUCP//9ORLh7hWsRB5tdrJVgI5/76aLpxhORqD3N0QCrydbnaj7aFRrstNyjNk UjuRpa05NpdsBkUyxxnmf8qpknYPgZ3sx+vQkVao= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Poirier , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 107/207] net: team: Unsync device addresses on ndo_stop Date: Mon, 26 Sep 2022 12:11:36 +0200 Message-Id: <20220926100811.387642363@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Benjamin Poirier [ Upstream commit bd60234222b2fd5573526da7bcd422801f271f5f ] Netdev drivers are expected to call dev_{uc,mc}_sync() in their ndo_set_rx_mode method and dev_{uc,mc}_unsync() in their ndo_stop method. This is mentioned in the kerneldoc for those dev_* functions. The team driver calls dev_{uc,mc}_unsync() during ndo_uninit instead of ndo_stop. This is ineffective because address lists (dev->{uc,mc}) have already been emptied in unregister_netdevice_many() before ndo_uninit is called. This mistake can result in addresses being leftover on former team ports after a team device has been deleted; see test_LAG_cleanup() in the last patch in this series. Add unsync calls at their expected location, team_close(). v3: * When adding or deleting a port, only sync/unsync addresses if the team device is up. In other cases, it is taken care of at the right time by ndo_open/ndo_set_rx_mode/ndo_stop. Fixes: 3d249d4ca7d0 ("net: introduce ethernet teaming device") Signed-off-by: Benjamin Poirier Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/team/team.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index b07dde6f0abf..b9899913d246 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -1275,10 +1275,12 @@ static int team_port_add(struct team *team, struct = net_device *port_dev, } } =20 - netif_addr_lock_bh(dev); - dev_uc_sync_multiple(port_dev, dev); - dev_mc_sync_multiple(port_dev, dev); - netif_addr_unlock_bh(dev); + if (dev->flags & IFF_UP) { + netif_addr_lock_bh(dev); + dev_uc_sync_multiple(port_dev, dev); + dev_mc_sync_multiple(port_dev, dev); + netif_addr_unlock_bh(dev); + } =20 port->index =3D -1; list_add_tail_rcu(&port->list, &team->port_list); @@ -1349,8 +1351,10 @@ static int team_port_del(struct team *team, struct n= et_device *port_dev) netdev_rx_handler_unregister(port_dev); team_port_disable_netpoll(port); vlan_vids_del_by_dev(port_dev, dev); - dev_uc_unsync(port_dev, dev); - dev_mc_unsync(port_dev, dev); + if (dev->flags & IFF_UP) { + dev_uc_unsync(port_dev, dev); + dev_mc_unsync(port_dev, dev); + } dev_close(port_dev); team_port_leave(team, port); =20 @@ -1700,6 +1704,14 @@ static int team_open(struct net_device *dev) =20 static int team_close(struct net_device *dev) { + struct team *team =3D netdev_priv(dev); + struct team_port *port; + + list_for_each_entry(port, &team->port_list, list) { + dev_uc_unsync(port->dev, dev); + dev_mc_unsync(port->dev, dev); + } + return 0; } =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43013C32771 for ; Mon, 26 Sep 2022 13:27:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234183AbiIZN1Q (ORCPT ); Mon, 26 Sep 2022 09:27:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234275AbiIZN0w (ORCPT ); Mon, 26 Sep 2022 09:26:52 -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 E43F775FD7; Mon, 26 Sep 2022 04:51:39 -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 4623AB80691; Mon, 26 Sep 2022 10:46:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE715C433D6; Mon, 26 Sep 2022 10:46:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189204; bh=8Av7/e3VDqxsQaUnOOUZQ42WRu1s+S3WKW+HmkedUAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1XVD2hoFZcviqgypLvLmQIycBKA9evZDEBI7SVH7381czKyb4C/5sUVKQy+PO1kA8 dIzg0VNWwEcJ8zkXr4wCuR4Zf2EecuebSjPxnMoO/8HHkbDsVmS2fqwB/wf+Uhb1c2 GxjFvGhkb1CCtUy3/EmPCmCfSmfzRvIl/BksAZhg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Schocher , Fabio Estevam , Marek Vasut , Sasha Levin Subject: [PATCH 5.19 108/207] drm/panel: simple: Fix innolux_g121i1_l01 bus_format Date: Mon, 26 Sep 2022 12:11:37 +0200 Message-Id: <20220926100811.434576489@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Heiko Schocher [ Upstream commit a7c48a0ab87ae52c087d663e83e56b8225ac4cce ] innolux_g121i1_l01 sets bpc to 6, so use the corresponding bus format: MEDIA_BUS_FMT_RGB666_1X7X3_SPWG. Fixes: 4ae13e486866 ("drm/panel: simple: Add more properties to Innolux G12= 1I1-L01") Signed-off-by: Heiko Schocher Signed-off-by: Fabio Estevam Signed-off-by: Marek Vasut Link: https://patchwork.freedesktop.org/patch/msgid/20220826165021.1592532-= 1-festevam@denx.de Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/panel/panel-simple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/p= anel-simple.c index 4a2e580a2f7b..0e001ce8a40f 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -2136,7 +2136,7 @@ static const struct panel_desc innolux_g121i1_l01 =3D= { .enable =3D 200, .disable =3D 20, }, - .bus_format =3D MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, + .bus_format =3D MEDIA_BUS_FMT_RGB666_1X7X3_SPWG, .connector_type =3D DRM_MODE_CONNECTOR_LVDS, }; =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C455FC6FA86 for ; Mon, 26 Sep 2022 12:14:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239340AbiIZMOY (ORCPT ); Mon, 26 Sep 2022 08:14:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239584AbiIZMNn (ORCPT ); Mon, 26 Sep 2022 08:13:43 -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 0B0194F196; Mon, 26 Sep 2022 03:58:49 -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 76762604F5; Mon, 26 Sep 2022 10:46:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 836CFC43141; Mon, 26 Sep 2022 10:46:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189206; bh=8J29lsujgPPQZQZIeLZnW3XufyGdE1hUpb/14e0fxFo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cv3YF2GY+5wbh2+IvUW8zi/lnwgFrIjqjBhQXz0QdfbWPl4axVtT8SBb8nqPtBqu1 FthoFNX+7R6/i8Pqk9Hn7cHYCdCRJwJq87pyZFfIYZUQB5mzIcf+PECWtPunGUviwB 1SuOmbdLOex6qzoKHWN7b5argC/KReeVxItSTXck= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Feng Tang , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Waiman Long , Vlastimil Babka , Sasha Levin Subject: [PATCH 5.19 109/207] mm/slab_common: fix possible double free of kmem_cache Date: Mon, 26 Sep 2022 12:11:38 +0200 Message-Id: <20220926100811.481562993@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Feng Tang [ Upstream commit d71608a877362becdc94191f190902fac1e64d35 ] When doing slub_debug test, kfence's 'test_memcache_typesafe_by_rcu' kunit test case cause a use-after-free error: BUG: KASAN: use-after-free in kobject_del+0x14/0x30 Read of size 8 at addr ffff888007679090 by task kunit_try_catch/261 CPU: 1 PID: 261 Comm: kunit_try_catch Tainted: G B N 6.0.0-= rc5-next-20220916 #17 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/0= 1/2014 Call Trace: dump_stack_lvl+0x34/0x48 print_address_description.constprop.0+0x87/0x2a5 print_report+0x103/0x1ed kasan_report+0xb7/0x140 kobject_del+0x14/0x30 kmem_cache_destroy+0x130/0x170 test_exit+0x1a/0x30 kunit_try_run_case+0xad/0xc0 kunit_generic_run_threadfn_adapter+0x26/0x50 kthread+0x17b/0x1b0 The cause is inside kmem_cache_destroy(): kmem_cache_destroy acquire lock/mutex shutdown_cache schedule_work(kmem_cache_release) (if RCU flag set) release lock/mutex kmem_cache_release (if RCU flag not set) In some certain timing, the scheduled work could be run before the next RCU flag checking, which can then get a wrong value and lead to double kmem_cache_release(). Fix it by caching the RCU flag inside protected area, just like 'refcnt' Fixes: 0495e337b703 ("mm/slab_common: Deleting kobject in kmem_cache_destro= y() without holding slab_mutex/cpu_hotplug_lock") Signed-off-by: Feng Tang Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Reviewed-by: Waiman Long Signed-off-by: Vlastimil Babka Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- mm/slab_common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index dbd4b6f9b0e7..29ae1358d5f0 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -503,6 +503,7 @@ void slab_kmem_cache_release(struct kmem_cache *s) void kmem_cache_destroy(struct kmem_cache *s) { int refcnt; + bool rcu_set; =20 if (unlikely(!s) || !kasan_check_byte(s)) return; @@ -510,6 +511,8 @@ void kmem_cache_destroy(struct kmem_cache *s) cpus_read_lock(); mutex_lock(&slab_mutex); =20 + rcu_set =3D s->flags & SLAB_TYPESAFE_BY_RCU; + refcnt =3D --s->refcount; if (refcnt) goto out_unlock; @@ -520,7 +523,7 @@ void kmem_cache_destroy(struct kmem_cache *s) out_unlock: mutex_unlock(&slab_mutex); cpus_read_unlock(); - if (!refcnt && !(s->flags & SLAB_TYPESAFE_BY_RCU)) + if (!refcnt && !rcu_set) kmem_cache_release(s); } EXPORT_SYMBOL(kmem_cache_destroy); --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAE8CC07E9D for ; Mon, 26 Sep 2022 11:50:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238381AbiIZLuH (ORCPT ); Mon, 26 Sep 2022 07:50:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239020AbiIZLtF (ORCPT ); Mon, 26 Sep 2022 07:49:05 -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 2DFCA57201; Mon, 26 Sep 2022 03:48:04 -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 F1C07B80171; Mon, 26 Sep 2022 10:46:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56DC2C433C1; Mon, 26 Sep 2022 10:46:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189209; bh=FGL8GAtxfMw4n0JvjxgP9LDX324kIAJjB3fsedpwHWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qS1xfuibYClXLDgk3xDCQSMh1DWwEvPW2KjG4z2X9RgSuQasFTaxBN+fefe0njhqn mXrX0p1L7t6y1O9AdzF28lo/y9spGz6ff5G2U+pxAjfj0o8TvfbsKpDnbCGD1lrJ/F 801ehcMPKGx2Wv4ZVstyT2ffNpHimSoPylkVLQWE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , kernel test robot , Thomas Bogendoerfer , John Crispin , linux-mips@vger.kernel.org, Sasha Levin Subject: [PATCH 5.19 110/207] MIPS: lantiq: export clk_get_io() for lantiq_wdt.ko Date: Mon, 26 Sep 2022 12:11:39 +0200 Message-Id: <20220926100811.527633314@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Randy Dunlap [ Upstream commit 502550123bee6a2ffa438409b5b9aad4d6db3a8c ] The lantiq WDT driver uses clk_get_io(), which is not exported, so export it to fix a build error: ERROR: modpost: "clk_get_io" [drivers/watchdog/lantiq_wdt.ko] undefined! Fixes: 287e3f3f4e68 ("MIPS: lantiq: implement support for clkdev api") Signed-off-by: Randy Dunlap Reported-by: kernel test robot Cc: Thomas Bogendoerfer Cc: John Crispin Cc: linux-mips@vger.kernel.org Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/mips/lantiq/clk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/lantiq/clk.c b/arch/mips/lantiq/clk.c index 7a623684d9b5..2d5a0bcb0cec 100644 --- a/arch/mips/lantiq/clk.c +++ b/arch/mips/lantiq/clk.c @@ -50,6 +50,7 @@ struct clk *clk_get_io(void) { return &cpu_clk_generic[2]; } +EXPORT_SYMBOL_GPL(clk_get_io); =20 struct clk *clk_get_ppe(void) { --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 675FFC32771 for ; Mon, 26 Sep 2022 12:17:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239436AbiIZMR2 (ORCPT ); Mon, 26 Sep 2022 08:17:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239427AbiIZMRA (ORCPT ); Mon, 26 Sep 2022 08:17:00 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BA775C9CA; Mon, 26 Sep 2022 04:00:35 -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 sin.source.kernel.org (Postfix) with ESMTPS id 88A71CE1106; Mon, 26 Sep 2022 10:46:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B52DC433C1; Mon, 26 Sep 2022 10:46:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189212; bh=kEcA/9wTN6peHSuhYVAET0L6NbfiIGmPkAVhetaQM1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AL3hqc/LcGdXPXi4idT9xcID6Kpx9DgRWDM3jBXYOWOFTURKnIky16/361WafocRh 6xpIp/xdrx2ZF0/t+bqOhmUQMj+bi2fYpAIwVHQyCCRpEkmIaLwx0YWGXvF1ulJks9 8sNwvC2lyR1dUFTUzxwTDCTlWVk7PekN/zN7dBjU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Keguang Zhang , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.19 111/207] MIPS: Loongson32: Fix PHY-mode being left unspecified Date: Mon, 26 Sep 2022 12:11:40 +0200 Message-Id: <20220926100811.574990556@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit e9f3f8f488005f6da3cfb66070706770ecaef747 ] commit 0060c8783330 ("net: stmmac: implement support for passive mode converters via dt") has changed the plat->interface field semantics from containing the PHY-mode to specifying the MAC-PCS interface mode. Due to that the loongson32 platform code will leave the phylink interface uninitialized with the PHY-mode intended by the means of the actual platform setup. The commit-author most likely has just missed the arch-specific code to fix. Let's mend the Loongson32 platform code then by assigning the PHY-mode to the phy_interface field of the STMMAC platform data. Fixes: 0060c8783330 ("net: stmmac: implement support for passive mode conve= rters via dt") Signed-off-by: Serge Semin Signed-off-by: Keguang Zhang Tested-by: Keguang Zhang Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/mips/loongson32/common/platform.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/mips/loongson32/common/platform.c b/arch/mips/loongson32/= common/platform.c index 794c96c2a4cd..311dc1580bbd 100644 --- a/arch/mips/loongson32/common/platform.c +++ b/arch/mips/loongson32/common/platform.c @@ -98,7 +98,7 @@ int ls1x_eth_mux_init(struct platform_device *pdev, void = *priv) if (plat_dat->bus_id) { __raw_writel(__raw_readl(LS1X_MUX_CTRL0) | GMAC1_USE_UART1 | GMAC1_USE_UART0, LS1X_MUX_CTRL0); - switch (plat_dat->interface) { + switch (plat_dat->phy_interface) { case PHY_INTERFACE_MODE_RGMII: val &=3D ~(GMAC1_USE_TXCLK | GMAC1_USE_PWM23); break; @@ -107,12 +107,12 @@ int ls1x_eth_mux_init(struct platform_device *pdev, v= oid *priv) break; default: pr_err("unsupported mii mode %d\n", - plat_dat->interface); + plat_dat->phy_interface); return -ENOTSUPP; } val &=3D ~GMAC1_SHUT; } else { - switch (plat_dat->interface) { + switch (plat_dat->phy_interface) { case PHY_INTERFACE_MODE_RGMII: val &=3D ~(GMAC0_USE_TXCLK | GMAC0_USE_PWM01); break; @@ -121,7 +121,7 @@ int ls1x_eth_mux_init(struct platform_device *pdev, voi= d *priv) break; default: pr_err("unsupported mii mode %d\n", - plat_dat->interface); + plat_dat->phy_interface); return -ENOTSUPP; } val &=3D ~GMAC0_SHUT; @@ -131,7 +131,7 @@ int ls1x_eth_mux_init(struct platform_device *pdev, voi= d *priv) plat_dat =3D dev_get_platdata(&pdev->dev); =20 val &=3D ~PHY_INTF_SELI; - if (plat_dat->interface =3D=3D PHY_INTERFACE_MODE_RMII) + if (plat_dat->phy_interface =3D=3D PHY_INTERFACE_MODE_RMII) val |=3D 0x4 << PHY_INTF_SELI_SHIFT; __raw_writel(val, LS1X_MUX_CTRL1); =20 @@ -146,9 +146,9 @@ static struct plat_stmmacenet_data ls1x_eth0_pdata =3D { .bus_id =3D 0, .phy_addr =3D -1, #if defined(CONFIG_LOONGSON1_LS1B) - .interface =3D PHY_INTERFACE_MODE_MII, + .phy_interface =3D PHY_INTERFACE_MODE_MII, #elif defined(CONFIG_LOONGSON1_LS1C) - .interface =3D PHY_INTERFACE_MODE_RMII, + .phy_interface =3D PHY_INTERFACE_MODE_RMII, #endif .mdio_bus_data =3D &ls1x_mdio_bus_data, .dma_cfg =3D &ls1x_eth_dma_cfg, @@ -186,7 +186,7 @@ struct platform_device ls1x_eth0_pdev =3D { static struct plat_stmmacenet_data ls1x_eth1_pdata =3D { .bus_id =3D 1, .phy_addr =3D -1, - .interface =3D PHY_INTERFACE_MODE_MII, + .phy_interface =3D PHY_INTERFACE_MODE_MII, .mdio_bus_data =3D &ls1x_mdio_bus_data, .dma_cfg =3D &ls1x_eth_dma_cfg, .has_gmac =3D 1, --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06EE9C32771 for ; Mon, 26 Sep 2022 11:50:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238599AbiIZLuk (ORCPT ); Mon, 26 Sep 2022 07:50:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239084AbiIZLtS (ORCPT ); Mon, 26 Sep 2022 07:49:18 -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 0212B75CE8; Mon, 26 Sep 2022 03:48:18 -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 1FE47B80835; Mon, 26 Sep 2022 10:46:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66600C433C1; Mon, 26 Sep 2022 10:46:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189215; bh=qYDUVPcIKSYGJQ6zNzCwrkC/y4sC7sO2DLHi4sBmVCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rr5qnVl64QG/VF27vdF/pKdvHpQveei0z6843s9JjE17m6yCM/eXm2IuhTAxNAYM5 PwbQqf1OMLcAQwRRaVvUxBC9F+BwIRA/LCANEVJgDDAI3VGfVJnUBIlvlpY0CV7wZ5 h/BkK1vFFy3UIOWAYWA1fU3JLbOLgz9nh9Pg7Tg0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Meyer , Christian Lamparter , Richard Weinberger , Sasha Levin Subject: [PATCH 5.19 112/207] um: fix default console kernel parameter Date: Mon, 26 Sep 2022 12:11:41 +0200 Message-Id: <20220926100811.621399975@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Lamparter [ Upstream commit 782b1f70f8a8b28571949d2ba43fe88b96d75ec3 ] OpenWrt's UML with 5.15 was producing odd errors/warnings during preinit part of the early userspace portion: |[ 0.000000] Kernel command line: ubd0=3Droot.img root=3D98:0 console=3D= tty |[...] |[ 0.440000] random: jshn: uninitialized urandom read (4 bytes read) |[ 0.460000] random: jshn: uninitialized urandom read (4 bytes read) |/etc/preinit: line 47: can't create /dev/tty: No such device or address |/etc/preinit: line 48: can't create /dev/tty: No such device or address |/etc/preinit: line 58: can't open /dev/tty: No such device or address |[...] repeated many times That "/dev/tty" came from the command line (which is automatically added if no console=3D parameter was specified for the uml binary). The TLDP project tells the following about the /dev/tty: | /dev/tty stands for the controlling terminal (if any) for the current | process.[...] | /dev/tty is something like a link to the actually terminal device[..] The "(if any)" is important here, since it's possible for processes to not have a controlling terminal. I think this was a simple typo and the author wanted tty0 there. CC: Thomas Meyer Fixes: d7ffac33631b ("um: stdio_console: Make preferred console") Signed-off-by: Christian Lamparter Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/um/kernel/um_arch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index e0de60e503b9..d9e023c78f56 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -33,7 +33,7 @@ #include "um_arch.h" =20 #define DEFAULT_COMMAND_LINE_ROOT "root=3D98:0" -#define DEFAULT_COMMAND_LINE_CONSOLE "console=3Dtty" +#define DEFAULT_COMMAND_LINE_CONSOLE "console=3Dtty0" =20 /* Changed in add_arg and setup_arch, which run before SMP is started */ static char __initdata command_line[COMMAND_LINE_SIZE] =3D { 0 }; --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8390FC07E9D for ; Mon, 26 Sep 2022 11:52:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238637AbiIZLw1 (ORCPT ); Mon, 26 Sep 2022 07:52:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238525AbiIZLvt (ORCPT ); Mon, 26 Sep 2022 07:51:49 -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 7D05B76751; Mon, 26 Sep 2022 03:48: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 6F9B260B4A; Mon, 26 Sep 2022 10:46:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65952C433D6; Mon, 26 Sep 2022 10:46:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189218; bh=klu/CdF2GgcnLipy5mv8tLdF/E32HaFbW96q4R9qV+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EDoE596Xd2FjObqJHpJEHkq/kVQ4dGG8zp9GrBJhTFf5dyQifF9Bzp+QGDZmVY6DX ULjMu1IKxCo1T9FOSKnTXMhRKSOum1FJmQxIXfuIL89Gj5wXBYbDv6zV0tpRrtsI+n 1HhkRrX6AeTR1uA/X+HKStXx2GNOVbOHzHbM940I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Norbert Zulinski , Mateusz Palczewski , Konrad Jankowski , Tony Nguyen , Sasha Levin Subject: [PATCH 5.19 113/207] iavf: Fix bad page state Date: Mon, 26 Sep 2022 12:11:42 +0200 Message-Id: <20220926100811.659677514@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Norbert Zulinski [ Upstream commit 66039eb9015eee4f7ff0c99b83c65c7ecb3c8190 ] Fix bad page state, free inappropriate page in handling dummy descriptor. iavf_build_skb now has to check not only if rx_buffer is NULL but also if size is zero, same thing in iavf_clean_rx_irq. Without this patch driver would free page that will be used by napi_build_skb. Fixes: a9f49e006030 ("iavf: Fix handling of dummy receive descriptors") Signed-off-by: Norbert Zulinski Signed-off-by: Mateusz Palczewski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/intel/iavf/iavf_txrx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_txrx.c b/drivers/net/ethe= rnet/intel/iavf/iavf_txrx.c index 4c3f3f419110..18b6a702a1d6 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_txrx.c +++ b/drivers/net/ethernet/intel/iavf/iavf_txrx.c @@ -1393,7 +1393,7 @@ static struct sk_buff *iavf_build_skb(struct iavf_rin= g *rx_ring, #endif struct sk_buff *skb; =20 - if (!rx_buffer) + if (!rx_buffer || !size) return NULL; /* prefetch first cache line of first page */ va =3D page_address(rx_buffer->page) + rx_buffer->page_offset; @@ -1551,7 +1551,7 @@ static int iavf_clean_rx_irq(struct iavf_ring *rx_rin= g, int budget) /* exit if we failed to retrieve a buffer */ if (!skb) { rx_ring->rx_stats.alloc_buff_failed++; - if (rx_buffer) + if (rx_buffer && size) rx_buffer->pagecnt_bias++; break; } --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2213AC32771 for ; Mon, 26 Sep 2022 12:03:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239292AbiIZMDZ (ORCPT ); Mon, 26 Sep 2022 08:03:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239068AbiIZMB1 (ORCPT ); Mon, 26 Sep 2022 08:01:27 -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 46E5F7CB67; Mon, 26 Sep 2022 03:53:35 -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 EB031B8068A; Mon, 26 Sep 2022 10:47:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35454C433C1; Mon, 26 Sep 2022 10:47:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189221; bh=EoTDOZ3ScaqUAIbjG9EFK7bEbq9tw34AGEsQsy2xItA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YeyhtOrNOlM7otsY1NXdGf36zk9unV/XPFb6EGTfoTsfTxundRIlhA47OUMVJEMEw YvM3whskDkOc3uJCQuZI4JcdfOO8x2WUHn0SMGO57RAziwCFwrQoLxkOgkvtioUVnu IKkqpsu6aiDJtfKA1snjJAjxabD9YAtcAcMo8uU8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Asmaa Mnebhi , David Thompson , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 114/207] mlxbf_gige: clear MDIO gateway lock after read Date: Mon, 26 Sep 2022 12:11:43 +0200 Message-Id: <20220926100811.689568267@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: David Thompson [ Upstream commit 182447b12144b7be9b63a273d27c5a11bd54960a ] The MDIO gateway (GW) lock in BlueField-2 GIGE logic is set after read. This patch adds logic to make sure the lock is always cleared at the end of each MDIO transaction. Fixes: f92e1869d74e ("Add Mellanox BlueField Gigabit Ethernet driver") Reviewed-by: Asmaa Mnebhi Signed-off-by: David Thompson Link: https://lore.kernel.org/r/20220902164247.19862-1-davthompson@nvidia.c= om Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c b/d= rivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c index 85155cd9405c..4aeb927c3715 100644 --- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c +++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c @@ -179,6 +179,9 @@ static int mlxbf_gige_mdio_read(struct mii_bus *bus, in= t phy_add, int phy_reg) /* Only return ad bits of the gw register */ ret &=3D MLXBF_GIGE_MDIO_GW_AD_MASK; =20 + /* The MDIO lock is set on read. To release it, clear gw register */ + writel(0, priv->mdio_io + MLXBF_GIGE_MDIO_GW_OFFSET); + return ret; } =20 @@ -203,6 +206,9 @@ static int mlxbf_gige_mdio_write(struct mii_bus *bus, i= nt phy_add, temp, !(temp & MLXBF_GIGE_MDIO_GW_BUSY_MASK), 5, 1000000); =20 + /* The MDIO lock is set on read. To release it, clear gw register */ + writel(0, priv->mdio_io + MLXBF_GIGE_MDIO_GW_OFFSET); + return ret; } =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0E36C07E9D for ; Mon, 26 Sep 2022 12:06:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239053AbiIZMGb (ORCPT ); Mon, 26 Sep 2022 08:06:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239267AbiIZMCt (ORCPT ); Mon, 26 Sep 2022 08:02: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 929D27D1D8; Mon, 26 Sep 2022 03:53: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 ams.source.kernel.org (Postfix) with ESMTPS id ADA53B807E4; Mon, 26 Sep 2022 10:47:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0ECA6C433C1; Mon, 26 Sep 2022 10:47:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189224; bh=eZm7nHvFtOIw2E1+dT0JW8yHPtluDDjIlsK7hVGysow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wxKzpKle1s90MecNXdzG7qSvbWbCJU0e0VAr+xO6MQzjweiFGGvi0qZDABtyDaguX 2Icw1Fezy7HLc4unmXOPPIb9Z2q8uP/BMjNBfh8oA53RC91+t5feLnAuCuYwTsV6+w cCDdhBOd20pyaJL/8x/i1FXbHEHmgtSoeAiOGqlE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Jaron , Mateusz Palczewski , Konrad Jankowski , Tony Nguyen , Sasha Levin Subject: [PATCH 5.19 115/207] iavf: Fix set max MTU size with port VLAN and jumbo frames Date: Mon, 26 Sep 2022 12:11:44 +0200 Message-Id: <20220926100811.728898661@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Jaron [ Upstream commit 399c98c4dc50b7eb7e9f24da7ffdda6f025676ef ] After setting port VLAN and MTU to 9000 on VF with ice driver there was an iavf error "PF returned error -5 (IAVF_ERR_PARAM) to our request 6". During queue configuration, VF's max packet size was set to IAVF_MAX_RXBUFFER but on ice max frame size was smaller by VLAN_HLEN due to making some space for port VLAN as VF is not aware whether it's in a port VLAN. This mismatch in sizes caused ice to reject queue configuration with ERR_PARAM error. Proper max_mtu is sent from ice PF to VF with GET_VF_RESOURCES msg but VF does not look at this. In iavf change max_frame from IAVF_MAX_RXBUFFER to max_mtu received from pf with GET_VF_RESOURCES msg to make vf's max_frame_size dependent from pf. Add check if received max_mtu is not in eligible range then set it to IAVF_MAX_RXBUFFER. Fixes: dab86afdbbd1 ("i40e/i40evf: Change the way we limit the maximum fram= e size for Rx") Signed-off-by: Michal Jaron Signed-off-by: Mateusz Palczewski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/intel/iavf/iavf_virtchnl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/= ethernet/intel/iavf/iavf_virtchnl.c index 1603e99bae4a..498797a0a0a9 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c @@ -273,11 +273,14 @@ int iavf_get_vf_vlan_v2_caps(struct iavf_adapter *ada= pter) void iavf_configure_queues(struct iavf_adapter *adapter) { struct virtchnl_vsi_queue_config_info *vqci; - struct virtchnl_queue_pair_info *vqpi; + int i, max_frame =3D adapter->vf_res->max_mtu; int pairs =3D adapter->num_active_queues; - int i, max_frame =3D IAVF_MAX_RXBUFFER; + struct virtchnl_queue_pair_info *vqpi; size_t len; =20 + if (max_frame > IAVF_MAX_RXBUFFER || !max_frame) + max_frame =3D IAVF_MAX_RXBUFFER; + if (adapter->current_op !=3D VIRTCHNL_OP_UNKNOWN) { /* bail because we already have a command pending */ dev_err(&adapter->pdev->dev, "Cannot configure queues, command %d pendin= g\n", --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34C75C32771 for ; Mon, 26 Sep 2022 11:51:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238669AbiIZLvC (ORCPT ); Mon, 26 Sep 2022 07:51:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238654AbiIZLt3 (ORCPT ); Mon, 26 Sep 2022 07:49:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4AE2753BE; Mon, 26 Sep 2022 03:48:18 -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 C6FD1B80782; Mon, 26 Sep 2022 10:47:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C8E6C433C1; Mon, 26 Sep 2022 10:47:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189227; bh=JPaDt2jOgKHg1AcO/GhZXdMVpJycjDBqY17J3Th7bP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MidLz36vArzNXgGvDWQYtO77Ty/ZpmXQBcpDMy0i/j/jYgbGxef6mS0igWe6k5V8v Pa6bjDkSt2lu8+VwPXtpjnL75A0SEyzMRFXpQNWjmj1bMmu1vyaOf+kqxSXLiWuj4+ KffQzquTL672oSUyzUMoA5waXTON4PIhMkUMEKcA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Jaron , Mateusz Palczewski , Konrad Jankowski , Tony Nguyen , Sasha Levin Subject: [PATCH 5.19 116/207] i40e: Fix VF set max MTU size Date: Mon, 26 Sep 2022 12:11:45 +0200 Message-Id: <20220926100811.759453439@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Jaron [ Upstream commit 372539def2824c43b6afe2403045b140f65c5acc ] Max MTU sent to VF is set to 0 during memory allocation. It cause that max MTU on VF is changed to IAVF_MAX_RXBUFFER and does not depend on data from HW. Set max_mtu field in virtchnl_vf_resource struct to inform VF in GET_VF_RESOURCES msg what size should be max frame. Fixes: dab86afdbbd1 ("i40e/i40evf: Change the way we limit the maximum fram= e size for Rx") Signed-off-by: Michal Jaron Signed-off-by: Mateusz Palczewski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/n= et/ethernet/intel/i40e/i40e_virtchnl_pf.c index 86b0f21287dc..67fbaaad3985 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -2038,6 +2038,25 @@ static void i40e_del_qch(struct i40e_vf *vf) } } =20 +/** + * i40e_vc_get_max_frame_size + * @vf: pointer to the VF + * + * Max frame size is determined based on the current port's max frame size= and + * whether a port VLAN is configured on this VF. The VF is not aware wheth= er + * it's in a port VLAN so the PF needs to account for this in max frame si= ze + * checks and sending the max frame size to the VF. + **/ +static u16 i40e_vc_get_max_frame_size(struct i40e_vf *vf) +{ + u16 max_frame_size =3D vf->pf->hw.phy.link_info.max_frame_size; + + if (vf->port_vlan_id) + max_frame_size -=3D VLAN_HLEN; + + return max_frame_size; +} + /** * i40e_vc_get_vf_resources_msg * @vf: pointer to the VF info @@ -2139,6 +2158,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_v= f *vf, u8 *msg) vfres->max_vectors =3D pf->hw.func_caps.num_msix_vectors_vf; vfres->rss_key_size =3D I40E_HKEY_ARRAY_SIZE; vfres->rss_lut_size =3D I40E_VF_HLUT_ARRAY_SIZE; + vfres->max_mtu =3D i40e_vc_get_max_frame_size(vf); =20 if (vf->lan_vsi_idx) { vfres->vsi_res[0].vsi_id =3D vf->lan_vsi_id; --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1818AC32771 for ; Mon, 26 Sep 2022 11:48:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238856AbiIZLsA (ORCPT ); Mon, 26 Sep 2022 07:48:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239009AbiIZLp3 (ORCPT ); Mon, 26 Sep 2022 07:45:29 -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 A5F7F74B8B; Mon, 26 Sep 2022 03:47:32 -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 094AA6091B; Mon, 26 Sep 2022 10:47:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1798BC433D6; Mon, 26 Sep 2022 10:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189230; bh=//PfJCoEyTrljqbE4OWLLOv8jZmqrAbR59FigrF2KLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GV9MDuTF2ThAuD8fN0yYqLoXi9TzxRPjAU/CJUVNpv8rVfiTmQu6kzGWfza3mnlEG 7y+j6hGVV0D8KQSsF+O2jT1LmX3BJSPGSG9Dxu/3YwQqRIyF/doMzDDzNTssMLTRfT XnzmDTsLA5h+1XspMnV23uF9n77aHinNcH8meBjM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Jaron , Andrii Staikov , Bharathi Sreenivas , Tony Nguyen , Sasha Levin Subject: [PATCH 5.19 117/207] i40e: Fix set max_tx_rate when it is lower than 1 Mbps Date: Mon, 26 Sep 2022 12:11:46 +0200 Message-Id: <20220926100811.809210326@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Jaron [ Upstream commit 198eb7e1b81d8ba676d0f4f120c092032ae69a8e ] While converting max_tx_rate from bytes to Mbps, this value was set to 0, if the original value was lower than 125000 bytes (1 Mbps). This would cause no transmission rate limiting to occur. This happened due to lack of check of max_tx_rate against the 1 Mbps value for max_tx_rate and the following division by 125000. Fix this issue by adding a helper i40e_bw_bytes_to_mbits() which sets max_tx_rate to minimum usable value of 50 Mbps, if its value is less than 1 Mbps, otherwise do the required conversion by dividing by 125000. Fixes: 5ecae4120a6b ("i40e: Refactor VF BW rate limiting") Signed-off-by: Michal Jaron Signed-off-by: Andrii Staikov Tested-by: Bharathi Sreenivas Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/intel/i40e/i40e_main.c | 32 +++++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethe= rnet/intel/i40e/i40e_main.c index 1aaf0c5ddf6c..57e27f2024d3 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -5785,6 +5785,26 @@ static int i40e_get_link_speed(struct i40e_vsi *vsi) } } =20 +/** + * i40e_bw_bytes_to_mbits - Convert max_tx_rate from bytes to mbits + * @vsi: Pointer to vsi structure + * @max_tx_rate: max TX rate in bytes to be converted into Mbits + * + * Helper function to convert units before send to set BW limit + **/ +static u64 i40e_bw_bytes_to_mbits(struct i40e_vsi *vsi, u64 max_tx_rate) +{ + if (max_tx_rate < I40E_BW_MBPS_DIVISOR) { + dev_warn(&vsi->back->pdev->dev, + "Setting max tx rate to minimum usable value of 50Mbps.\n"); + max_tx_rate =3D I40E_BW_CREDIT_DIVISOR; + } else { + do_div(max_tx_rate, I40E_BW_MBPS_DIVISOR); + } + + return max_tx_rate; +} + /** * i40e_set_bw_limit - setup BW limit for Tx traffic based on max_tx_rate * @vsi: VSI to be configured @@ -5807,10 +5827,10 @@ int i40e_set_bw_limit(struct i40e_vsi *vsi, u16 sei= d, u64 max_tx_rate) max_tx_rate, seid); return -EINVAL; } - if (max_tx_rate && max_tx_rate < 50) { + if (max_tx_rate && max_tx_rate < I40E_BW_CREDIT_DIVISOR) { dev_warn(&pf->pdev->dev, "Setting max tx rate to minimum usable value of 50Mbps.\n"); - max_tx_rate =3D 50; + max_tx_rate =3D I40E_BW_CREDIT_DIVISOR; } =20 /* Tx rate credits are in values of 50Mbps, 0 is disabled */ @@ -8101,9 +8121,9 @@ static int i40e_setup_tc(struct net_device *netdev, v= oid *type_data) =20 if (i40e_is_tc_mqprio_enabled(pf)) { if (vsi->mqprio_qopt.max_rate[0]) { - u64 max_tx_rate =3D vsi->mqprio_qopt.max_rate[0]; + u64 max_tx_rate =3D i40e_bw_bytes_to_mbits(vsi, + vsi->mqprio_qopt.max_rate[0]); =20 - do_div(max_tx_rate, I40E_BW_MBPS_DIVISOR); ret =3D i40e_set_bw_limit(vsi, vsi->seid, max_tx_rate); if (!ret) { u64 credits =3D max_tx_rate; @@ -10848,10 +10868,10 @@ static void i40e_rebuild(struct i40e_pf *pf, bool= reinit, bool lock_acquired) } =20 if (vsi->mqprio_qopt.max_rate[0]) { - u64 max_tx_rate =3D vsi->mqprio_qopt.max_rate[0]; + u64 max_tx_rate =3D i40e_bw_bytes_to_mbits(vsi, + vsi->mqprio_qopt.max_rate[0]); u64 credits =3D 0; =20 - do_div(max_tx_rate, I40E_BW_MBPS_DIVISOR); ret =3D i40e_set_bw_limit(vsi, vsi->seid, max_tx_rate); if (ret) goto end_unlock; --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4B58C32771 for ; Mon, 26 Sep 2022 11:47:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238545AbiIZLru (ORCPT ); Mon, 26 Sep 2022 07:47:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238947AbiIZLpT (ORCPT ); Mon, 26 Sep 2022 07:45:19 -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 0F6B47437C; Mon, 26 Sep 2022 03:47: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 88723B80925; Mon, 26 Sep 2022 10:47:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE6A7C433D7; Mon, 26 Sep 2022 10:47:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189236; bh=lhsCTra1pGvb3ZPd7KNTAV+pfCo3UKjrsSqyyZHmfss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tQrRzImbqcUIF4kz8RqD7sxVeJDbOExsRKfsskjCunxjawBbccRu8Cs74C3cWw4ZV +n9joSMv8ZqKhok6MydTd12vmEm3q7slyBGnACsjDEg7A6X64ETIjdTqce4UQIymMD NMh4Bx9LINFj8RXezHZyidGxabZHUn0krhSGUF70= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jie2x Zhou , Ido Schimmel , Petr Machata , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 118/207] netdevsim: Fix hwstats debugfs file permissions Date: Mon, 26 Sep 2022 12:11:47 +0200 Message-Id: <20220926100811.846001745@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ido Schimmel [ Upstream commit 34513ada53eb3e3f711250d8dbc2de4de493d510 ] The hwstats debugfs files are only writeable, but they are created with read and write permissions, causing certain selftests to fail [1]. Fix by creating the files with write permission only. [1] # ./test_offload.py Test destruction of generic XDP... Traceback (most recent call last): File "/home/idosch/code/linux/tools/testing/selftests/bpf/./test_offload= .py", line 810, in simdev =3D NetdevSimDev() [...] Exception: Command failed: cat /sys/kernel/debug/netdevsim/netdevsim0//por= ts/0/dev/hwstats/l3/disable_ifindex cat: /sys/kernel/debug/netdevsim/netdevsim0//ports/0/dev/hwstats/l3/disabl= e_ifindex: Invalid argument Fixes: 1a6d7ae7d63c ("netdevsim: Introduce support for L3 offload xstats") Reported-by: Jie2x Zhou Tested-by: Jie2x Zhou Signed-off-by: Ido Schimmel Reviewed-by: Petr Machata Link: https://lore.kernel.org/r/20220909153830.3732504-1-idosch@nvidia.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/netdevsim/hwstats.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/netdevsim/hwstats.c b/drivers/net/netdevsim/hwstat= s.c index 605a38e16db0..0e58aa7f0374 100644 --- a/drivers/net/netdevsim/hwstats.c +++ b/drivers/net/netdevsim/hwstats.c @@ -433,11 +433,11 @@ int nsim_dev_hwstats_init(struct nsim_dev *nsim_dev) goto err_remove_hwstats_recursive; } =20 - debugfs_create_file("enable_ifindex", 0600, hwstats->l3_ddir, hwstats, + debugfs_create_file("enable_ifindex", 0200, hwstats->l3_ddir, hwstats, &nsim_dev_hwstats_l3_enable_fops.fops); - debugfs_create_file("disable_ifindex", 0600, hwstats->l3_ddir, hwstats, + debugfs_create_file("disable_ifindex", 0200, hwstats->l3_ddir, hwstats, &nsim_dev_hwstats_l3_disable_fops.fops); - debugfs_create_file("fail_next_enable", 0600, hwstats->l3_ddir, hwstats, + debugfs_create_file("fail_next_enable", 0200, hwstats->l3_ddir, hwstats, &nsim_dev_hwstats_l3_fail_fops.fops); =20 INIT_DELAYED_WORK(&hwstats->traffic_dw, --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17E5AC32771 for ; Mon, 26 Sep 2022 11:48:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235040AbiIZLsD (ORCPT ); Mon, 26 Sep 2022 07:48:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239011AbiIZLp3 (ORCPT ); Mon, 26 Sep 2022 07:45:29 -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 0819774CE4; Mon, 26 Sep 2022 03:47:32 -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 01AB060BB7; Mon, 26 Sep 2022 10:47:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CECCAC433D6; Mon, 26 Sep 2022 10:47:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189239; bh=hQcWRXxZ4BZEXkkxaFOZs/IaqlSrhGIRXSNxcRDbbQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UYgSCgVXWSZ4xCO8ABbn1I65uxXSdWxACKirBbENqHzyS27jwGYxh3YB53y4/GgD+ QR4RO1NZx3WdJSo8jcrsqbNGikWtH26NwY03IwaN/G7qHQY8QCoczBH9Zx3VdDVDlz rsMkX9IcXx9sh8KG1fCV2Mt97TfLV8l/Q4OzqdYU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tianhao Zhao , =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= , Edward Cree , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 119/207] sfc: fix TX channel offset when using legacy interrupts Date: Mon, 26 Sep 2022 12:11:48 +0200 Message-Id: <20220926100811.892001916@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: =C3=8D=C3=B1igo Huguet [ Upstream commit f232af4295653afa4ade3230462b3be15ad16419 ] In legacy interrupt mode the tx_channel_offset was hardcoded to 1, but that's not correct if efx_sepparate_tx_channels is false. In that case, the offset is 0 because the tx queues are in the single existing channel at index 0, together with the rx queue. Without this fix, as soon as you try to send any traffic, it tries to get the tx queues from an uninitialized channel getting these errors: WARNING: CPU: 1 PID: 0 at drivers/net/ethernet/sfc/tx.c:540 efx_hard_star= t_xmit+0x12e/0x170 [sfc] [...] RIP: 0010:efx_hard_start_xmit+0x12e/0x170 [sfc] [...] Call Trace: dev_hard_start_xmit+0xd7/0x230 sch_direct_xmit+0x9f/0x360 __dev_queue_xmit+0x890/0xa40 [...] BUG: unable to handle kernel NULL pointer dereference at 0000000000000020 [...] RIP: 0010:efx_hard_start_xmit+0x153/0x170 [sfc] [...] Call Trace: dev_hard_start_xmit+0xd7/0x230 sch_direct_xmit+0x9f/0x360 __dev_queue_xmit+0x890/0xa40 [...] Fixes: c308dfd1b43e ("sfc: fix wrong tx channel offset with efx_separate_tx= _channels") Reported-by: Tianhao Zhao Signed-off-by: =C3=8D=C3=B1igo Huguet Acked-by: Edward Cree Link: https://lore.kernel.org/r/20220914103648.16902-1-ihuguet@redhat.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/sfc/efx_channels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/sfc/efx_channels.c b/drivers/net/ethernet= /sfc/efx_channels.c index 032b8c0bd788..5b4d661ab986 100644 --- a/drivers/net/ethernet/sfc/efx_channels.c +++ b/drivers/net/ethernet/sfc/efx_channels.c @@ -319,7 +319,7 @@ int efx_probe_interrupts(struct efx_nic *efx) efx->n_channels =3D 1 + (efx_separate_tx_channels ? 1 : 0); efx->n_rx_channels =3D 1; efx->n_tx_channels =3D 1; - efx->tx_channel_offset =3D 1; + efx->tx_channel_offset =3D efx_separate_tx_channels ? 1 : 0; efx->n_xdp_channels =3D 0; efx->xdp_channel_offset =3D efx->n_channels; efx->legacy_irq =3D efx->pci_dev->irq; --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79470C32771 for ; Mon, 26 Sep 2022 11:48:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238915AbiIZLsY (ORCPT ); Mon, 26 Sep 2022 07:48:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238393AbiIZLqC (ORCPT ); Mon, 26 Sep 2022 07:46:02 -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 337C774346; Mon, 26 Sep 2022 03:47:35 -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 E2E4E60BAA; Mon, 26 Sep 2022 10:47:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2A78C433C1; Mon, 26 Sep 2022 10:47:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189242; bh=DsKjnZ4x2S6AWzYKSIX0+p/vijGEZh6XriUnf40hdao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AohMUNLZACJ0kMQph38boMS0RApKkS1gAkSvATT7Q5M3w+Rlk6+nckPrD3pEdjxtf HIhdOYbYZK7Sr78iAM7wsCZVdFVxBinouBO3C6exSwYs+EXMxivX9RtS8q2nyK6oP0 NI4iTdWppWLQLcYqFjr9UxwRcBroAE01KGEPMuIA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tianhao Zhao , =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= , Edward Cree , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 120/207] sfc: fix null pointer dereference in efx_hard_start_xmit Date: Mon, 26 Sep 2022 12:11:49 +0200 Message-Id: <20220926100811.937789679@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: =C3=8D=C3=B1igo Huguet [ Upstream commit 0a242eb2913a4aa3d6fbdb86559f27628e9466f3 ] Trying to get the channel from the tx_queue variable here is wrong because we can only be here if tx_queue is NULL, so we shouldn't dereference it. As the above comment in the code says, this is very unlikely to happen, but it's wrong anyway so let's fix it. I hit this issue because of a different bug that caused tx_queue to be NULL. If that happens, this is the error message that we get here: BUG: unable to handle kernel NULL pointer dereference at 0000000000000020 [...] RIP: 0010:efx_hard_start_xmit+0x153/0x170 [sfc] Fixes: 12804793b17c ("sfc: decouple TXQ type from label") Reported-by: Tianhao Zhao Signed-off-by: =C3=8D=C3=B1igo Huguet Acked-by: Edward Cree Link: https://lore.kernel.org/r/20220914111135.21038-1-ihuguet@redhat.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/sfc/tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c index 138bca611341..80ed7f760bd3 100644 --- a/drivers/net/ethernet/sfc/tx.c +++ b/drivers/net/ethernet/sfc/tx.c @@ -549,7 +549,7 @@ netdev_tx_t efx_hard_start_xmit(struct sk_buff *skb, * previous packets out. */ if (!netdev_xmit_more()) - efx_tx_send_pending(tx_queue->channel); + efx_tx_send_pending(efx_get_tx_channel(efx, index)); return NETDEV_TX_OK; } =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D73A5C07E9D for ; Mon, 26 Sep 2022 11:48:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238878AbiIZLsI (ORCPT ); Mon, 26 Sep 2022 07:48:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239029AbiIZLpd (ORCPT ); Mon, 26 Sep 2022 07:45:33 -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 B7EA874CF4; Mon, 26 Sep 2022 03:47:35 -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 9BA4660B6A; Mon, 26 Sep 2022 10:47:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FD4BC433C1; Mon, 26 Sep 2022 10:47:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189245; bh=5pzVapFewRf8dhts3wO4wAqPZZ8cp8qrxhoG9oAqP6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q/bA145+XMfKKB4f30s5M94WBJnKhmy4Z+rLBCP44LJgaxRnnbIRQ6gTNzsbLG4r9 CHd9U5+Czkz3eWk4HT13cmdLS+8LGAWYG319PFlkGj4IHmvY2yRO0WprptQzY0xH3i IF6y1tgLMp+1A3QVM56xeEJgB2buknz0SwPJ1tMM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Cochran , Vadim Fedorenko , Andy Gospodarek , Michael Chan , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 121/207] bnxt_en: fix flags to check for supported fw version Date: Mon, 26 Sep 2022 12:11:50 +0200 Message-Id: <20220926100811.984660365@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vadim Fedorenko [ Upstream commit ae8ffba8baad651af706538e8c47d0a049d406c6 ] The warning message of unsupported FW appears every time RX timestamps are disabled on the interface. The patch fixes the flags to correct set for the check. Fixes: 66ed81dcedc6 ("bnxt_en: Enable packet timestamping for all RX packet= s") Cc: Richard Cochran Signed-off-by: Vadim Fedorenko Reviewed-by: Andy Gospodarek Reviewed-by: Michael Chan Link: https://lore.kernel.org/r/20220915234932.25497-1-vfedorenko@novek.ru Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c b/drivers/net/et= hernet/broadcom/bnxt/bnxt_ptp.c index 7f3c0875b6f5..8e316367f6ce 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c @@ -317,9 +317,9 @@ void bnxt_ptp_cfg_tstamp_filters(struct bnxt *bp) =20 if (!(bp->fw_cap & BNXT_FW_CAP_RX_ALL_PKT_TS) && (ptp->tstamp_filters & (PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_ENABLE | - PORT_MAC_CFG_REQ_FLAGS_PTP_RX_TS_CAPTURE_DISABLE))) { + PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_DISABLE))) { ptp->tstamp_filters &=3D ~(PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_ENAB= LE | - PORT_MAC_CFG_REQ_FLAGS_PTP_RX_TS_CAPTURE_DISABLE); + PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_DISABLE); netdev_warn(bp->dev, "Unsupported FW for all RX pkts timestamp filter\n"= ); } =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24FD2C07E9D for ; Mon, 26 Sep 2022 11:48:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238886AbiIZLsO (ORCPT ); Mon, 26 Sep 2022 07:48:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238253AbiIZLpi (ORCPT ); Mon, 26 Sep 2022 07:45:38 -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 EB2D474DC2; Mon, 26 Sep 2022 03:47:37 -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 609CA6068C; Mon, 26 Sep 2022 10:47:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75059C433C1; Mon, 26 Sep 2022 10:47:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189247; bh=xXaYM+/QW243fqLUdMzgr5aSFHN50zkuiC7q6wscQzg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ylln0ij+JAcJZzt0Xc7TNb5RcQ9apNtIPU+IWmwsyrnLG0sdSQS9aCzCDLEEOp7Eq KQ1nLeSGq2kvgaUWW5Sm5wQuDcFhknfpBdTHAX8w8fyqoJRaXYFR1/xIbjlHdTOPHl rhMF77T7LkVy0ck9igV7CqdO0wGhe1464gC3kgTM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shailend Chand , Jeroen de Borst , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 122/207] gve: Fix GFP flags when allocing pages Date: Mon, 26 Sep 2022 12:11:51 +0200 Message-Id: <20220926100812.032687082@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shailend Chand [ Upstream commit 8ccac4edc8da764389d4fc18b1df740892006557 ] Use GFP_ATOMIC when allocating pages out of the hotpath, continue to use GFP_KERNEL when allocating pages during setup. GFP_KERNEL will allow blocking which allows it to succeed more often in a low memory enviornment but in the hotpath we do not want to allow the allocation to block. Fixes: 9b8dd5e5ea48b ("gve: DQO: Add RX path") Signed-off-by: Shailend Chand Signed-off-by: Jeroen de Borst Link: https://lore.kernel.org/r/20220913000901.959546-1-jeroendb@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/google/gve/gve_rx_dqo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/google/gve/gve_rx_dqo.c b/drivers/net/eth= ernet/google/gve/gve_rx_dqo.c index 8c939628e2d8..2e6461b0ea8b 100644 --- a/drivers/net/ethernet/google/gve/gve_rx_dqo.c +++ b/drivers/net/ethernet/google/gve/gve_rx_dqo.c @@ -157,7 +157,7 @@ static int gve_alloc_page_dqo(struct gve_priv *priv, int err; =20 err =3D gve_alloc_page(priv, &priv->pdev->dev, &buf_state->page_info.page, - &buf_state->addr, DMA_FROM_DEVICE, GFP_KERNEL); + &buf_state->addr, DMA_FROM_DEVICE, GFP_ATOMIC); if (err) return err; =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4E35C07E9D for ; Mon, 26 Sep 2022 12:20:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237007AbiIZMUB (ORCPT ); Mon, 26 Sep 2022 08:20:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236937AbiIZMTb (ORCPT ); Mon, 26 Sep 2022 08:19:31 -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 EDC4890802; Mon, 26 Sep 2022 04:02:13 -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 08226B808BE; Mon, 26 Sep 2022 10:47:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38377C433D7; Mon, 26 Sep 2022 10:47:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189250; bh=9Its7ESIwbnKfkGFB0GStUYtp3szj+6k5k8Re0jSq90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DCdGcChZAFSKYkdoTiJgg//yjaz6Se3JhG+TM+m4rPMukUbKBtQbq07VSuE5qRdcG dvcE3AWVBDCnEyPdu5TLHBEO75/wrNwcyEaDR7jqF89LF5K5m06EHRHsrpSFHjwDV1 /4JET3cvXce6/p/MxCLKpE9tl4D/HshnyCYIICpM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Gerd Hoffmann , Thomas Zimmermann , Xinliang Liu , Tian Tao , John Stultz , Xinwei Kong , Chen Feng , Christian Koenig , Huang Rui , David Airlie , Daniel Vetter , Javier Martinez Canillas , Sasha Levin Subject: [PATCH 5.19 123/207] drm/hisilicon: Add depends on MMU Date: Mon, 26 Sep 2022 12:11:52 +0200 Message-Id: <20220926100812.080079054@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Randy Dunlap [ Upstream commit d8a79c03054911c375a2252627a429c9bc4615b6 ] The Kconfig symbol depended on MMU but was dropped by the commit acad3fe650a5 ("drm/hisilicon: Removed the dependency on the mmu") because it already had as a dependency ARM64 that already selects MMU. But later, commit a0f25a6bb319 ("drm/hisilicon/hibmc: Allow to be built if COMPILE_TEST is enabled") allowed the driver to be built for non-ARM64 when COMPILE_TEST is set but that could lead to unmet direct dependencies and linking errors. Prevent a kconfig warning when MMU is not enabled by making DRM_HISI_HIBMC depend on MMU. WARNING: unmet direct dependencies detected for DRM_TTM Depends on [n]: HAS_IOMEM [=3Dy] && DRM [=3Dm] && MMU [=3Dn] Selected by [m]: - DRM_TTM_HELPER [=3Dm] && HAS_IOMEM [=3Dy] && DRM [=3Dm] - DRM_HISI_HIBMC [=3Dm] && HAS_IOMEM [=3Dy] && DRM [=3Dm] && PCI [=3Dy] &= & (ARM64 || COMPILE_TEST [=3Dy]) Fixes: acad3fe650a5 ("drm/hisilicon: Removed the dependency on the mmu") Signed-off-by: Randy Dunlap Cc: Gerd Hoffmann Cc: Thomas Zimmermann Cc: Xinliang Liu Cc: Tian Tao Cc: John Stultz Cc: Xinwei Kong Cc: Chen Feng Cc: Christian Koenig Cc: Huang Rui Cc: David Airlie Cc: Daniel Vetter Reviewed-by: Javier Martinez Canillas Signed-off-by: Javier Martinez Canillas Link: https://patchwork.freedesktop.org/patch/msgid/20220531025557.29593-1-= rdunlap@infradead.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/hisilicon/hibmc/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/hisilicon/hibmc/Kconfig b/drivers/gpu/drm/hisi= licon/hibmc/Kconfig index 073adfe438dd..4e41c144a290 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/Kconfig +++ b/drivers/gpu/drm/hisilicon/hibmc/Kconfig @@ -2,6 +2,7 @@ config DRM_HISI_HIBMC tristate "DRM Support for Hisilicon Hibmc" depends on DRM && PCI && (ARM64 || COMPILE_TEST) + depends on MMU select DRM_KMS_HELPER select DRM_VRAM_HELPER select DRM_TTM --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24D02C32771 for ; Mon, 26 Sep 2022 11:52:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238542AbiIZLwR (ORCPT ); Mon, 26 Sep 2022 07:52:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238528AbiIZLvm (ORCPT ); Mon, 26 Sep 2022 07:51:42 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6E3F75FF4; Mon, 26 Sep 2022 03:48:55 -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 sin.source.kernel.org (Postfix) with ESMTPS id 95932CE1101; Mon, 26 Sep 2022 10:47:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A87EC433D6; Mon, 26 Sep 2022 10:47:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189253; bh=nXLbPcp/lmo1PNRr7WbCA1M/+VZrKaywAvL2mtf1Ros=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RCeNFU9S4YC3jFyeYvG5Xv1NkMfhs/nFQQ5YsC+Uek1EOTj2cWM68LuvdczKxATyX Mz0rafHaxoPAmSAPhamvvcyYME2FVzFd7SUiNeEzjjARbCzRVFsyF4EN+LQo6j+RYD /xC0IcDqZdRV77mmFQQxJDhh4U5E1u0C4Mi30+B0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Liang He , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 124/207] of: mdio: Add of_node_put() when breaking out of for_each_xx Date: Mon, 26 Sep 2022 12:11:53 +0200 Message-Id: <20220926100812.121191117@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 1c48709e6d9d353acaaac1d8e33474756b121d78 ] In of_mdiobus_register(), we should call of_node_put() for 'child' escaped out of for_each_available_child_of_node(). Fixes: 66bdede495c7 ("of_mdio: Fix broken PHY IRQ in case of probe deferral= ") Co-developed-by: Miaoqian Lin Signed-off-by: Miaoqian Lin Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220913125659.3331969-1-windhl@126.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/mdio/of_mdio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index 9e3c815a070f..796e9c7857d0 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -231,6 +231,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct de= vice_node *np) return 0; =20 unregister: + of_node_put(child); mdiobus_unregister(mdio); return rc; } --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95685C6FA83 for ; Mon, 26 Sep 2022 11:49:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238501AbiIZLt2 (ORCPT ); Mon, 26 Sep 2022 07:49:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238690AbiIZLqz (ORCPT ); Mon, 26 Sep 2022 07:46:55 -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 AD9D956BB1; Mon, 26 Sep 2022 03:47:39 -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 A51F060B09; Mon, 26 Sep 2022 10:47:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75A69C433D7; Mon, 26 Sep 2022 10:47:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189257; bh=IunPrrzid9QOnXr7JnjCZRuqeGfIwxmYQEzJi10qmdU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W80HoYtYzzmBgRUUkilyblBJmsC2+KdX705+xJ2Twxy8nU02F1CaoADkm+cb+5N2J X2Dy1X58ANZoJssbyA7cVhPoQS4t7mS1tnbrTE76hbTEArW9o1jG7tTYngdcAIE4P8 XITZGgcKS3ga8SfK+hg92LVsGIEX+s+4BOYtlKIo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Elder , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 125/207] net: ipa: properly limit modem routing table use Date: Mon, 26 Sep 2022 12:11:54 +0200 Message-Id: <20220926100812.151888224@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alex Elder [ Upstream commit cf412ec333250cb82bafe57169204e14a9f1c2ac ] IPA can route packets between IPA-connected entities. The AP and modem are currently the only such entities supported, and no routing is required to transfer packets between them. The number of entries in each routing table is fixed, and defined at initialization time. Some of these entries are designated for use by the modem, and the rest are available for the AP to use. The AP sends a QMI message to the modem which describes (among other things) information about routing table memory available for the modem to use. Currently the QMI initialization packet gives wrong information in its description of routing tables. What *should* be supplied is the maximum index that the modem can use for the routing table memory located at a given location. The current code instead supplies the total *number* of routing table entries. Furthermore, the modem is granted the entire table, not just the subset it's supposed to use. This patch fixes this. First, the ipa_mem_bounds structure is generalized so its "end" field can be interpreted either as a final byte offset, or a final array index. Second, the IPv4 and IPv6 (non-hashed and hashed) table information fields in the QMI ipa_init_modem_driver_req structure are changed to be ipa_mem_bounds rather than ipa_mem_array structures. Third, we set the "end" value for each routing table to be the last index, rather than setting the "count" to be the number of indices. Finally, instead of allowing the modem to use all of a routing table's memory, it is limited to just the portion meant to be used by the modem. In all versions of IPA currently supported, that is IPA_ROUTE_MODEM_COUNT (8) entries. Update a few comments for clarity. Fixes: 530f9216a9537 ("soc: qcom: ipa: AP/modem communications") Signed-off-by: Alex Elder Link: https://lore.kernel.org/r/20220913204602.1803004-1-elder@linaro.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ipa/ipa_qmi.c | 8 ++++---- drivers/net/ipa/ipa_qmi_msg.c | 8 ++++---- drivers/net/ipa/ipa_qmi_msg.h | 37 ++++++++++++++++++++--------------- drivers/net/ipa/ipa_table.c | 2 -- drivers/net/ipa/ipa_table.h | 3 +++ 5 files changed, 32 insertions(+), 26 deletions(-) diff --git a/drivers/net/ipa/ipa_qmi.c b/drivers/net/ipa/ipa_qmi.c index ec010cf2e816..6f874f99b910 100644 --- a/drivers/net/ipa/ipa_qmi.c +++ b/drivers/net/ipa/ipa_qmi.c @@ -308,12 +308,12 @@ init_modem_driver_req(struct ipa_qmi *ipa_qmi) mem =3D ipa_mem_find(ipa, IPA_MEM_V4_ROUTE); req.v4_route_tbl_info_valid =3D 1; req.v4_route_tbl_info.start =3D ipa->mem_offset + mem->offset; - req.v4_route_tbl_info.count =3D mem->size / sizeof(__le64); + req.v4_route_tbl_info.end =3D IPA_ROUTE_MODEM_COUNT - 1; =20 mem =3D ipa_mem_find(ipa, IPA_MEM_V6_ROUTE); req.v6_route_tbl_info_valid =3D 1; req.v6_route_tbl_info.start =3D ipa->mem_offset + mem->offset; - req.v6_route_tbl_info.count =3D mem->size / sizeof(__le64); + req.v6_route_tbl_info.end =3D IPA_ROUTE_MODEM_COUNT - 1; =20 mem =3D ipa_mem_find(ipa, IPA_MEM_V4_FILTER); req.v4_filter_tbl_start_valid =3D 1; @@ -352,7 +352,7 @@ init_modem_driver_req(struct ipa_qmi *ipa_qmi) req.v4_hash_route_tbl_info_valid =3D 1; req.v4_hash_route_tbl_info.start =3D ipa->mem_offset + mem->offset; - req.v4_hash_route_tbl_info.count =3D mem->size / sizeof(__le64); + req.v4_hash_route_tbl_info.end =3D IPA_ROUTE_MODEM_COUNT - 1; } =20 mem =3D ipa_mem_find(ipa, IPA_MEM_V6_ROUTE_HASHED); @@ -360,7 +360,7 @@ init_modem_driver_req(struct ipa_qmi *ipa_qmi) req.v6_hash_route_tbl_info_valid =3D 1; req.v6_hash_route_tbl_info.start =3D ipa->mem_offset + mem->offset; - req.v6_hash_route_tbl_info.count =3D mem->size / sizeof(__le64); + req.v6_hash_route_tbl_info.end =3D IPA_ROUTE_MODEM_COUNT - 1; } =20 mem =3D ipa_mem_find(ipa, IPA_MEM_V4_FILTER_HASHED); diff --git a/drivers/net/ipa/ipa_qmi_msg.c b/drivers/net/ipa/ipa_qmi_msg.c index 6838e8065072..75d3fc0092e9 100644 --- a/drivers/net/ipa/ipa_qmi_msg.c +++ b/drivers/net/ipa/ipa_qmi_msg.c @@ -311,7 +311,7 @@ struct qmi_elem_info ipa_init_modem_driver_req_ei[] =3D= { .tlv_type =3D 0x12, .offset =3D offsetof(struct ipa_init_modem_driver_req, v4_route_tbl_info), - .ei_array =3D ipa_mem_array_ei, + .ei_array =3D ipa_mem_bounds_ei, }, { .data_type =3D QMI_OPT_FLAG, @@ -332,7 +332,7 @@ struct qmi_elem_info ipa_init_modem_driver_req_ei[] =3D= { .tlv_type =3D 0x13, .offset =3D offsetof(struct ipa_init_modem_driver_req, v6_route_tbl_info), - .ei_array =3D ipa_mem_array_ei, + .ei_array =3D ipa_mem_bounds_ei, }, { .data_type =3D QMI_OPT_FLAG, @@ -496,7 +496,7 @@ struct qmi_elem_info ipa_init_modem_driver_req_ei[] =3D= { .tlv_type =3D 0x1b, .offset =3D offsetof(struct ipa_init_modem_driver_req, v4_hash_route_tbl_info), - .ei_array =3D ipa_mem_array_ei, + .ei_array =3D ipa_mem_bounds_ei, }, { .data_type =3D QMI_OPT_FLAG, @@ -517,7 +517,7 @@ struct qmi_elem_info ipa_init_modem_driver_req_ei[] =3D= { .tlv_type =3D 0x1c, .offset =3D offsetof(struct ipa_init_modem_driver_req, v6_hash_route_tbl_info), - .ei_array =3D ipa_mem_array_ei, + .ei_array =3D ipa_mem_bounds_ei, }, { .data_type =3D QMI_OPT_FLAG, diff --git a/drivers/net/ipa/ipa_qmi_msg.h b/drivers/net/ipa/ipa_qmi_msg.h index 495e85abe50b..9651aa59b596 100644 --- a/drivers/net/ipa/ipa_qmi_msg.h +++ b/drivers/net/ipa/ipa_qmi_msg.h @@ -86,9 +86,11 @@ enum ipa_platform_type { IPA_QMI_PLATFORM_TYPE_MSM_QNX_V01 =3D 0x5, /* QNX MSM */ }; =20 -/* This defines the start and end offset of a range of memory. Both - * fields are offsets relative to the start of IPA shared memory. - * The end value is the last addressable byte *within* the range. +/* This defines the start and end offset of a range of memory. The start + * value is a byte offset relative to the start of IPA shared memory. The + * end value is the last addressable unit *within* the range. Typically + * the end value is in units of bytes, however it can also be a maximum + * array index value. */ struct ipa_mem_bounds { u32 start; @@ -129,18 +131,19 @@ struct ipa_init_modem_driver_req { u8 hdr_tbl_info_valid; struct ipa_mem_bounds hdr_tbl_info; =20 - /* Routing table information. These define the location and size of - * non-hashable IPv4 and IPv6 filter tables. The start values are - * offsets relative to the start of IPA shared memory. + /* Routing table information. These define the location and maximum + * *index* (not byte) for the modem portion of non-hashable IPv4 and + * IPv6 routing tables. The start values are byte offsets relative + * to the start of IPA shared memory. */ u8 v4_route_tbl_info_valid; - struct ipa_mem_array v4_route_tbl_info; + struct ipa_mem_bounds v4_route_tbl_info; u8 v6_route_tbl_info_valid; - struct ipa_mem_array v6_route_tbl_info; + struct ipa_mem_bounds v6_route_tbl_info; =20 /* Filter table information. These define the location of the * non-hashable IPv4 and IPv6 filter tables. The start values are - * offsets relative to the start of IPA shared memory. + * byte offsets relative to the start of IPA shared memory. */ u8 v4_filter_tbl_start_valid; u32 v4_filter_tbl_start; @@ -181,18 +184,20 @@ struct ipa_init_modem_driver_req { u8 zip_tbl_info_valid; struct ipa_mem_bounds zip_tbl_info; =20 - /* Routing table information. These define the location and size - * of hashable IPv4 and IPv6 filter tables. The start values are - * offsets relative to the start of IPA shared memory. + /* Routing table information. These define the location and maximum + * *index* (not byte) for the modem portion of hashable IPv4 and IPv6 + * routing tables (if supported by hardware). The start values are + * byte offsets relative to the start of IPA shared memory. */ u8 v4_hash_route_tbl_info_valid; - struct ipa_mem_array v4_hash_route_tbl_info; + struct ipa_mem_bounds v4_hash_route_tbl_info; u8 v6_hash_route_tbl_info_valid; - struct ipa_mem_array v6_hash_route_tbl_info; + struct ipa_mem_bounds v6_hash_route_tbl_info; =20 /* Filter table information. These define the location and size - * of hashable IPv4 and IPv6 filter tables. The start values are - * offsets relative to the start of IPA shared memory. + * of hashable IPv4 and IPv6 filter tables (if supported by hardware). + * The start values are byte offsets relative to the start of IPA + * shared memory. */ u8 v4_hash_filter_tbl_start_valid; u32 v4_hash_filter_tbl_start; diff --git a/drivers/net/ipa/ipa_table.c b/drivers/net/ipa/ipa_table.c index 2f5a58bfc529..69efe672ca52 100644 --- a/drivers/net/ipa/ipa_table.c +++ b/drivers/net/ipa/ipa_table.c @@ -108,8 +108,6 @@ =20 /* Assignment of route table entries to the modem and AP */ #define IPA_ROUTE_MODEM_MIN 0 -#define IPA_ROUTE_MODEM_COUNT 8 - #define IPA_ROUTE_AP_MIN IPA_ROUTE_MODEM_COUNT #define IPA_ROUTE_AP_COUNT \ (IPA_ROUTE_COUNT_MAX - IPA_ROUTE_MODEM_COUNT) diff --git a/drivers/net/ipa/ipa_table.h b/drivers/net/ipa/ipa_table.h index b6a9a0d79d68..1538e2e1732f 100644 --- a/drivers/net/ipa/ipa_table.h +++ b/drivers/net/ipa/ipa_table.h @@ -13,6 +13,9 @@ struct ipa; /* The maximum number of filter table entries (IPv4, IPv6; hashed or not) = */ #define IPA_FILTER_COUNT_MAX 14 =20 +/* The number of route table entries allotted to the modem */ +#define IPA_ROUTE_MODEM_COUNT 8 + /* The maximum number of route table entries (IPv4, IPv6; hashed or not) */ #define IPA_ROUTE_COUNT_MAX 15 =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9DF9C32771 for ; Mon, 26 Sep 2022 11:49:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238827AbiIZLti (ORCPT ); Mon, 26 Sep 2022 07:49:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238770AbiIZLrU (ORCPT ); Mon, 26 Sep 2022 07:47:20 -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 1FB2D74DF2; Mon, 26 Sep 2022 03:47: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 dfw.source.kernel.org (Postfix) with ESMTPS id C8A7A60B6A; Mon, 26 Sep 2022 10:47:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF50FC433B5; Mon, 26 Sep 2022 10:47:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189260; bh=GHqo4WW2TGo/HZhXm8DCsaihIeiuLfz8NFLTCRhWsjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=11FlMc+saWsTIMbqEHjTnmlkY4CC7xLEcrb1MnVbc5HEqIr/tv6v9bgoxoUGb9fPW gFAI9MGMH3FaAO4HF+m5I1MXm0joDphMQ/bmYf17IwD0nvYGBFFBZjxWGSDihpIr8W vQkyVcXLWGgtJMX5vExKq3M607MXXfxyL3pDeDck= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tianhao Zhao , =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 126/207] sfc/siena: fix TX channel offset when using legacy interrupts Date: Mon, 26 Sep 2022 12:11:55 +0200 Message-Id: <20220926100812.200580187@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: =C3=8D=C3=B1igo Huguet [ Upstream commit 974bb793aded499491246f6f9826e26c2b127320 ] As in previous commit for sfc, fix TX channels offset when efx_siena_separate_tx_channels is false (the default) Fixes: 25bde571b4a8 ("sfc/siena: fix wrong tx channel offset with efx_separ= ate_tx_channels") Reported-by: Tianhao Zhao Signed-off-by: =C3=8D=C3=B1igo Huguet Link: https://lore.kernel.org/r/20220915141653.15504-1-ihuguet@redhat.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/sfc/siena/efx_channels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/sfc/siena/efx_channels.c b/drivers/net/et= hernet/sfc/siena/efx_channels.c index 017212a40df3..f54ebd007286 100644 --- a/drivers/net/ethernet/sfc/siena/efx_channels.c +++ b/drivers/net/ethernet/sfc/siena/efx_channels.c @@ -320,7 +320,7 @@ int efx_siena_probe_interrupts(struct efx_nic *efx) efx->n_channels =3D 1 + (efx_siena_separate_tx_channels ? 1 : 0); efx->n_rx_channels =3D 1; efx->n_tx_channels =3D 1; - efx->tx_channel_offset =3D 1; + efx->tx_channel_offset =3D efx_siena_separate_tx_channels ? 1 : 0; efx->n_xdp_channels =3D 0; efx->xdp_channel_offset =3D efx->n_channels; efx->legacy_irq =3D efx->pci_dev->irq; --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2CDBC32771 for ; Mon, 26 Sep 2022 11:49:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238270AbiIZLtq (ORCPT ); Mon, 26 Sep 2022 07:49:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238773AbiIZLrV (ORCPT ); Mon, 26 Sep 2022 07:47:21 -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 67E3B74DF4; Mon, 26 Sep 2022 03:47: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 dfw.source.kernel.org (Postfix) with ESMTPS id 914FB60A37; Mon, 26 Sep 2022 10:47:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A05CEC433D7; Mon, 26 Sep 2022 10:47:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189263; bh=ZmKY2Sdv8dFo4Uiq2WCxXNdpELsTk6liyF6+9D2rwtk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KfRlPvmW6vWuNnxcQaNANvcRx1lzIDASPOUaQBKWagv5muZynrNE363GLD93lvwCm AZnJ7cYfiFSPwfljD77QbYen9Yu6oWd2QPDqD86e7DPm8UWa8aeXbz5z41N0PTd1iB eOFRmxUuk2YMrbF595AAN1U7rhvAJ+X5V52FJw6c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tianhao Zhao , =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 127/207] sfc/siena: fix null pointer dereference in efx_hard_start_xmit Date: Mon, 26 Sep 2022 12:11:56 +0200 Message-Id: <20220926100812.239218464@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: =C3=8D=C3=B1igo Huguet [ Upstream commit 589c6eded10c77a12b7b2cf235b6b19a2bdb91fa ] Like in previous patch for sfc, prevent potential (but unlikely) NULL pointer dereference. Fixes: 12804793b17c ("sfc: decouple TXQ type from label") Reported-by: Tianhao Zhao Signed-off-by: =C3=8D=C3=B1igo Huguet Link: https://lore.kernel.org/r/20220915141958.16458-1-ihuguet@redhat.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/sfc/siena/tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/sfc/siena/tx.c b/drivers/net/ethernet/sfc= /siena/tx.c index e166dcb9b99c..91e87594ed1e 100644 --- a/drivers/net/ethernet/sfc/siena/tx.c +++ b/drivers/net/ethernet/sfc/siena/tx.c @@ -336,7 +336,7 @@ netdev_tx_t efx_siena_hard_start_xmit(struct sk_buff *s= kb, * previous packets out. */ if (!netdev_xmit_more()) - efx_tx_send_pending(tx_queue->channel); + efx_tx_send_pending(efx_get_tx_channel(efx, index)); return NETDEV_TX_OK; } =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63FB5C32771 for ; Mon, 26 Sep 2022 11:49:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238779AbiIZLte (ORCPT ); Mon, 26 Sep 2022 07:49:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238737AbiIZLrM (ORCPT ); Mon, 26 Sep 2022 07:47:12 -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 A6DB874E11; Mon, 26 Sep 2022 03:47:49 -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 6329A60BB9; Mon, 26 Sep 2022 10:47:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 725A6C433C1; Mon, 26 Sep 2022 10:47:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189268; bh=eJ+fDbbzA19SGMmU8INWJvoyHaXEcrggf1UMvpYzvDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KYD6UDQIil3D8JnkolzbOtACoqohRpfiaSDfTXveowopuWLlvHtjGykXf+iUlO5AY hL1AdgpWDh9eBIiduPmrLXciL6K9HspPWTykD3pyXR1A+N/PY/52dhwutQuZGzyTjb riPzvm+vXLO9Vm7Lj2j1aGgxxSjki5IaZIEbUbLA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 128/207] wireguard: ratelimiter: disable timings test by default Date: Mon, 26 Sep 2022 12:11:57 +0200 Message-Id: <20220926100812.286820125@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason A. Donenfeld [ Upstream commit 684dec3cf45da2b0848298efae4adf3b2aeafeda ] A previous commit tried to make the ratelimiter timings test more reliable but in the process made it less reliable on other configurations. This is an impossible problem to solve without increasingly ridiculous heuristics. And it's not even a problem that actually needs to be solved in any comprehensive way, since this is only ever used during development. So just cordon this off with a DEBUG_ ifdef, just like we do for the trie's randomized tests, so it can be enabled while hacking on the code, and otherwise disabled in CI. In the process we also revert 151c8e499f47. Fixes: 151c8e499f47 ("wireguard: ratelimiter: use hrtimer in selftest") Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") Signed-off-by: Jason A. Donenfeld Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/wireguard/selftest/ratelimiter.c | 25 ++++++++------------ 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/net/wireguard/selftest/ratelimiter.c b/drivers/net/wir= eguard/selftest/ratelimiter.c index ba87d294604f..d4bb40a695ab 100644 --- a/drivers/net/wireguard/selftest/ratelimiter.c +++ b/drivers/net/wireguard/selftest/ratelimiter.c @@ -6,29 +6,28 @@ #ifdef DEBUG =20 #include -#include =20 static const struct { bool result; - u64 nsec_to_sleep_before; + unsigned int msec_to_sleep_before; } expected_results[] __initconst =3D { [0 ... PACKETS_BURSTABLE - 1] =3D { true, 0 }, [PACKETS_BURSTABLE] =3D { false, 0 }, - [PACKETS_BURSTABLE + 1] =3D { true, NSEC_PER_SEC / PACKETS_PER_SECOND }, + [PACKETS_BURSTABLE + 1] =3D { true, MSEC_PER_SEC / PACKETS_PER_SECOND }, [PACKETS_BURSTABLE + 2] =3D { false, 0 }, - [PACKETS_BURSTABLE + 3] =3D { true, (NSEC_PER_SEC / PACKETS_PER_SECOND) *= 2 }, + [PACKETS_BURSTABLE + 3] =3D { true, (MSEC_PER_SEC / PACKETS_PER_SECOND) *= 2 }, [PACKETS_BURSTABLE + 4] =3D { true, 0 }, [PACKETS_BURSTABLE + 5] =3D { false, 0 } }; =20 static __init unsigned int maximum_jiffies_at_index(int index) { - u64 total_nsecs =3D 2 * NSEC_PER_SEC / PACKETS_PER_SECOND / 3; + unsigned int total_msecs =3D 2 * MSEC_PER_SEC / PACKETS_PER_SECOND / 3; int i; =20 for (i =3D 0; i <=3D index; ++i) - total_nsecs +=3D expected_results[i].nsec_to_sleep_before; - return nsecs_to_jiffies(total_nsecs); + total_msecs +=3D expected_results[i].msec_to_sleep_before; + return msecs_to_jiffies(total_msecs); } =20 static __init int timings_test(struct sk_buff *skb4, struct iphdr *hdr4, @@ -43,12 +42,8 @@ static __init int timings_test(struct sk_buff *skb4, str= uct iphdr *hdr4, loop_start_time =3D jiffies; =20 for (i =3D 0; i < ARRAY_SIZE(expected_results); ++i) { - if (expected_results[i].nsec_to_sleep_before) { - ktime_t timeout =3D ktime_add(ktime_add_ns(ktime_get_coarse_boottime(),= TICK_NSEC * 4 / 3), - ns_to_ktime(expected_results[i].nsec_to_sleep_before)); - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_hrtimeout_range_clock(&timeout, 0, HRTIMER_MODE_ABS, CLOCK_BOO= TTIME); - } + if (expected_results[i].msec_to_sleep_before) + msleep(expected_results[i].msec_to_sleep_before); =20 if (time_is_before_jiffies(loop_start_time + maximum_jiffies_at_index(i))) @@ -132,7 +127,7 @@ bool __init wg_ratelimiter_selftest(void) if (IS_ENABLED(CONFIG_KASAN) || IS_ENABLED(CONFIG_UBSAN)) return true; =20 - BUILD_BUG_ON(NSEC_PER_SEC % PACKETS_PER_SECOND !=3D 0); + BUILD_BUG_ON(MSEC_PER_SEC % PACKETS_PER_SECOND !=3D 0); =20 if (wg_ratelimiter_init()) goto out; @@ -172,7 +167,7 @@ bool __init wg_ratelimiter_selftest(void) ++test; #endif =20 - for (trials =3D TRIALS_BEFORE_GIVING_UP;;) { + for (trials =3D TRIALS_BEFORE_GIVING_UP; IS_ENABLED(DEBUG_RATELIMITER_TIM= INGS);) { int test_count =3D 0, ret; =20 ret =3D timings_test(skb4, hdr4, skb6, hdr6, &test_count); --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 496ACC07E9D for ; Mon, 26 Sep 2022 11:53:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238647AbiIZLxK (ORCPT ); Mon, 26 Sep 2022 07:53:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238601AbiIZLwh (ORCPT ); Mon, 26 Sep 2022 07:52:37 -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 F3D945754C; Mon, 26 Sep 2022 03:49:21 -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 2B928B80185; Mon, 26 Sep 2022 10:47:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70244C433C1; Mon, 26 Sep 2022 10:47:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189271; bh=STN83xp9evJqJZLuHCkw/lnhnKc/4/65pi4u/jxUtL8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OmqE4zLP/ChAG/2vvubjZZt0pruflxHRqzG0NnPpcs39G9/DVrPxJIgzOsp+c8CKV 2hg6BBPBVTWY8NOZT5SXJngSJFks6cLslTYY4mBEoPISqYsflrRQ00q4KcLYhxqD9M IreD0VjOoX6qPOnaaFRfqvuUcTLg/4CxiHm0odTg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" , Kees Cook , syzbot+a448cda4dba2dac50de5@syzkaller.appspotmail.com, Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 129/207] wireguard: netlink: avoid variable-sized memcpy on sockaddr Date: Mon, 26 Sep 2022 12:11:58 +0200 Message-Id: <20220926100812.320737292@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason A. Donenfeld [ Upstream commit 26c013108c12b94bc023bf19198a4300596c98b1 ] Doing a variable-sized memcpy is slower, and the compiler isn't smart enough to turn this into a constant-size assignment. Further, Kees' latest fortified memcpy will actually bark, because the destination pointer is type sockaddr, not explicitly sockaddr_in or sockaddr_in6, so it thinks there's an overflow: memcpy: detected field-spanning write (size 28) of single field "&endpoint.addr" at drivers/net/wireguard/netlink.c:446 (size 16) Fix this by just assigning by using explicit casts for each checked case. Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") Signed-off-by: Jason A. Donenfeld Reviewed-by: Kees Cook Reported-by: syzbot+a448cda4dba2dac50de5@syzkaller.appspotmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/wireguard/netlink.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireguard/netlink.c b/drivers/net/wireguard/netlin= k.c index d0f3b6d7f408..5c804bcabfe6 100644 --- a/drivers/net/wireguard/netlink.c +++ b/drivers/net/wireguard/netlink.c @@ -436,14 +436,13 @@ static int set_peer(struct wg_device *wg, struct nlat= tr **attrs) if (attrs[WGPEER_A_ENDPOINT]) { struct sockaddr *addr =3D nla_data(attrs[WGPEER_A_ENDPOINT]); size_t len =3D nla_len(attrs[WGPEER_A_ENDPOINT]); + struct endpoint endpoint =3D { { { 0 } } }; =20 - if ((len =3D=3D sizeof(struct sockaddr_in) && - addr->sa_family =3D=3D AF_INET) || - (len =3D=3D sizeof(struct sockaddr_in6) && - addr->sa_family =3D=3D AF_INET6)) { - struct endpoint endpoint =3D { { { 0 } } }; - - memcpy(&endpoint.addr, addr, len); + if (len =3D=3D sizeof(struct sockaddr_in) && addr->sa_family =3D=3D AF_I= NET) { + endpoint.addr4 =3D *(struct sockaddr_in *)addr; + wg_socket_set_peer_endpoint(peer, &endpoint); + } else if (len =3D=3D sizeof(struct sockaddr_in6) && addr->sa_family =3D= =3D AF_INET6) { + endpoint.addr6 =3D *(struct sockaddr_in6 *)addr; wg_socket_set_peer_endpoint(peer, &endpoint); } } --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0684C32771 for ; Mon, 26 Sep 2022 11:52:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238555AbiIZLwr (ORCPT ); Mon, 26 Sep 2022 07:52:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235154AbiIZLwL (ORCPT ); Mon, 26 Sep 2022 07:52:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 429835756E; Mon, 26 Sep 2022 03:49:07 -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 205D5B80921; Mon, 26 Sep 2022 10:47:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73FB6C433D6; Mon, 26 Sep 2022 10:47:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189274; bh=dajcyQw4EKzAi3lbGMv0e5CKmbyuC3ASPAqjMqLa+CE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=frsfYrKgNGiNUOx5pyGFBlIVHsiwgN8B1unLbU83XIG6xRnZCpi7Bq/RKwn22L+f1 X7ZGt4n6stkCUg3SXU+lrEWGDdeaL6RlBKcU0B/EGl9zi9t6EawHEBIHObUYzIOIOr ut6nOJXO0kazMkMtbZla+BzuedL03KW51kFLGgqQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 130/207] net: enetc: move enetc_set_psfp() out of the common enetc_set_features() Date: Mon, 26 Sep 2022 12:11:59 +0200 Message-Id: <20220926100812.350004847@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit fed38e64d9b99d65a36c0dbadc3d3f8ddd9ea030 ] The VF netdev driver shouldn't respond to changes in the NETIF_F_HW_TC flag; only PFs should. Moreover, TSN-specific code should go to enetc_qos.c, which should not be included in the VF driver. Fixes: 79e499829f3f ("net: enetc: add hw tc hw offload features for PSPF ca= pability") Signed-off-by: Vladimir Oltean Link: https://lore.kernel.org/r/20220916133209.3351399-1-vladimir.oltean@nx= p.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/freescale/enetc/enetc.c | 32 +------------------ drivers/net/ethernet/freescale/enetc/enetc.h | 9 ++++-- .../net/ethernet/freescale/enetc/enetc_pf.c | 11 ++++++- .../net/ethernet/freescale/enetc/enetc_qos.c | 23 +++++++++++++ .../net/ethernet/freescale/enetc/enetc_vf.c | 4 ++- 5 files changed, 44 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/eth= ernet/freescale/enetc/enetc.c index 4470a4a3e4c3..3df099f6cbe0 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -2600,29 +2600,6 @@ static int enetc_set_rss(struct net_device *ndev, in= t en) return 0; } =20 -static int enetc_set_psfp(struct net_device *ndev, int en) -{ - struct enetc_ndev_priv *priv =3D netdev_priv(ndev); - int err; - - if (en) { - err =3D enetc_psfp_enable(priv); - if (err) - return err; - - priv->active_offloads |=3D ENETC_F_QCI; - return 0; - } - - err =3D enetc_psfp_disable(priv); - if (err) - return err; - - priv->active_offloads &=3D ~ENETC_F_QCI; - - return 0; -} - static void enetc_enable_rxvlan(struct net_device *ndev, bool en) { struct enetc_ndev_priv *priv =3D netdev_priv(ndev); @@ -2641,11 +2618,9 @@ static void enetc_enable_txvlan(struct net_device *n= dev, bool en) enetc_bdr_enable_txvlan(&priv->si->hw, i, en); } =20 -int enetc_set_features(struct net_device *ndev, - netdev_features_t features) +void enetc_set_features(struct net_device *ndev, netdev_features_t feature= s) { netdev_features_t changed =3D ndev->features ^ features; - int err =3D 0; =20 if (changed & NETIF_F_RXHASH) enetc_set_rss(ndev, !!(features & NETIF_F_RXHASH)); @@ -2657,11 +2632,6 @@ int enetc_set_features(struct net_device *ndev, if (changed & NETIF_F_HW_VLAN_CTAG_TX) enetc_enable_txvlan(ndev, !!(features & NETIF_F_HW_VLAN_CTAG_TX)); - - if (changed & NETIF_F_HW_TC) - err =3D enetc_set_psfp(ndev, !!(features & NETIF_F_HW_TC)); - - return err; } =20 #ifdef CONFIG_FSL_ENETC_PTP_CLOCK diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/eth= ernet/freescale/enetc/enetc.h index 29922c20531f..caa12509d06b 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.h +++ b/drivers/net/ethernet/freescale/enetc/enetc.h @@ -393,8 +393,7 @@ void enetc_start(struct net_device *ndev); void enetc_stop(struct net_device *ndev); netdev_tx_t enetc_xmit(struct sk_buff *skb, struct net_device *ndev); struct net_device_stats *enetc_get_stats(struct net_device *ndev); -int enetc_set_features(struct net_device *ndev, - netdev_features_t features); +void enetc_set_features(struct net_device *ndev, netdev_features_t feature= s); int enetc_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd); int enetc_setup_tc(struct net_device *ndev, enum tc_setup_type type, void *type_data); @@ -465,6 +464,7 @@ int enetc_setup_tc_block_cb(enum tc_setup_type type, vo= id *type_data, int enetc_setup_tc_psfp(struct net_device *ndev, void *type_data); int enetc_psfp_init(struct enetc_ndev_priv *priv); int enetc_psfp_clean(struct enetc_ndev_priv *priv); +int enetc_set_psfp(struct net_device *ndev, bool en); =20 static inline void enetc_get_max_cap(struct enetc_ndev_priv *priv) { @@ -540,4 +540,9 @@ static inline int enetc_psfp_disable(struct enetc_ndev_= priv *priv) { return 0; } + +static inline int enetc_set_psfp(struct net_device *ndev, bool en) +{ + return 0; +} #endif diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/= ethernet/freescale/enetc/enetc_pf.c index c4a0e836d4f0..201b5f3f634e 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -709,6 +709,13 @@ static int enetc_pf_set_features(struct net_device *nd= ev, { netdev_features_t changed =3D ndev->features ^ features; struct enetc_ndev_priv *priv =3D netdev_priv(ndev); + int err; + + if (changed & NETIF_F_HW_TC) { + err =3D enetc_set_psfp(ndev, !!(features & NETIF_F_HW_TC)); + if (err) + return err; + } =20 if (changed & NETIF_F_HW_VLAN_CTAG_FILTER) { struct enetc_pf *pf =3D enetc_si_priv(priv->si); @@ -722,7 +729,9 @@ static int enetc_pf_set_features(struct net_device *nde= v, if (changed & NETIF_F_LOOPBACK) enetc_set_loopback(ndev, !!(features & NETIF_F_LOOPBACK)); =20 - return enetc_set_features(ndev, features); + enetc_set_features(ndev, features); + + return 0; } =20 static const struct net_device_ops enetc_ndev_ops =3D { diff --git a/drivers/net/ethernet/freescale/enetc/enetc_qos.c b/drivers/net= /ethernet/freescale/enetc/enetc_qos.c index 582a663ed0ba..f8a2f02ce22d 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_qos.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_qos.c @@ -1517,6 +1517,29 @@ int enetc_setup_tc_block_cb(enum tc_setup_type type,= void *type_data, } } =20 +int enetc_set_psfp(struct net_device *ndev, bool en) +{ + struct enetc_ndev_priv *priv =3D netdev_priv(ndev); + int err; + + if (en) { + err =3D enetc_psfp_enable(priv); + if (err) + return err; + + priv->active_offloads |=3D ENETC_F_QCI; + return 0; + } + + err =3D enetc_psfp_disable(priv); + if (err) + return err; + + priv->active_offloads &=3D ~ENETC_F_QCI; + + return 0; +} + int enetc_psfp_init(struct enetc_ndev_priv *priv) { if (epsfp.psfp_sfi_bitmap) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_vf.c b/drivers/net/= ethernet/freescale/enetc/enetc_vf.c index 17924305afa2..4048101c42be 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_vf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_vf.c @@ -88,7 +88,9 @@ static int enetc_vf_set_mac_addr(struct net_device *ndev,= void *addr) static int enetc_vf_set_features(struct net_device *ndev, netdev_features_t features) { - return enetc_set_features(ndev, features); + enetc_set_features(ndev, features); + + return 0; } =20 /* Probing/ Init */ --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1214BC07E9D for ; Mon, 26 Sep 2022 11:52:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238261AbiIZLwm (ORCPT ); Mon, 26 Sep 2022 07:52:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238364AbiIZLwJ (ORCPT ); Mon, 26 Sep 2022 07:52:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C615F76776; Mon, 26 Sep 2022 03:49:06 -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 6C83E6091B; Mon, 26 Sep 2022 10:47:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76258C433D6; Mon, 26 Sep 2022 10:47:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189277; bh=35QbhhOVsLOLHDUh8lJLi/FhzdK+RLyAIztfOmmiqzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qAXsebbvNT7+d3RrrloQ2x6EPGYD4dfVYLN+Mr64nYVfCKenKSxmDIh6M/14JPTik BRhpqiJ9V1DreBSnTgWRn+zp+dQ7IwFLfRRk6RMAIiyNh9vqdDUJTsQXMN5/m5TVIp +kmg30Mwujqo4e13ESpW4W2QPipfny9VNQcRsbo4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 131/207] net: enetc: deny offload of tc-based TSN features on VF interfaces Date: Mon, 26 Sep 2022 12:12:00 +0200 Message-Id: <20220926100812.387053554@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 5641c751fe2f92d3d9e8a8e03c1263ac8caa0b42 ] TSN features on the ENETC (taprio, cbs, gate, police) are configured through a mix of command BD ring messages and port registers: enetc_port_rd(), enetc_port_wr(). Port registers are a region of the ENETC memory map which are only accessible from the PCIe Physical Function. They are not accessible from the Virtual Functions. Moreover, attempting to access these registers crashes the kernel: $ echo 1 > /sys/bus/pci/devices/0000\:00\:00.0/sriov_numvfs pci 0000:00:01.0: [1957:ef00] type 00 class 0x020001 fsl_enetc_vf 0000:00:01.0: Adding to iommu group 15 fsl_enetc_vf 0000:00:01.0: enabling device (0000 -> 0002) fsl_enetc_vf 0000:00:01.0 eno0vf0: renamed from eth0 $ tc qdisc replace dev eno0vf0 root taprio num_tc 8 map 0 1 2 3 4 5 6 7 \ queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 base-time 0 \ sched-entry S 0x7f 900000 sched-entry S 0x80 100000 flags 0x2 Unable to handle kernel paging request at virtual address ffff800009551a08 Internal error: Oops: 96000007 [#1] PREEMPT SMP pc : enetc_setup_tc_taprio+0x170/0x47c lr : enetc_setup_tc_taprio+0x16c/0x47c Call trace: enetc_setup_tc_taprio+0x170/0x47c enetc_setup_tc+0x38/0x2dc taprio_change+0x43c/0x970 taprio_init+0x188/0x1e0 qdisc_create+0x114/0x470 tc_modify_qdisc+0x1fc/0x6c0 rtnetlink_rcv_msg+0x12c/0x390 Split enetc_setup_tc() into separate functions for the PF and for the VF drivers. Also remove enetc_qos.o from being included into enetc-vf.ko, since it serves absolutely no purpose there. Fixes: 34c6adf1977b ("enetc: Configure the Time-Aware Scheduler via tc-tapr= io offload") Signed-off-by: Vladimir Oltean Link: https://lore.kernel.org/r/20220916133209.3351399-2-vladimir.oltean@nx= p.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/freescale/enetc/Makefile | 1 - drivers/net/ethernet/freescale/enetc/enetc.c | 21 +------------------ drivers/net/ethernet/freescale/enetc/enetc.h | 3 +-- .../net/ethernet/freescale/enetc/enetc_pf.c | 21 ++++++++++++++++++- .../net/ethernet/freescale/enetc/enetc_vf.c | 13 +++++++++++- 5 files changed, 34 insertions(+), 25 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/Makefile b/drivers/net/et= hernet/freescale/enetc/Makefile index a139f2e9d59f..e0e8dfd13793 100644 --- a/drivers/net/ethernet/freescale/enetc/Makefile +++ b/drivers/net/ethernet/freescale/enetc/Makefile @@ -9,7 +9,6 @@ fsl-enetc-$(CONFIG_FSL_ENETC_QOS) +=3D enetc_qos.o =20 obj-$(CONFIG_FSL_ENETC_VF) +=3D fsl-enetc-vf.o fsl-enetc-vf-y :=3D enetc_vf.o $(common-objs) -fsl-enetc-vf-$(CONFIG_FSL_ENETC_QOS) +=3D enetc_qos.o =20 obj-$(CONFIG_FSL_ENETC_IERB) +=3D fsl-enetc-ierb.o fsl-enetc-ierb-y :=3D enetc_ierb.o diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/eth= ernet/freescale/enetc/enetc.c index 3df099f6cbe0..9f5b921039bd 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -2432,7 +2432,7 @@ int enetc_close(struct net_device *ndev) return 0; } =20 -static int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) +int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) { struct enetc_ndev_priv *priv =3D netdev_priv(ndev); struct tc_mqprio_qopt *mqprio =3D type_data; @@ -2486,25 +2486,6 @@ static int enetc_setup_tc_mqprio(struct net_device *= ndev, void *type_data) return 0; } =20 -int enetc_setup_tc(struct net_device *ndev, enum tc_setup_type type, - void *type_data) -{ - switch (type) { - case TC_SETUP_QDISC_MQPRIO: - return enetc_setup_tc_mqprio(ndev, type_data); - case TC_SETUP_QDISC_TAPRIO: - return enetc_setup_tc_taprio(ndev, type_data); - case TC_SETUP_QDISC_CBS: - return enetc_setup_tc_cbs(ndev, type_data); - case TC_SETUP_QDISC_ETF: - return enetc_setup_tc_txtime(ndev, type_data); - case TC_SETUP_BLOCK: - return enetc_setup_tc_psfp(ndev, type_data); - default: - return -EOPNOTSUPP; - } -} - static int enetc_setup_xdp_prog(struct net_device *dev, struct bpf_prog *p= rog, struct netlink_ext_ack *extack) { diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/eth= ernet/freescale/enetc/enetc.h index caa12509d06b..2cfe6944ebd3 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.h +++ b/drivers/net/ethernet/freescale/enetc/enetc.h @@ -395,8 +395,7 @@ netdev_tx_t enetc_xmit(struct sk_buff *skb, struct net_= device *ndev); struct net_device_stats *enetc_get_stats(struct net_device *ndev); void enetc_set_features(struct net_device *ndev, netdev_features_t feature= s); int enetc_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd); -int enetc_setup_tc(struct net_device *ndev, enum tc_setup_type type, - void *type_data); +int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data); int enetc_setup_bpf(struct net_device *dev, struct netdev_bpf *xdp); int enetc_xdp_xmit(struct net_device *ndev, int num_frames, struct xdp_frame **frames, u32 flags); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/= ethernet/freescale/enetc/enetc_pf.c index 201b5f3f634e..bb7750222691 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -734,6 +734,25 @@ static int enetc_pf_set_features(struct net_device *nd= ev, return 0; } =20 +static int enetc_pf_setup_tc(struct net_device *ndev, enum tc_setup_type t= ype, + void *type_data) +{ + switch (type) { + case TC_SETUP_QDISC_MQPRIO: + return enetc_setup_tc_mqprio(ndev, type_data); + case TC_SETUP_QDISC_TAPRIO: + return enetc_setup_tc_taprio(ndev, type_data); + case TC_SETUP_QDISC_CBS: + return enetc_setup_tc_cbs(ndev, type_data); + case TC_SETUP_QDISC_ETF: + return enetc_setup_tc_txtime(ndev, type_data); + case TC_SETUP_BLOCK: + return enetc_setup_tc_psfp(ndev, type_data); + default: + return -EOPNOTSUPP; + } +} + static const struct net_device_ops enetc_ndev_ops =3D { .ndo_open =3D enetc_open, .ndo_stop =3D enetc_close, @@ -748,7 +767,7 @@ static const struct net_device_ops enetc_ndev_ops =3D { .ndo_set_vf_spoofchk =3D enetc_pf_set_vf_spoofchk, .ndo_set_features =3D enetc_pf_set_features, .ndo_eth_ioctl =3D enetc_ioctl, - .ndo_setup_tc =3D enetc_setup_tc, + .ndo_setup_tc =3D enetc_pf_setup_tc, .ndo_bpf =3D enetc_setup_bpf, .ndo_xdp_xmit =3D enetc_xdp_xmit, }; diff --git a/drivers/net/ethernet/freescale/enetc/enetc_vf.c b/drivers/net/= ethernet/freescale/enetc/enetc_vf.c index 4048101c42be..dfcaac302e24 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_vf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_vf.c @@ -93,6 +93,17 @@ static int enetc_vf_set_features(struct net_device *ndev, return 0; } =20 +static int enetc_vf_setup_tc(struct net_device *ndev, enum tc_setup_type t= ype, + void *type_data) +{ + switch (type) { + case TC_SETUP_QDISC_MQPRIO: + return enetc_setup_tc_mqprio(ndev, type_data); + default: + return -EOPNOTSUPP; + } +} + /* Probing/ Init */ static const struct net_device_ops enetc_ndev_ops =3D { .ndo_open =3D enetc_open, @@ -102,7 +113,7 @@ static const struct net_device_ops enetc_ndev_ops =3D { .ndo_set_mac_address =3D enetc_vf_set_mac_addr, .ndo_set_features =3D enetc_vf_set_features, .ndo_eth_ioctl =3D enetc_ioctl, - .ndo_setup_tc =3D enetc_setup_tc, + .ndo_setup_tc =3D enetc_vf_setup_tc, }; =20 static void enetc_vf_netdev_setup(struct enetc_si *si, struct net_device *= ndev, --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CABBC6FA96 for ; Mon, 26 Sep 2022 11:59:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239469AbiIZL7D (ORCPT ); Mon, 26 Sep 2022 07:59:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238908AbiIZLyF (ORCPT ); Mon, 26 Sep 2022 07:54:05 -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 8C5FE4CA39; Mon, 26 Sep 2022 03:49: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 ams.source.kernel.org (Postfix) with ESMTPS id 43DA5B80926; Mon, 26 Sep 2022 10:49:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8851DC433C1; Mon, 26 Sep 2022 10:49:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189393; bh=2TbbozwGCYo4oYPb7D3d7IgWjrP1CmeCObRzTOyfZ4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mbrlzphjn5gvXCs0SOxGln3zYx8ldSJLeYP61OnlvfN6COvRsx3paTF01iA8WMIdx ZBPVe8P3d9FsTIdiwwlpt/CbUoVmv12lrfDf+hc2zPA+3gbzw0Zc5N/JFnJb6l7xwH 4f59KpQnQr+NvTL2vnZUSh1YV+1DKVa2f+evmstQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roberto Ricci , Ido Schimmel , David Ahern , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 132/207] ipv6: Fix crash when IPv6 is administratively disabled Date: Mon, 26 Sep 2022 12:12:01 +0200 Message-Id: <20220926100812.431984472@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ido Schimmel [ Upstream commit 76dd07281338da6951fdab3432ced843fa87839c ] The global 'raw_v6_hashinfo' variable can be accessed even when IPv6 is administratively disabled via the 'ipv6.disable=3D1' kernel command line option, leading to a crash [1]. Fix by restoring the original behavior and always initializing the variable, regardless of IPv6 support being administratively disabled or not. [1] BUG: unable to handle page fault for address: ffffffffffffffc8 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 173e18067 P4D 173e18067 PUD 173e1a067 PMD 0 Oops: 0000 [#1] PREEMPT SMP KASAN CPU: 3 PID: 271 Comm: ss Not tainted 6.0.0-rc4-custom-00136-g0727a9a5fbc1 = #1396 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-1.fc36 = 04/01/2014 RIP: 0010:raw_diag_dump+0x310/0x7f0 [...] Call Trace: __inet_diag_dump+0x10f/0x2e0 netlink_dump+0x575/0xfd0 __netlink_dump_start+0x67b/0x940 inet_diag_handler_cmd+0x273/0x2d0 sock_diag_rcv_msg+0x317/0x440 netlink_rcv_skb+0x15e/0x430 sock_diag_rcv+0x2b/0x40 netlink_unicast+0x53b/0x800 netlink_sendmsg+0x945/0xe60 ____sys_sendmsg+0x747/0x960 ___sys_sendmsg+0x13a/0x1e0 __sys_sendmsg+0x118/0x1e0 do_syscall_64+0x34/0x80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Fixes: 0daf07e52709 ("raw: convert raw sockets to RCU") Reported-by: Roberto Ricci Tested-by: Roberto Ricci Signed-off-by: Ido Schimmel Reviewed-by: David Ahern Link: https://lore.kernel.org/r/20220916084821.229287-1-idosch@nvidia.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- net/ipv6/af_inet6.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 9f6f4a41245d..1012012a061f 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c @@ -1069,13 +1069,13 @@ static int __init inet6_init(void) for (r =3D &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r) INIT_LIST_HEAD(r); =20 + raw_hashinfo_init(&raw_v6_hashinfo); + if (disable_ipv6_mod) { pr_info("Loaded, but administratively disabled, reboot required to enabl= e\n"); goto out; } =20 - raw_hashinfo_init(&raw_v6_hashinfo); - err =3D proto_register(&tcpv6_prot, 1); if (err) goto out; --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EC37C32771 for ; Mon, 26 Sep 2022 12:10:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239466AbiIZMJ7 (ORCPT ); Mon, 26 Sep 2022 08:09:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235281AbiIZMIH (ORCPT ); Mon, 26 Sep 2022 08:08:07 -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 42AD47F27C; Mon, 26 Sep 2022 03:56:06 -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 DC813B8091E; Mon, 26 Sep 2022 10:48:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5108AC433C1; Mon, 26 Sep 2022 10:48:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189300; bh=K/J5kmBBdxyWkb12VWV3kp/bZF5jclV6AW4g+Hsj/jY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nwMEdhd14B8lGPHR1LK3a69DG5yCc0XqHJjXCHgEl0z3hyVqN7ZuHKM3upn3Sepya THQIXu414XlBjmapueZBrIdBdGCw5pFz0FLxMT/lpH6ZsxX27F2uqswaufLAKv4xwo LTx3ZWfCY++fTVW3cZfL5ZjJ2XvEndLPrn8GQxT0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Vinicius Costa Gomes , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 133/207] net/sched: taprio: avoid disabling offload when it was never enabled Date: Mon, 26 Sep 2022 12:12:02 +0200 Message-Id: <20220926100812.477600795@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit db46e3a88a09c5cf7e505664d01da7238cd56c92 ] In an incredibly strange API design decision, qdisc->destroy() gets called even if qdisc->init() never succeeded, not exclusively since commit 87b60cfacf9f ("net_sched: fix error recovery at qdisc creation"), but apparently also earlier (in the case of qdisc_create_dflt()). The taprio qdisc does not fully acknowledge this when it attempts full offload, because it starts off with q->flags =3D TAPRIO_FLAGS_INVALID in taprio_init(), then it replaces q->flags with TCA_TAPRIO_ATTR_FLAGS parsed from netlink (in taprio_change(), tail called from taprio_init()). But in taprio_destroy(), we call taprio_disable_offload(), and this determines what to do based on FULL_OFFLOAD_IS_ENABLED(q->flags). But looking at the implementation of FULL_OFFLOAD_IS_ENABLED() (a bitwise check of bit 1 in q->flags), it is invalid to call this macro on q->flags when it contains TAPRIO_FLAGS_INVALID, because that is set to U32_MAX, and therefore FULL_OFFLOAD_IS_ENABLED() will return true on an invalid set of flags. As a result, it is possible to crash the kernel if user space forces an error between setting q->flags =3D TAPRIO_FLAGS_INVALID, and the calling of taprio_enable_offload(). This is because drivers do not expect the offload to be disabled when it was never enabled. The error that we force here is to attach taprio as a non-root qdisc, but instead as child of an mqprio root qdisc: $ tc qdisc add dev swp0 root handle 1: \ mqprio num_tc 8 map 0 1 2 3 4 5 6 7 \ queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 hw 0 $ tc qdisc replace dev swp0 parent 1:1 \ taprio num_tc 8 map 0 1 2 3 4 5 6 7 \ queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 base-time 0 \ sched-entry S 0x7f 990000 sched-entry S 0x80 100000 \ flags 0x0 clockid CLOCK_TAI Unable to handle kernel paging request at virtual address fffffffffffffff8 [fffffffffffffff8] pgd=3D0000000000000000, p4d=3D0000000000000000 Internal error: Oops: 96000004 [#1] PREEMPT SMP Call trace: taprio_dump+0x27c/0x310 vsc9959_port_setup_tc+0x1f4/0x460 felix_port_setup_tc+0x24/0x3c dsa_slave_setup_tc+0x54/0x27c taprio_disable_offload.isra.0+0x58/0xe0 taprio_destroy+0x80/0x104 qdisc_create+0x240/0x470 tc_modify_qdisc+0x1fc/0x6b0 rtnetlink_rcv_msg+0x12c/0x390 netlink_rcv_skb+0x5c/0x130 rtnetlink_rcv+0x1c/0x2c Fix this by keeping track of the operations we made, and undo the offload only if we actually did it. I've added "bool offloaded" inside a 4 byte hole between "int clockid" and "atomic64_t picos_per_byte". Now the first cache line looks like below: $ pahole -C taprio_sched net/sched/sch_taprio.o struct taprio_sched { struct Qdisc * * qdiscs; /* 0 8 */ struct Qdisc * root; /* 8 8 */ u32 flags; /* 16 4 */ enum tk_offsets tk_offset; /* 20 4 */ int clockid; /* 24 4 */ bool offloaded; /* 28 1 */ /* XXX 3 bytes hole, try to pack */ atomic64_t picos_per_byte; /* 32 0 */ /* XXX 8 bytes hole, try to pack */ spinlock_t current_entry_lock; /* 40 0 */ /* XXX 8 bytes hole, try to pack */ struct sched_entry * current_entry; /* 48 8 */ struct sched_gate_list * oper_sched; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ Fixes: 9c66d1564676 ("taprio: Add support for hardware offloading") Signed-off-by: Vladimir Oltean Reviewed-by: Vinicius Costa Gomes Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- net/sched/sch_taprio.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 0b941dd63d26..9bec73019f94 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -67,6 +67,7 @@ struct taprio_sched { u32 flags; enum tk_offsets tk_offset; int clockid; + bool offloaded; atomic64_t picos_per_byte; /* Using picoseconds because for 10Gbps+ * speeds it's sub-nanoseconds per byte */ @@ -1279,6 +1280,8 @@ static int taprio_enable_offload(struct net_device *d= ev, goto done; } =20 + q->offloaded =3D true; + done: taprio_offload_free(offload); =20 @@ -1293,12 +1296,9 @@ static int taprio_disable_offload(struct net_device = *dev, struct tc_taprio_qopt_offload *offload; int err; =20 - if (!FULL_OFFLOAD_IS_ENABLED(q->flags)) + if (!q->offloaded) return 0; =20 - if (!ops->ndo_setup_tc) - return -EOPNOTSUPP; - offload =3D taprio_offload_alloc(0); if (!offload) { NL_SET_ERR_MSG(extack, @@ -1314,6 +1314,8 @@ static int taprio_disable_offload(struct net_device *= dev, goto out; } =20 + q->offloaded =3D false; + out: taprio_offload_free(offload); =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D87EAC32771 for ; Mon, 26 Sep 2022 11:52:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238693AbiIZLwv (ORCPT ); Mon, 26 Sep 2022 07:52:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237074AbiIZLwR (ORCPT ); Mon, 26 Sep 2022 07:52:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F1A376965; Mon, 26 Sep 2022 03:49:18 -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 F2732B80951; Mon, 26 Sep 2022 10:48:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45374C433D6; Mon, 26 Sep 2022 10:48:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189332; bh=3+sHfTzB7xA/GpeWiEPmYl1WEXMg0Aa02oQ5DsYrF8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WomOzsyzpoQV0xS/p2Roq2ALWEdwCQN8PPQsU1w55KmDIkaXFV8c4jojnZ4+xlPws quYDRPYIxMCGKt+S5U2EOC71nlQCbm0FEus5bnH7W00yeC+oHlj7EUactKtsG+WjVC hfETLfc9a9pf6UQ0H8Z+KuwLNGHaIRQbc8fP3un8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Vinicius Costa Gomes , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 134/207] net/sched: taprio: make qdisc_leaf() see the per-netdev-queue pfifo child qdiscs Date: Mon, 26 Sep 2022 12:12:03 +0200 Message-Id: <20220926100812.525290605@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 1461d212ab277d8bba1a753d33e9afe03d81f9d4 ] taprio can only operate as root qdisc, and to that end, there exists the following check in taprio_init(), just as in mqprio: if (sch->parent !=3D TC_H_ROOT) return -EOPNOTSUPP; And indeed, when we try to attach taprio to an mqprio child, it fails as expected: $ tc qdisc add dev swp0 root handle 1: mqprio num_tc 8 \ map 0 1 2 3 4 5 6 7 \ queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 hw 0 $ tc qdisc replace dev swp0 parent 1:2 taprio num_tc 8 \ map 0 1 2 3 4 5 6 7 \ queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 \ base-time 0 sched-entry S 0x7f 990000 sched-entry S 0x80 100000 \ flags 0x0 clockid CLOCK_TAI Error: sch_taprio: Can only be attached as root qdisc. (extack message added by me) But when we try to attach a taprio child to a taprio root qdisc, surprisingly it doesn't fail: $ tc qdisc replace dev swp0 root handle 1: taprio num_tc 8 \ map 0 1 2 3 4 5 6 7 queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 \ base-time 0 sched-entry S 0x7f 990000 sched-entry S 0x80 100000 \ flags 0x0 clockid CLOCK_TAI $ tc qdisc replace dev swp0 parent 1:2 taprio num_tc 8 \ map 0 1 2 3 4 5 6 7 \ queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 \ base-time 0 sched-entry S 0x7f 990000 sched-entry S 0x80 100000 \ flags 0x0 clockid CLOCK_TAI This is because tc_modify_qdisc() behaves differently when mqprio is root, vs when taprio is root. In the mqprio case, it finds the parent qdisc through p =3D qdisc_lookup(dev, TC_H_MAJ(clid)), and then the child qdisc through q =3D qdisc_leaf(p, clid). This leaf qdisc q has handle 0, so it is ignored according to the comment right below ("It may be default qdisc, ignore it"). As a result, tc_modify_qdisc() goes through the qdisc_create() code path, and this gives taprio_init() a chance to check for sch_parent !=3D TC_H_ROOT and error out. Whereas in the taprio case, the returned q =3D qdisc_leaf(p, clid) is different. It is not the default qdisc created for each netdev queue (both taprio and mqprio call qdisc_create_dflt() and keep them in a private q->qdiscs[], or priv->qdiscs[], respectively). Instead, taprio makes qdisc_leaf() return the _root_ qdisc, aka itself. When taprio does that, tc_modify_qdisc() goes through the qdisc_change() code path, because the qdisc layer never finds out about the child qdisc of the root. And through the ->change() ops, taprio has no reason to check whether its parent is root or not, just through ->init(), which is not called. The problem is the taprio_leaf() implementation. Even though code wise, it does the exact same thing as mqprio_leaf() which it is copied from, it works with different input data. This is because mqprio does not attach itself (the root) to each device TX queue, but one of the default qdiscs from its private array. In fact, since commit 13511704f8d7 ("net: taprio offload: enforce qdisc to netdev queue mapping"), taprio does this too, but just for the full offload case. So if we tried to attach a taprio child to a fully offloaded taprio root qdisc, it would properly fail too; just not to a software root taprio. To fix the problem, stop looking at the Qdisc that's attached to the TX queue, and instead, always return the default qdiscs that we've allocated (and to which we privately enqueue and dequeue, in software scheduling mode). Since Qdisc_class_ops :: leaf is only called from tc_modify_qdisc(), the risk of unforeseen side effects introduced by this change is minimal. Fixes: 5a781ccbd19e ("tc: Add support for configuring the taprio scheduler") Signed-off-by: Vladimir Oltean Reviewed-by: Vinicius Costa Gomes Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- net/sched/sch_taprio.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 9bec73019f94..86675a79da1e 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -1951,12 +1951,14 @@ static int taprio_dump(struct Qdisc *sch, struct sk= _buff *skb) =20 static struct Qdisc *taprio_leaf(struct Qdisc *sch, unsigned long cl) { - struct netdev_queue *dev_queue =3D taprio_queue_get(sch, cl); + struct taprio_sched *q =3D qdisc_priv(sch); + struct net_device *dev =3D qdisc_dev(sch); + unsigned int ntx =3D cl - 1; =20 - if (!dev_queue) + if (ntx >=3D dev->num_tx_queues) return NULL; =20 - return dev_queue->qdisc_sleeping; + return q->qdiscs[ntx]; } =20 static unsigned long taprio_find(struct Qdisc *sch, u32 classid) --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67D9EC07E9D for ; Mon, 26 Sep 2022 12:07:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239387AbiIZMHT (ORCPT ); Mon, 26 Sep 2022 08:07:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239903AbiIZMFr (ORCPT ); Mon, 26 Sep 2022 08:05:47 -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 B826775CD9; Mon, 26 Sep 2022 03:55:24 -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 DB04060BEF; Mon, 26 Sep 2022 10:49:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D93B8C433C1; Mon, 26 Sep 2022 10:49:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189364; bh=i2fZwVS7YkGBEtxrF7WGgO2Z4xNuUglc558a7W8ZfTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R16vdqVx1U39Wup1dw2DKqxzCRMEYCWRBYFvVd4mbQ+ik/rhS3fRNsOL00h6VihU5 hKH1Di6+5whXw9QFCHKU7RgxBq0p/zxi8ChPmTQluZbMx+KpCTZypFlxqjOTnNnX+m 8Jgjafjto2KoBgDLpK9mOjAPR0usCf1DJOg66a74= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Swiatkowski , Tony Nguyen , Sasha Levin , Gurucharan Subject: [PATCH 5.19 135/207] ice: config netdev tc before setting queues number Date: Mon, 26 Sep 2022 12:12:04 +0200 Message-Id: <20220926100812.561884836@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Swiatkowski [ Upstream commit 122045ca770492660005c22379995506f13efea8 ] After lowering number of tx queues the warning appears: "Number of in use tx queues changed invalidating tc mappings. Priority traffic classification disabled!" Example command to reproduce: ethtool -L enp24s0f0 tx 36 rx 36 Fix this by setting correct tc mapping before setting real number of queues on netdev. Fixes: 0754d65bd4be5 ("ice: Add infrastructure for mqprio support via ndo_s= etup_tc") Signed-off-by: Michal Swiatkowski Tested-by: Gurucharan (A Contingent worker at Int= el) Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/intel/ice/ice_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethern= et/intel/ice/ice_main.c index 0b567e8e3674..f963036571e0 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -6836,6 +6836,8 @@ int ice_vsi_open(struct ice_vsi *vsi) if (err) goto err_setup_rx; =20 + ice_vsi_cfg_netdev_tc(vsi, vsi->tc_cfg.ena_tc); + if (vsi->type =3D=3D ICE_VSI_PF) { /* Notify the stack of the actual queue counts. */ err =3D netif_set_real_num_tx_queues(vsi->netdev, vsi->num_txq); --=20 2.35.1 From nobody Tue Dec 16 04:06:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EFE8C6FA92 for ; Mon, 26 Sep 2022 11:59:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239337AbiIZL6n (ORCPT ); Mon, 26 Sep 2022 07:58:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239355AbiIZLzS (ORCPT ); Mon, 26 Sep 2022 07:55:18 -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 272B7792CF; Mon, 26 Sep 2022 03:50: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 dfw.source.kernel.org (Postfix) with ESMTPS id 5D4D360C09; Mon, 26 Sep 2022 10:49:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70AF9C433D6; Mon, 26 Sep 2022 10:49:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189375; bh=5S56Dw+R7IJ9FhFrxtaBdZdRBb0t4edjr+D8FgpjfQE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kmmPnQ95IgLSrrAFNIaRRn/i6qPqz4NfIvewyq0J93xxzhjDuh0jMOxHFYVnHxUoG DOzz5FuW0uiHNKeyL369H/08w13CjY0Hua0qI1gKdGusc2s4tvdaFT6q8LWCfrgzsn vj+WM33K9MNb2vU7nO7yBlIQn35r8N5Fdx/NAhJM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mateusz Palczewski , Petr Oros , Tony Nguyen , Sasha Levin , Gurucharan Subject: [PATCH 5.19 136/207] ice: Fix interface being down after reset with link-down-on-close flag on Date: Mon, 26 Sep 2022 12:12:05 +0200 Message-Id: <20220926100812.611517103@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mateusz Palczewski [ Upstream commit 8ac7132704f3fbd2095abb9459e5303ce8c9e559 ] When performing a reset on ice driver with link-down-on-close flag on interface would always stay down. Fix this by moving a check of this flag to ice_stop() that is called only when user wants to bring interface down. Fixes: ab4ab73fc1ec ("ice: Add ethtool private flag to make forcing link do= wn optional") Signed-off-by: Mateusz Palczewski Tested-by: Petr Oros Tested-by: Gurucharan (A Contingent worker at Int= el) Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/intel/ice/ice_main.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethern= et/intel/ice/ice_main.c index f963036571e0..48befe1e2872 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -6627,7 +6627,7 @@ static void ice_napi_disable_all(struct ice_vsi *vsi) */ int ice_down(struct ice_vsi *vsi) { - int i, tx_err, rx_err, link_err =3D 0, vlan_err =3D 0; + int i, tx_err, rx_err, vlan_err =3D 0; =20 WARN_ON(!test_bit(ICE_VSI_DOWN, vsi->state)); =20 @@ -6661,20 +6661,13 @@ int ice_down(struct ice_vsi *vsi) =20 ice_napi_disable_all(vsi); =20 - if (test_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, vsi->back->flags)) { - link_err =3D ice_force_phys_link_state(vsi, false); - if (link_err) - netdev_err(vsi->netdev, "Failed to set physical link down, VSI %d error= %d\n", - vsi->vsi_num, link_err); - } - ice_for_each_txq(vsi, i) ice_clean_tx_ring(vsi->tx_rings[i]); =20 ice_for_each_rxq(vsi, i) ice_clean_rx_ring(vsi->rx_rings[i]); =20 - if (tx_err || rx_err || link_err || vlan_err) { + if (tx_err || rx_err || vlan_err) { netdev_err(vsi->netdev, "Failed to close VSI 0x%04X on switch 0x%04X\n", vsi->vsi_num, vsi->vsw->sw_id); return -EIO; @@ -8876,6 +8869,16 @@ int ice_stop(struct net_device *netdev) return -EBUSY; } =20 + if (test_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, vsi->back->flags)) { + int link_err =3D ice_force_phys_link_state(vsi, false); + + if (link_err) { + netdev_err(vsi->netdev, "Failed to set physical link down, VSI %d error= %d\n", + vsi->vsi_num, link_err); + return -EIO; + } + } + ice_vsi_close(vsi); =20 return 0; --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DB0AC6FA97 for ; Mon, 26 Sep 2022 11:59:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239440AbiIZL65 (ORCPT ); Mon, 26 Sep 2022 07:58:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238603AbiIZLxb (ORCPT ); Mon, 26 Sep 2022 07:53:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AA5E1EECA; Mon, 26 Sep 2022 03:49:39 -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 34E2660A52; Mon, 26 Sep 2022 10:49:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4334CC433C1; Mon, 26 Sep 2022 10:49:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189378; bh=IJyVcokS76eYcgjYU/QcDdw9VqFByW+ywwfO1tCMjz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r5FIVtzQXO+ggMRI5fPN4b/JYmp9d7F2anv8icohc3JDLWE+sAnwp2llsKa5k/woN SwGEK+zlTIF8z/hwg8RMSmOPS67x/r21nA4Z5mUSBEzJLKPL0NdVBxEv8tkDUtxEXC m0sO65zflDf2JneYe+szXMFx1izcRtRv3TEG+GhQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , Florian Westphal , Sasha Levin Subject: [PATCH 5.19 137/207] netfilter: nf_tables: fix nft_counters_enabled underflow at nf_tables_addchain() Date: Mon, 26 Sep 2022 12:12:06 +0200 Message-Id: <20220926100812.649459985@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tetsuo Handa [ Upstream commit 921ebde3c0d22c8cba74ce8eb3cc4626abff1ccd ] syzbot is reporting underflow of nft_counters_enabled counter at nf_tables_addchain() [1], for commit 43eb8949cfdffa76 ("netfilter: nf_tables: do not leave chain stats enabled on error") missed that nf_tables_chain_destroy() after nft_basechain_init() in the error path of nf_tables_addchain() decrements the counter because nft_basechain_init() makes nft_is_base_chain() return true by setting NFT_CHAIN_BASE flag. Increment the counter immediately after returning from nft_basechain_init(). Link: https://syzkaller.appspot.com/bug?extid=3Db5d82a651b71cd8a75ab [1] Reported-by: syzbot Signed-off-by: Tetsuo Handa Tested-by: syzbot Fixes: 43eb8949cfdffa76 ("netfilter: nf_tables: do not leave chain stats en= abled on error") Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- net/netfilter/nf_tables_api.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 848cc81d6992..3aaf36df69d4 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -2197,7 +2197,6 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8= family, u8 genmask, struct netlink_ext_ack *extack) { const struct nlattr * const *nla =3D ctx->nla; - struct nft_stats __percpu *stats =3D NULL; struct nft_table *table =3D ctx->table; struct nft_base_chain *basechain; struct net *net =3D ctx->net; @@ -2212,6 +2211,7 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8= family, u8 genmask, return -EOVERFLOW; =20 if (nla[NFTA_CHAIN_HOOK]) { + struct nft_stats __percpu *stats =3D NULL; struct nft_chain_hook hook; =20 if (flags & NFT_CHAIN_BINDING) @@ -2245,6 +2245,8 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8= family, u8 genmask, kfree(basechain); return err; } + if (stats) + static_branch_inc(&nft_counters_enabled); } else { if (flags & NFT_CHAIN_BASE) return -EINVAL; @@ -2319,9 +2321,6 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8= family, u8 genmask, goto err_unregister_hook; } =20 - if (stats) - static_branch_inc(&nft_counters_enabled); - table->use++; =20 return 0; --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E696C6FA95 for ; Mon, 26 Sep 2022 11:59:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239373AbiIZL6r (ORCPT ); Mon, 26 Sep 2022 07:58:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239389AbiIZLzX (ORCPT ); Mon, 26 Sep 2022 07:55:23 -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 BDE53792FC; Mon, 26 Sep 2022 03:50: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 2CA33609FE; Mon, 26 Sep 2022 10:49:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4157FC433D6; Mon, 26 Sep 2022 10:49:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189381; bh=z7SuKfgkHhhVx3EK5dgX86TGPw3VKkalS3eiNPU2iUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fOorNT6xbDsLsb2Tzcvy0D5aT7OHDyLKOGe/NBmZu10LHwvqGhA+pa/3dFLmUrowF dmaC/K2GPc2hRo5yWeiHBhbujgShNgnhCAWpFbrQvlx7WGesE7UKvIin7W8GuZrsJl G1bqvzSlhilBVTQdcvRWLlr+ymbVwzxmNuUJWIdw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tetsuo Handa , Florian Westphal , Sasha Levin Subject: [PATCH 5.19 138/207] netfilter: nf_tables: fix percpu memory leak at nf_tables_addchain() Date: Mon, 26 Sep 2022 12:12:07 +0200 Message-Id: <20220926100812.695709174@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tetsuo Handa [ Upstream commit 9a4d6dd554b86e65581ef6b6638a39ae079b17ac ] It seems to me that percpu memory for chain stats started leaking since commit 3bc158f8d0330f0a ("netfilter: nf_tables: map basechain priority to hardware priority") when nft_chain_offload_priority() returned an error. Signed-off-by: Tetsuo Handa Fixes: 3bc158f8d0330f0a ("netfilter: nf_tables: map basechain priority to h= ardware priority") Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- net/netfilter/nf_tables_api.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 3aaf36df69d4..2fde193c3d26 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -2243,6 +2243,7 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8= family, u8 genmask, if (err < 0) { nft_chain_release_hook(&hook); kfree(basechain); + free_percpu(stats); return err; } if (stats) --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5807DC07E9D for ; Mon, 26 Sep 2022 11:59:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238934AbiIZL7Y (ORCPT ); Mon, 26 Sep 2022 07:59:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238216AbiIZL4E (ORCPT ); Mon, 26 Sep 2022 07:56:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B172E79EE1; Mon, 26 Sep 2022 03:51:25 -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 08A0E60C0B; Mon, 26 Sep 2022 10:49:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12A46C433C1; Mon, 26 Sep 2022 10:49:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189384; bh=HhUWvdhXsgORzUEW66P9KeGIWYlywk0P52be4Y5L8Xc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GpbdZM6XAzQ6AYEQRFmzV1Rgk1ZKtDV6xQA0jQIUCmlyEpdMzWxKt0UJ091yJTgjQ Mf3ODNIRS9C/fZhueeuuxlqX82ylomqeZXp6vgYL/j7VZGbNDRj1oFwvM3q7KhhHSx TaGHUNh2ucVhpFtc76DBBKhJqEdg+ZRs+we9fZOk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Sasha Levin , syzbot+a24c5252f3e3ab733464@syzkaller.appspotmail.com Subject: [PATCH 5.19 139/207] netfilter: ebtables: fix memory leak when blob is malformed Date: Mon, 26 Sep 2022 12:12:08 +0200 Message-Id: <20220926100812.744025470@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal [ Upstream commit 62ce44c4fff947eebdf10bb582267e686e6835c9 ] The bug fix was incomplete, it "replaced" crash with a memory leak. The old code had an assignment to "ret" embedded into the conditional, restore this. Fixes: 7997eff82828 ("netfilter: ebtables: reject blobs that don't provide = all entry points") Reported-and-tested-by: syzbot+a24c5252f3e3ab733464@syzkaller.appspotmail.c= om Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- net/bridge/netfilter/ebtables.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtable= s.c index 9a0ae59cdc50..4f385d52a1c4 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c @@ -1040,8 +1040,10 @@ static int do_replace_finish(struct net *net, struct= ebt_replace *repl, goto free_iterate; } =20 - if (repl->valid_hooks !=3D t->valid_hooks) + if (repl->valid_hooks !=3D t->valid_hooks) { + ret =3D -EINVAL; goto free_unlock; + } =20 if (repl->num_counters && repl->num_counters !=3D t->private->nentries) { ret =3D -EINVAL; --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5428BC6FA83 for ; Mon, 26 Sep 2022 11:56:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238665AbiIZL4V (ORCPT ); Mon, 26 Sep 2022 07:56:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238374AbiIZLxb (ORCPT ); Mon, 26 Sep 2022 07:53:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3841645F51; Mon, 26 Sep 2022 03:49:50 -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 0572960C0D; Mon, 26 Sep 2022 10:49:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09F09C433D6; Mon, 26 Sep 2022 10:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189387; bh=1Q+uX897ILffysQZbDfO0e/zl4cC96DqijuJesJwVPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0u9u+1nmnYYwroAHpe4obYYhA1M9PqXow2bG/CuvD8EFAzmyE7a6cERGo4GLrh+uR w4kZOumGhHte5TZV+QXETzj5kRcrltguK7rIrW2DoeQhbBYMXWRQXAaptd5Ael1oCN 5G3nM4o4NuF3CLCIJD1Zy9NPV1lwCWact8TI5NoI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bruno de Paula Larini , Florian Westphal , Sasha Levin Subject: [PATCH 5.19 140/207] netfilter: nf_ct_ftp: fix deadlock when nat rewrite is needed Date: Mon, 26 Sep 2022 12:12:09 +0200 Message-Id: <20220926100812.783060195@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal [ Upstream commit d25088932227680988a6b794221e031a7232f137 ] We can't use ct->lock, this is already used by the seqadj internals. When using ftp helper + nat, seqadj will attempt to acquire ct->lock again. Revert back to a global lock for now. Fixes: c783a29c7e59 ("netfilter: nf_ct_ftp: prefer skb_linearize") Reported-by: Bruno de Paula Larini Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- net/netfilter/nf_conntrack_ftp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_= ftp.c index 0d9332e9cf71..617f744a2e3a 100644 --- a/net/netfilter/nf_conntrack_ftp.c +++ b/net/netfilter/nf_conntrack_ftp.c @@ -33,6 +33,7 @@ MODULE_AUTHOR("Rusty Russell "); MODULE_DESCRIPTION("ftp connection tracking helper"); MODULE_ALIAS("ip_conntrack_ftp"); MODULE_ALIAS_NFCT_HELPER(HELPER_NAME); +static DEFINE_SPINLOCK(nf_ftp_lock); =20 #define MAX_PORTS 8 static u_int16_t ports[MAX_PORTS]; @@ -409,7 +410,8 @@ static int help(struct sk_buff *skb, } datalen =3D skb->len - dataoff; =20 - spin_lock_bh(&ct->lock); + /* seqadj (nat) uses ct->lock internally, nf_nat_ftp would cause deadlock= */ + spin_lock_bh(&nf_ftp_lock); fb_ptr =3D skb->data + dataoff; =20 ends_in_nl =3D (fb_ptr[datalen - 1] =3D=3D '\n'); @@ -538,7 +540,7 @@ static int help(struct sk_buff *skb, if (ends_in_nl) update_nl_seq(ct, seq, ct_ftp_info, dir, skb); out: - spin_unlock_bh(&ct->lock); + spin_unlock_bh(&nf_ftp_lock); return ret; } =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90A73C07E9D for ; Mon, 26 Sep 2022 12:25:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239522AbiIZMZv (ORCPT ); Mon, 26 Sep 2022 08:25:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239498AbiIZMZS (ORCPT ); Mon, 26 Sep 2022 08:25:18 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6CD0A50C5; Mon, 26 Sep 2022 04:06:29 -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 sin.source.kernel.org (Postfix) with ESMTPS id BF14ACE110D; Mon, 26 Sep 2022 10:49:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD3AFC433D6; Mon, 26 Sep 2022 10:49:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189390; bh=0DjXhAL+8E554ezDNho8QZsjgosXCo+FVNzesFm1IC0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s94NIrVcmPZR3e3RUzzkAVw59UB04d99QuiB93QQtw/noCEvaq3DpEDjHg2vNkMyp yuadW45Pg1IdZIqxwwkp8ZBpa14uj3poPkLFjCNYUgN6wPsVE+xLTuoZ7Kke9BERKC a9CF6I8PjveBIx6Hp+fvo0orJ5e6B6g06ZmGjTV0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Florian Fainelli , Sergey Shtylyov , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 141/207] net: ravb: Fix PHY state warning splat during system resume Date: Mon, 26 Sep 2022 12:12:10 +0200 Message-Id: <20220926100812.821149715@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Geert Uytterhoeven [ Upstream commit 4924c0cdce75575295f8fa682851fb8e5d619dd2 ] Since commit 744d23c71af39c7d ("net: phy: Warn about incorrect mdio_bus_phy_resume() state"), a warning splat is printed during system resume with Wake-on-LAN disabled: WARNING: CPU: 0 PID: 1197 at drivers/net/phy/phy_device.c:323 mdio_= bus_phy_resume+0xbc/0xc8 As the Renesas Ethernet AVB driver already calls phy_{stop,start}() in its suspend/resume callbacks, it is sufficient to just mark the MAC responsible for managing the power state of the PHY. Fixes: fba863b816049b03 ("net: phy: make PHY PM ops a no-op if MAC driver m= anages PHY PM") Signed-off-by: Geert Uytterhoeven Reviewed-by: Florian Fainelli Reviewed-by: Sergey Shtylyov Link: https://lore.kernel.org/r/8ec796f47620980fdd0403e21bd8b7200b4fa1d4.16= 63598796.git.geert+renesas@glider.be Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/renesas/ravb_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/etherne= t/renesas/ravb_main.c index b357ac4c56c5..7e32b04eb0c7 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1449,6 +1449,8 @@ static int ravb_phy_init(struct net_device *ndev) phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Half_BIT); } =20 + /* Indicate that the MAC is responsible for managing PHY PM */ + phydev->mac_managed_pm =3D true; phy_attached_info(phydev); =20 return 0; --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65C0BC32771 for ; Mon, 26 Sep 2022 11:56:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238318AbiIZL4v (ORCPT ); Mon, 26 Sep 2022 07:56:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238985AbiIZLyN (ORCPT ); Mon, 26 Sep 2022 07:54:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6113E24F26; Mon, 26 Sep 2022 03:49:47 -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 CB099B8085B; Mon, 26 Sep 2022 10:48:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 310EEC433C1; Mon, 26 Sep 2022 10:48:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189303; bh=suDTPmLcdkGIXtvv6sdCMVRxwD7vN0GRy22VpzSrNuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qf5qhzAU43kMVtMgVBrA99Rdq9Oa+fm4i846OTVxBRs+cxktekI8OYUgJQiRoGQlJ l+8rJVPDj39VSzqiqyGr3jFuy2fszjgGuZqIs1eIB3pWJx3rHpZQL7hriPnuahe9Ue 5f77wZYy8FhtaF0IhHbUboLhmN1zsRslb2I7OvGg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Florian Fainelli , Sergey Shtylyov , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 142/207] net: sh_eth: Fix PHY state warning splat during system resume Date: Mon, 26 Sep 2022 12:12:11 +0200 Message-Id: <20220926100812.860851945@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Geert Uytterhoeven [ Upstream commit 6a1dbfefdae4f7809b3e277cc76785dac0ac1cd0 ] Since commit 744d23c71af39c7d ("net: phy: Warn about incorrect mdio_bus_phy_resume() state"), a warning splat is printed during system resume with Wake-on-LAN disabled: WARNING: CPU: 0 PID: 626 at drivers/net/phy/phy_device.c:323 mdio_bus_phy_= resume+0xbc/0xe4 As the Renesas SuperH Ethernet driver already calls phy_{stop,start}() in its suspend/resume callbacks, it is sufficient to just mark the MAC responsible for managing the power state of the PHY. Fixes: fba863b816049b03 ("net: phy: make PHY PM ops a no-op if MAC driver m= anages PHY PM") Signed-off-by: Geert Uytterhoeven Reviewed-by: Florian Fainelli Reviewed-by: Sergey Shtylyov Link: https://lore.kernel.org/r/c6e1331b9bef61225fa4c09db3ba3e2e7214ba2d.16= 63598886.git.geert+renesas@glider.be Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/renesas/sh_eth.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/r= enesas/sh_eth.c index 67ade78fb767..7fd8828d3a84 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -2029,6 +2029,8 @@ static int sh_eth_phy_init(struct net_device *ndev) if (mdp->cd->register_type !=3D SH_ETH_REG_GIGABIT) phy_set_max_speed(phydev, SPEED_100); =20 + /* Indicate that the MAC is responsible for managing PHY PM */ + phydev->mac_managed_pm =3D true; phy_attached_info(phydev); =20 return 0; --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBD89C32771 for ; Mon, 26 Sep 2022 12:07:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239374AbiIZMHP (ORCPT ); Mon, 26 Sep 2022 08:07:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239638AbiIZMEw (ORCPT ); Mon, 26 Sep 2022 08:04:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDE4017590; Mon, 26 Sep 2022 03:54:47 -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 7B023B80835; Mon, 26 Sep 2022 10:48:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB42BC433D6; Mon, 26 Sep 2022 10:48:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189306; bh=09tTN7yUH5tIKpaq/OFSWMXTbbcnSxc+91PHZDmxjQk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fG1wA3HhACGToDa/AJw6gNhk4YG2v31DnKDTsONE5eHVcYBNi/+bHBEffsHJwNWmZ BrnI/h4p+lng6x/Md41n2zmA0r7a3mUJw19/5e97mTECl1yYhLzNJbHOTKGzsugUid 19CAovVXS6P2bS219q7/exAwEyP6pNL0WekDknwo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Dongliang Mu , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.19 143/207] gpio: tqmx86: fix uninitialized variable girq Date: Mon, 26 Sep 2022 12:12:12 +0200 Message-Id: <20220926100812.906881247@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dongliang Mu [ Upstream commit 21a9acc162457402c74c5c1e16471fda6eb090c0 ] The commit 924610607f19 ("gpio: tpmx86: Move PM device over to irq domain") adds a dereference of girq that may be uninitialized. Fix this by moving irq_domain_set_pm_device into if true branch as suggested by Marc Zyngier. Fixes: 924610607f19 ("gpio: tpmx86: Move PM device over to irq domain") Suggested-by: Marc Zyngier Signed-off-by: Dongliang Mu Acked-by: Marc Zyngier Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpio/gpio-tqmx86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-tqmx86.c b/drivers/gpio/gpio-tqmx86.c index fa4bc7481f9a..e739dcea61b2 100644 --- a/drivers/gpio/gpio-tqmx86.c +++ b/drivers/gpio/gpio-tqmx86.c @@ -307,6 +307,8 @@ static int tqmx86_gpio_probe(struct platform_device *pd= ev) girq->default_type =3D IRQ_TYPE_NONE; girq->handler =3D handle_simple_irq; girq->init_valid_mask =3D tqmx86_init_irq_valid_mask; + + irq_domain_set_pm_device(girq->domain, dev); } =20 ret =3D devm_gpiochip_add_data(dev, chip, gpio); @@ -315,8 +317,6 @@ static int tqmx86_gpio_probe(struct platform_device *pd= ev) goto out_pm_dis; } =20 - irq_domain_set_pm_device(girq->domain, dev); - dev_info(dev, "GPIO functionality initialized with %d pins\n", chip->ngpio); =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3256C07E9D for ; Mon, 26 Sep 2022 11:51:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238701AbiIZLvV (ORCPT ); Mon, 26 Sep 2022 07:51:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238780AbiIZLts (ORCPT ); Mon, 26 Sep 2022 07:49:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FB7E75FF7; Mon, 26 Sep 2022 03:48:30 -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 84D6FB802C7; Mon, 26 Sep 2022 10:48:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D73D3C433D6; Mon, 26 Sep 2022 10:48:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189309; bh=zluzXjF/oF3xR44I3+gJzSJtEsdyJheyxQR6K6shb3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mW+1mlja95+FNIsN1iXSU5BPzzpDw/xBc2P5vZTK6VhkjZ+4loNHqZa6A3PMlF9py +AQP/eERv6kmOjDjyb05HoAyzyD+ed08AIV7imVGbNNrFdDwG2nxKsgNivQitJcjZ/ h2BsCWF7WpZBUzF94xaIYOisM5Zq4vldptTdcZ6s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.19 144/207] can: gs_usb: gs_can_open(): fix race dev->can.state condition Date: Mon, 26 Sep 2022 12:12:13 +0200 Message-Id: <20220926100812.954667396@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marc Kleine-Budde [ Upstream commit 5440428b3da65408dba0241985acb7a05258b85e ] The dev->can.state is set to CAN_STATE_ERROR_ACTIVE, after the device has been started. On busy networks the CAN controller might receive CAN frame between and go into an error state before the dev->can.state is assigned. Assign dev->can.state before starting the controller to close the race window. Fixes: d08e973a77d1 ("can: gs_usb: Added support for the GS_USB CAN devices= ") Link: https://lore.kernel.org/all/20220920195216.232481-1-mkl@pengutronix.de Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/can/usb/gs_usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c index d3a658b444b5..092cd51b3926 100644 --- a/drivers/net/can/usb/gs_usb.c +++ b/drivers/net/can/usb/gs_usb.c @@ -824,6 +824,7 @@ static int gs_can_open(struct net_device *netdev) flags |=3D GS_CAN_MODE_TRIPLE_SAMPLE; =20 /* finally start device */ + dev->can.state =3D CAN_STATE_ERROR_ACTIVE; dm->mode =3D cpu_to_le32(GS_CAN_MODE_START); dm->flags =3D cpu_to_le32(flags); rc =3D usb_control_msg(interface_to_usbdev(dev->iface), @@ -835,13 +836,12 @@ static int gs_can_open(struct net_device *netdev) if (rc < 0) { netdev_err(netdev, "Couldn't start device (err=3D%d)\n", rc); kfree(dm); + dev->can.state =3D CAN_STATE_STOPPED; return rc; } =20 kfree(dm); =20 - dev->can.state =3D CAN_STATE_ERROR_ACTIVE; - parent->active_channels++; if (!(dev->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)) netif_start_queue(netdev); --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 793EFC07E9D for ; Mon, 26 Sep 2022 12:07:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239398AbiIZMHX (ORCPT ); Mon, 26 Sep 2022 08:07:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239904AbiIZMFr (ORCPT ); Mon, 26 Sep 2022 08:05:47 -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 9188B5A161; Mon, 26 Sep 2022 03:55:25 -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 7D9EEB80936; Mon, 26 Sep 2022 10:48:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3E71C433D6; Mon, 26 Sep 2022 10:48:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189312; bh=ZdPKxg5UW1HEw759TXM5ScOiD9P0Pfppjo6F7MnLu3Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zIMyGLnBQKq28E89vOpFVZJwFpvRYtoMxEfIuonu3A45KPpO/P2Jm3OKk1VHTwyRV M/ZkfU+DlMCDHTuSAlCqsk90gZwdUmjy+IoUowmBD6C9ug7mgnoheuJePsZUs79o5y HlEOnnGpLiE4gERTZtY9uFDJrqrKTf+tJw4XC2x0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namhyung Kim , Adrian Hunter , bpf@vger.kernel.org, Ian Rogers , Ingo Molnar , Jiri Olsa , Peter Zijlstra , Song Liu , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.19 145/207] perf stat: Fix BPF program section name Date: Mon, 26 Sep 2022 12:12:14 +0200 Message-Id: <20220926100813.001464711@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Namhyung Kim [ Upstream commit 0d77326c3369e255715ed2440a78894ccc98dd69 ] It seems the recent libbpf got more strict about the section name. I'm seeing a failure like this: $ sudo ./perf stat -a --bpf-counters --for-each-cgroup ^. sleep 1 libbpf: prog 'on_cgrp_switch': missing BPF prog type, check ELF section n= ame 'perf_events' libbpf: prog 'on_cgrp_switch': failed to load: -22 libbpf: failed to load object 'bperf_cgroup_bpf' libbpf: failed to load BPF skeleton 'bperf_cgroup_bpf': -22 Failed to load cgroup skeleton The section name should be 'perf_event' (without the trailing 's'). Although it's related to the libbpf change, it'd be better fix the section name in the first place. Fixes: 944138f048f7d759 ("perf stat: Enable BPF counter with --for-each-cgr= oup") Signed-off-by: Namhyung Kim Cc: Adrian Hunter Cc: bpf@vger.kernel.org Cc: Ian Rogers Cc: Ingo Molnar Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Song Liu Link: https://lore.kernel.org/r/20220916184132.1161506-2-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- tools/perf/util/bpf_skel/bperf_cgroup.bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/bpf_skel/bperf_cgroup.bpf.c b/tools/perf/util/= bpf_skel/bperf_cgroup.bpf.c index 292c430768b5..c72f8ad96f75 100644 --- a/tools/perf/util/bpf_skel/bperf_cgroup.bpf.c +++ b/tools/perf/util/bpf_skel/bperf_cgroup.bpf.c @@ -176,7 +176,7 @@ static int bperf_cgroup_count(void) } =20 // This will be attached to cgroup-switches event for each cpu -SEC("perf_events") +SEC("perf_event") int BPF_PROG(on_cgrp_switch) { return bperf_cgroup_count(); --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05886C32771 for ; Mon, 26 Sep 2022 11:57:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238992AbiIZL5M (ORCPT ); Mon, 26 Sep 2022 07:57:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239129AbiIZLyj (ORCPT ); Mon, 26 Sep 2022 07:54:39 -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 4B5CD4D835; Mon, 26 Sep 2022 03:50:16 -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 451D9B802C7; Mon, 26 Sep 2022 10:48:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77956C433D6; Mon, 26 Sep 2022 10:48:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189315; bh=iaB1KodNW2681CtVUDHZXZv/QS5f3KAqBTUzxLWxXwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j/aKFhIurr/fX+Wx7+hNjUI9E/YHDx9qyCXkO2KdSdVYJgCQrrybWkOidPNZzZpbU eiwuHYgJTnsSp4xgQXmcxNLVNBik+mk6/2xudsV+oe9YOqE5AJKCxOqECuki7aHovl cAqqhOmhLJ+5aUbjD+n88NxiX7f+GTzI6UdD9UHA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namhyung Kim , Adrian Hunter , bpf@vger.kernel.org, Ian Rogers , Ingo Molnar , Jiri Olsa , Peter Zijlstra , Song Liu , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.19 146/207] perf stat: Fix cpu map index in bperf cgroup code Date: Mon, 26 Sep 2022 12:12:15 +0200 Message-Id: <20220926100813.049490680@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Namhyung Kim [ Upstream commit 3da35231d9e4949c4ae40e3ce653e7c468455d55 ] The previous cpu map introduced a bug in the bperf cgroup counter. This results in a failure when user gives a partial cpu map starting from non-zero. $ sudo ./perf stat -C 1-2 --bpf-counters --for-each-cgroup ^. sleep 1 libbpf: prog 'on_cgrp_switch': failed to create BPF link for perf_event F= D 0: -9 (Bad file descriptor) Failed to attach cgroup program To get the FD of an evsel, it should use a map index not the CPU number. Fixes: 0255571a16059c8e ("perf cpumap: Switch to using perf_cpu_map API") Signed-off-by: Namhyung Kim Cc: Adrian Hunter Cc: bpf@vger.kernel.org Cc: Ian Rogers Cc: Ingo Molnar Cc: Jiri Olsa Cc: Peter Zijlstra Cc: Song Liu Link: https://lore.kernel.org/r/20220916184132.1161506-3-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- tools/perf/util/bpf_counter_cgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/bpf_counter_cgroup.c b/tools/perf/util/bpf_cou= nter_cgroup.c index 63b9db657442..97c69a249c6e 100644 --- a/tools/perf/util/bpf_counter_cgroup.c +++ b/tools/perf/util/bpf_counter_cgroup.c @@ -95,7 +95,7 @@ static int bperf_load_program(struct evlist *evlist) =20 perf_cpu_map__for_each_cpu(cpu, i, evlist->core.all_cpus) { link =3D bpf_program__attach_perf_event(skel->progs.on_cgrp_switch, - FD(cgrp_switch, cpu.cpu)); + FD(cgrp_switch, i)); if (IS_ERR(link)) { pr_err("Failed to attach cgroup program\n"); err =3D PTR_ERR(link); @@ -123,7 +123,7 @@ static int bperf_load_program(struct evlist *evlist) =20 map_fd =3D bpf_map__fd(skel->maps.events); perf_cpu_map__for_each_cpu(cpu, j, evlist->core.all_cpus) { - int fd =3D FD(evsel, cpu.cpu); + int fd =3D FD(evsel, j); __u32 idx =3D evsel->core.idx * total_cpus + cpu.cpu; =20 err =3D bpf_map_update_elem(map_fd, &idx, &fd, --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C4BBC07E9D for ; Mon, 26 Sep 2022 11:57:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239014AbiIZL5V (ORCPT ); Mon, 26 Sep 2022 07:57:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239127AbiIZLyj (ORCPT ); Mon, 26 Sep 2022 07:54:39 -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 9B12778585; Mon, 26 Sep 2022 03:50:24 -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 9408260A4D; Mon, 26 Sep 2022 10:48:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C5C3C433C1; Mon, 26 Sep 2022 10:48:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189318; bh=pnveg2+UrGnBn4IrjP5QIeOLOVOzaErr8xzbOiDup+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w7MyoS64vhlBkF4oonqI33saQ0aFqOygXynMeMxBj02+XajUBvfqzLpFcsUIwWKAY p5EaRBraxXAdR7K4ZsFplMqb4iUPpgVa1h51UDR+GiZs3A8l6RAn0pzK03rUXvBMNy cfGWtD7Y3+QZ7DJwZ5F3uSNdiiS68c40WrovZWgA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leo Yan , Lieven Hey , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.19 147/207] perf jit: Include program header in ELF files Date: Mon, 26 Sep 2022 12:12:16 +0200 Message-Id: <20220926100813.228665782@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lieven Hey [ Upstream commit babd04386b1df8c364cdaa39ac0e54349502e1e5 ] The missing header makes it hard for programs like elfutils to open these files. Fixes: 2d86612aacb7805f ("perf symbol: Correct address for bss symbols") Reviewed-by: Leo Yan Signed-off-by: Lieven Hey Tested-by: Leo Yan Cc: Leo Yan Link: https://lore.kernel.org/r/20220915092910.711036-1-lieven.hey@kdab.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- tools/perf/util/genelf.c | 14 ++++++++++++++ tools/perf/util/genelf.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/tools/perf/util/genelf.c b/tools/perf/util/genelf.c index 953338b9e887..02cd9f75e3d2 100644 --- a/tools/perf/util/genelf.c +++ b/tools/perf/util/genelf.c @@ -251,6 +251,7 @@ jit_write_elf(int fd, uint64_t load_addr, const char *s= ym, Elf_Data *d; Elf_Scn *scn; Elf_Ehdr *ehdr; + Elf_Phdr *phdr; Elf_Shdr *shdr; uint64_t eh_frame_base_offset; char *strsym =3D NULL; @@ -285,6 +286,19 @@ jit_write_elf(int fd, uint64_t load_addr, const char *= sym, ehdr->e_version =3D EV_CURRENT; ehdr->e_shstrndx=3D unwinding ? 4 : 2; /* shdr index for section name */ =20 + /* + * setup program header + */ + phdr =3D elf_newphdr(e, 1); + phdr[0].p_type =3D PT_LOAD; + phdr[0].p_offset =3D 0; + phdr[0].p_vaddr =3D 0; + phdr[0].p_paddr =3D 0; + phdr[0].p_filesz =3D csize; + phdr[0].p_memsz =3D csize; + phdr[0].p_flags =3D PF_X | PF_R; + phdr[0].p_align =3D 8; + /* * setup text section */ diff --git a/tools/perf/util/genelf.h b/tools/perf/util/genelf.h index ae138afe6c56..b5c909546e3f 100644 --- a/tools/perf/util/genelf.h +++ b/tools/perf/util/genelf.h @@ -53,8 +53,10 @@ int jit_add_debug_info(Elf *e, uint64_t code_addr, void = *debug, int nr_debug_ent =20 #if GEN_ELF_CLASS =3D=3D ELFCLASS64 #define elf_newehdr elf64_newehdr +#define elf_newphdr elf64_newphdr #define elf_getshdr elf64_getshdr #define Elf_Ehdr Elf64_Ehdr +#define Elf_Phdr Elf64_Phdr #define Elf_Shdr Elf64_Shdr #define Elf_Sym Elf64_Sym #define ELF_ST_TYPE(a) ELF64_ST_TYPE(a) @@ -62,8 +64,10 @@ int jit_add_debug_info(Elf *e, uint64_t code_addr, void = *debug, int nr_debug_ent #define ELF_ST_VIS(a) ELF64_ST_VISIBILITY(a) #else #define elf_newehdr elf32_newehdr +#define elf_newphdr elf32_newphdr #define elf_getshdr elf32_getshdr #define Elf_Ehdr Elf32_Ehdr +#define Elf_Phdr Elf32_Phdr #define Elf_Shdr Elf32_Shdr #define Elf_Sym Elf32_Sym #define ELF_ST_TYPE(a) ELF32_ST_TYPE(a) --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6031AC6FA83 for ; Mon, 26 Sep 2022 11:56:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238754AbiIZL4Z (ORCPT ); Mon, 26 Sep 2022 07:56:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238822AbiIZLxy (ORCPT ); Mon, 26 Sep 2022 07:53:54 -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 C660D481CA; Mon, 26 Sep 2022 03:49: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 7214A60AF5; Mon, 26 Sep 2022 10:48:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C860C433D7; Mon, 26 Sep 2022 10:48:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189320; bh=wT1N8772zsUcNnX7ubuZGvmkTyerDfEJhFIeWhkXEkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MRK1+tei042ndLWveJA5culRB4is6cowRgdXi1E+BqN5PqNYdP7sr9ZK1exo7pLgQ itO7r9NIBQhlF1HzWVQJSizytBHtTiPunu7DY8wXkpLeZK/Il0iQJw7tQ8O7Bl+Cd0 daP7eGvYhMjLrkGWA5+cLjHNMCykgOJyp75r9IVY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Dao , Adrian Hunter , Namhyung Kim , Ian Rogers , Jiri Olsa , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.19 148/207] perf kcore_copy: Do not check /proc/modules is unchanged Date: Mon, 26 Sep 2022 12:12:17 +0200 Message-Id: <20220926100813.276649930@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Adrian Hunter [ Upstream commit 5b427df27b94aec1312cace48a746782a0925c53 ] /proc/kallsyms and /proc/modules are compared before and after the copy in order to ensure no changes during the copy. However /proc/modules also might change due to reference counts changing even though that does not make any difference. Any modules loaded or unloaded should be visible in changes to kallsyms, so it is not necessary to check /proc/modules also anyway. Remove the comparison checking that /proc/modules is unchanged. Fixes: fc1b691d7651d949 ("perf buildid-cache: Add ability to add kcore to t= he cache") Reported-by: Daniel Dao Signed-off-by: Adrian Hunter Tested-by: Daniel Dao Acked-by: Namhyung Kim Cc: Ian Rogers Cc: Jiri Olsa Link: https://lore.kernel.org/r/20220914122429.8770-1-adrian.hunter@intel.c= om Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- tools/perf/util/symbol-elf.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 75bec32d4f57..647b7dff8ef3 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -2102,8 +2102,8 @@ static int kcore_copy__compare_file(const char *from_= dir, const char *to_dir, * unusual. One significant peculiarity is that the mapping (start -> pgo= ff) * is not the same for the kernel map and the modules map. That happens b= ecause * the data is copied adjacently whereas the original kcore has gaps. Fin= ally, - * kallsyms and modules files are compared with their copies to check that - * modules have not been loaded or unloaded while the copies were taking p= lace. + * kallsyms file is compared with its copy to check that modules have not = been + * loaded or unloaded while the copies were taking place. * * Return: %0 on success, %-1 on failure. */ @@ -2166,9 +2166,6 @@ int kcore_copy(const char *from_dir, const char *to_d= ir) goto out_extract_close; } =20 - if (kcore_copy__compare_file(from_dir, to_dir, "modules")) - goto out_extract_close; - if (kcore_copy__compare_file(from_dir, to_dir, "kallsyms")) goto out_extract_close; =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA6EAC32771 for ; Mon, 26 Sep 2022 12:24:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237009AbiIZMYB (ORCPT ); Mon, 26 Sep 2022 08:24:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239556AbiIZMXi (ORCPT ); Mon, 26 Sep 2022 08:23:38 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05EB08A1DE; Mon, 26 Sep 2022 04:05: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 sin.source.kernel.org (Postfix) with ESMTPS id A2552CE1117; Mon, 26 Sep 2022 10:48:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84783C433D6; Mon, 26 Sep 2022 10:48:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189323; bh=iQBts69Xg4uRZG7l2hp4cSGamepujS260GBRhpeKnlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Usr4bFJUtRg+rESsU6WdhYe6dsAsE0Zf1x6vltQKpY1d7aHDFN/fXaZDkpK626BLW i/4rYy7F+dayaIGrKe/csmWUWmSdA9xjDF7ZEnygvCJ056Xn0JLqBCxeGWJfTiPjXh qoCWhyZRy4qLKHpcAaV6VbtoBbNI4UXFlz7/EhOA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namhyung Kim , Adrian Hunter , Ian Rogers , Jiri Olsa , Peter Zijlstra , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.19 149/207] perf tools: Honor namespace when synthesizing build-ids Date: Mon, 26 Sep 2022 12:12:18 +0200 Message-Id: <20220926100813.321988454@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Namhyung Kim [ Upstream commit 999e4eaa4b3691acf85d094836260ec4b66c74fd ] It needs to enter the namespace before reading a file. Fixes: 4183a8d70a288627 ("perf tools: Allow synthesizing the build id for k= ernel/modules/tasks in PERF_RECORD_MMAP2") Signed-off-by: Namhyung Kim Cc: Adrian Hunter Cc: Ian Rogers Cc: Jiri Olsa Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/20220920222822.2171056-1-namhyung@kernel.= org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- tools/perf/util/synthetic-events.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic= -events.c index 84d17bd4efae..64e273b2b1b2 100644 --- a/tools/perf/util/synthetic-events.c +++ b/tools/perf/util/synthetic-events.c @@ -367,13 +367,24 @@ static void perf_record_mmap2__read_build_id(struct p= erf_record_mmap2 *event, bool is_kernel) { struct build_id bid; + struct nsinfo *nsi; + struct nscookie nc; int rc; =20 - if (is_kernel) + if (is_kernel) { rc =3D sysfs__read_build_id("/sys/kernel/notes", &bid); - else - rc =3D filename__read_build_id(event->filename, &bid) > 0 ? 0 : -1; + goto out; + } + + nsi =3D nsinfo__new(event->pid); + nsinfo__mountns_enter(nsi, &nc); =20 + rc =3D filename__read_build_id(event->filename, &bid) > 0 ? 0 : -1; + + nsinfo__mountns_exit(&nc); + nsinfo__put(nsi); + +out: if (rc =3D=3D 0) { memcpy(event->build_id, bid.data, sizeof(bid.data)); event->build_id_size =3D (u8) bid.size; --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DC0BC07E9D for ; Mon, 26 Sep 2022 11:58:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239113AbiIZL6P (ORCPT ); Mon, 26 Sep 2022 07:58:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239252AbiIZLy6 (ORCPT ); Mon, 26 Sep 2022 07:54:58 -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 D1547786CD; Mon, 26 Sep 2022 03:50:33 -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 326FC60AD6; Mon, 26 Sep 2022 10:48:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45A5AC433C1; Mon, 26 Sep 2022 10:48:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189326; bh=Nzip3Mw9RbGvjK9JI6FZQBgCbCA9OMQCLsOQWX+m7Ds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yJtz0TBDWVZS+pyH79hpvMOFaW59PA7h9GlSsuVg51vhwhqeOIBdysW5JDhmJRyCJ BLUS0/qWtYsgiCPL1Qqx3dRFzcW+aR4MFQIBAhk+nF6zoMSyoowI35k3u5flQopHF8 AiHCkP5Lp+ICo6uD/YimCFeAY2A0P/ScJI8VcsCk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , Hsin-Yi Wang , AngeloGioacchino Del Regno , Allen-KH Cheng , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 5.19 150/207] drm/mediatek: dsi: Move mtk_dsi_stop() call back to mtk_dsi_poweroff() Date: Mon, 26 Sep 2022 12:12:19 +0200 Message-Id: <20220926100813.361519555@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: N=C3=ADcolas F. R. A. Prado [ Upstream commit 90144dd8b0d137d9e78ef34b3c418e51a49299ad ] As the comment right before the mtk_dsi_stop() call advises, mtk_dsi_stop() should only be called after mtk_drm_crtc_atomic_disable(). That's because that function calls drm_crtc_wait_one_vblank(), which requires the vblank irq to be enabled. Previously mtk_dsi_stop(), being in mtk_dsi_poweroff() and guarded by a refcount, would only be called at the end of mtk_drm_crtc_atomic_disable(), through the call to mtk_crtc_ddp_hw_fini(). Commit cde7e2e35c28 ("drm/mediatek: Separate poweron/poweroff from enable/disable and define new funcs") moved the mtk_dsi_stop() call to mtk_output_dsi_disable(), causing it to be called before mtk_drm_crtc_atomic_disable(), and consequently generating vblank timeout warnings during suspend. Move the mtk_dsi_stop() call back to mtk_dsi_poweroff() so that we have a working vblank irq during mtk_drm_crtc_atomic_disable() and stop getting vblank timeout warnings. Fixes: cde7e2e35c28 ("drm/mediatek: Separate poweron/poweroff from enable/d= isable and define new funcs") Signed-off-by: N=C3=ADcolas F. R. A. Prado Tested-by: Hsin-Yi Wang Reviewed-by: AngeloGioacchino Del Regno Tested-by: Allen-KH Cheng Link: http://lists.infradead.org/pipermail/linux-mediatek/2022-August/04671= 3.html Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/mediatek/mtk_dsi.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/= mtk_dsi.c index e98b4aca2cb9..9a3b86c29b50 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -685,6 +685,16 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi) if (--dsi->refcount !=3D 0) return; =20 + /* + * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since + * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), + * which needs irq for vblank, and mtk_dsi_stop() will disable irq. + * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(), + * after dsi is fully set. + */ + mtk_dsi_stop(dsi); + + mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500); mtk_dsi_reset_engine(dsi); mtk_dsi_lane0_ulp_mode_enter(dsi); mtk_dsi_clk_ulp_mode_enter(dsi); @@ -735,17 +745,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi) if (!dsi->enabled) return; =20 - /* - * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since - * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), - * which needs irq for vblank, and mtk_dsi_stop() will disable irq. - * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(), - * after dsi is fully set. - */ - mtk_dsi_stop(dsi); - - mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500); - dsi->enabled =3D false; } =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FA49C6FA83 for ; Mon, 26 Sep 2022 11:56:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238867AbiIZL4m (ORCPT ); Mon, 26 Sep 2022 07:56:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238941AbiIZLyI (ORCPT ); Mon, 26 Sep 2022 07:54:08 -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 8305357E21; Mon, 26 Sep 2022 03:50: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 ams.source.kernel.org (Postfix) with ESMTPS id B7A3EB80782; Mon, 26 Sep 2022 10:48:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B707C433C1; Mon, 26 Sep 2022 10:48:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189329; bh=lvpX7YPeNPwuSs6jKx97XhMPdwGu8NHyaJz9o3M1oV8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IJD5MNFhFvqGe0+jB66e63TJMA6b1d+Sy5HcaZcUkPyI3lVqoteah4Zgupdxv8P+h Yy/g6VDByaiyU4Oh7dX27Irs6hmhUtG9V042YGQNHTGe4IEzr0XDi2rWDY7ppmkqWt 7w9/ZvQ8s9P6ZH4ngkodwcNEl3W+gsnn6KGGXM38= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Larysa Zaremba , Alexander Lobakin , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 151/207] ice: Fix ice_xdp_xmit() when XDP TX queue number is not sufficient Date: Mon, 26 Sep 2022 12:12:20 +0200 Message-Id: <20220926100813.412342615@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Larysa Zaremba [ Upstream commit 114f398d48c571bb628187a7b2dd42695156781f ] The original patch added the static branch to handle the situation, when assigning an XDP TX queue to every CPU is not possible, so they have to be shared. However, in the XDP transmit handler ice_xdp_xmit(), an error was returned in such cases even before static condition was checked, thus making queue sharing still impossible. Fixes: 22bf877e528f ("ice: introduce XDP_TX fallback path") Signed-off-by: Larysa Zaremba Reviewed-by: Alexander Lobakin Link: https://lore.kernel.org/r/20220919134346.25030-1-larysa.zaremba@intel= .com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/intel/ice/ice_txrx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethern= et/intel/ice/ice_txrx.c index 836dce840712..97453d1dfafe 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx.c @@ -610,7 +610,7 @@ ice_xdp_xmit(struct net_device *dev, int n, struct xdp_= frame **frames, if (test_bit(ICE_VSI_DOWN, vsi->state)) return -ENETDOWN; =20 - if (!ice_is_xdp_ena_vsi(vsi) || queue_index >=3D vsi->num_xdp_txq) + if (!ice_is_xdp_ena_vsi(vsi)) return -ENXIO; =20 if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK)) @@ -621,6 +621,9 @@ ice_xdp_xmit(struct net_device *dev, int n, struct xdp_= frame **frames, xdp_ring =3D vsi->xdp_rings[queue_index]; spin_lock(&xdp_ring->tx_lock); } else { + /* Generally, should not happen */ + if (unlikely(queue_index >=3D vsi->num_xdp_txq)) + return -ENXIO; xdp_ring =3D vsi->xdp_rings[queue_index]; } =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F90DC32771 for ; Mon, 26 Sep 2022 11:53:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238220AbiIZLxO (ORCPT ); Mon, 26 Sep 2022 07:53:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238378AbiIZLwi (ORCPT ); Mon, 26 Sep 2022 07:52:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64A0357576; Mon, 26 Sep 2022 03:49: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 ams.source.kernel.org (Postfix) with ESMTPS id C3F77B80926; Mon, 26 Sep 2022 10:48:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2748BC433C1; Mon, 26 Sep 2022 10:48:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189335; bh=0PVBwFEwMkNIAprWOVS+i7NM3sUyaLtG0yoOTYihzJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I4Vk+ALXgMvUE4Ys4KORi6XsuXJfenzE5Sw+roJpP5g8b6OQXiTp85qH4CnRWNK1E /Tmz/ri2EsS7SB3G8SJKRhDl7Jqd2WLSEo3neVcftTzXAZ5d0TVDKMY0PzfROT7/LB llf95iJ9PBBOxi5w/Tr8fx5FetHSaDo7h+Gz/ka8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Gu , Paolo Abeni , Sasha Levin Subject: [PATCH 5.19 152/207] net/smc: Stop the CLC flow if no link to map buffers on Date: Mon, 26 Sep 2022 12:12:21 +0200 Message-Id: <20220926100813.457204333@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wen Gu [ Upstream commit e738455b2c6dcdab03e45d97de36476f93f557d2 ] There might be a potential race between SMC-R buffer map and link group termination. smc_smcr_terminate_all() | smc_connect_rdma() Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz -------------------------------------------------------------- | smc_conn_create() for links in smcibdev | schedule links down | | smc_buf_create() | \- smcr_buf_map_usable_links() | \- no usable links found, | (rmb->mr =3D NULL) | | smc_clc_send_confirm() | \- access conn->rmb_desc->mr[]->rkey | (panic) During reboot and IB device module remove, all links will be set down and no usable links remain in link groups. In such situation smcr_buf_map_usable_links() should return an error and stop the CLC flow accessing to uninitialized mr. Fixes: b9247544c1bc ("net/smc: convert static link ID instances to support = multiple links") Signed-off-by: Wen Gu Link: https://lore.kernel.org/r/1663656189-32090-1-git-send-email-guwen@lin= ux.alibaba.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/smc/smc_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index 1f3bb1f6b1f7..8095876b66eb 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c @@ -2148,7 +2148,7 @@ static struct smc_buf_desc *smcr_new_buf_create(struc= t smc_link_group *lgr, static int smcr_buf_map_usable_links(struct smc_link_group *lgr, struct smc_buf_desc *buf_desc, bool is_rmb) { - int i, rc =3D 0; + int i, rc =3D 0, cnt =3D 0; =20 /* protect against parallel link reconfiguration */ mutex_lock(&lgr->llc_conf_mutex); @@ -2161,9 +2161,12 @@ static int smcr_buf_map_usable_links(struct smc_link= _group *lgr, rc =3D -ENOMEM; goto out; } + cnt++; } out: mutex_unlock(&lgr->llc_conf_mutex); + if (!rc && !cnt) + rc =3D -EINVAL; return rc; } =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB938C32771 for ; Mon, 26 Sep 2022 11:56:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238884AbiIZL4s (ORCPT ); Mon, 26 Sep 2022 07:56:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238981AbiIZLyN (ORCPT ); Mon, 26 Sep 2022 07:54:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16E564DB00; Mon, 26 Sep 2022 03:50:09 -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 EC92B60B2F; Mon, 26 Sep 2022 10:48:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F11C5C433C1; Mon, 26 Sep 2022 10:48:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189338; bh=rSpcze+w5f8A6yGVWV9axhSYli8sV5dEXvHyPyy8LP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rMI1eKMW/+uz6oNgT84xg24fbpM9RFPw60WU1chWol4E9j6HlfejmJmtP9bAT8Wkn HyoA8okA15hS1iiSJ/RnfLSx9Izs7x97hNHxy5f5Ob6tXLDciN+l2Gau29aCW/T5Oj Whc/cFFM5CLp8xjsdf5RWHVz2fryEHjHxrCabges= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Walle , Andrew Lunn , Horatiu Vultur , Divya Koppera , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 153/207] net: phy: micrel: fix shared interrupt on LAN8814 Date: Mon, 26 Sep 2022 12:12:22 +0200 Message-Id: <20220926100813.496924103@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Walle [ Upstream commit 2002fbac743b6e2391b4ed50ad9eb626768dd78a ] Since commit ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy") the handler always returns IRQ_HANDLED, except in an error case. Before that commit, the interrupt status register was checked and if it was empty, IRQ_NONE was returned. Restore that behavior to play nice with the interrupt line being shared with others. Fixes: ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy") Signed-off-by: Michael Walle Reviewed-by: Andrew Lunn Reviewed-by: Horatiu Vultur Reviewed-by: Divya Koppera Link: https://lore.kernel.org/r/20220920141619.808117-1-michael@walle.cc Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/phy/micrel.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 34483a4bd688..e8e1101911b2 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -2662,16 +2662,19 @@ static int lan8804_config_init(struct phy_device *p= hydev) static irqreturn_t lan8814_handle_interrupt(struct phy_device *phydev) { int irq_status, tsu_irq_status; + int ret =3D IRQ_NONE; =20 irq_status =3D phy_read(phydev, LAN8814_INTS); - if (irq_status > 0 && (irq_status & LAN8814_INT_LINK)) - phy_trigger_machine(phydev); - if (irq_status < 0) { phy_error(phydev); return IRQ_NONE; } =20 + if (irq_status & LAN8814_INT_LINK) { + phy_trigger_machine(phydev); + ret =3D IRQ_HANDLED; + } + while (1) { tsu_irq_status =3D lanphy_read_page_reg(phydev, 4, LAN8814_INTR_STS_REG); @@ -2680,12 +2683,15 @@ static irqreturn_t lan8814_handle_interrupt(struct = phy_device *phydev) (tsu_irq_status & (LAN8814_INTR_STS_REG_1588_TSU0_ | LAN8814_INTR_STS_REG_1588_TSU1_ | LAN8814_INTR_STS_REG_1588_TSU2_ | - LAN8814_INTR_STS_REG_1588_TSU3_))) + LAN8814_INTR_STS_REG_1588_TSU3_))) { lan8814_handle_ptp_interrupt(phydev); - else + ret =3D IRQ_HANDLED; + } else { break; + } } - return IRQ_HANDLED; + + return ret; } =20 static int lan8814_ack_interrupt(struct phy_device *phydev) --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E47F2C6FA90 for ; Mon, 26 Sep 2022 11:59:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239197AbiIZL6b (ORCPT ); Mon, 26 Sep 2022 07:58:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239294AbiIZLzF (ORCPT ); Mon, 26 Sep 2022 07:55:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C346B7674C; Mon, 26 Sep 2022 03:50: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 dfw.source.kernel.org (Postfix) with ESMTPS id 9994760A1E; Mon, 26 Sep 2022 10:49:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7942C433D6; Mon, 26 Sep 2022 10:49:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189341; bh=DB6JJ0OuAQG/wy+oVUXwoV1NXhvvQF13oov5s/pVZwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t9zbYKz2BW/iYuMFQIh99nm16rlKyMw7vJ6algIQVT496NnCZS53wUIAu4AqNIdjB NNAN05R/U+LqvUQYboxoD9FSbe4QomG36zMWew4IOP5DOTzH4Axn/Qw2QO4OXOo51T S8vTm2QR9288kLxEeU1AVXR1ggDClcr8ZU9cBZn4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jussi Maki , Jonathan Toppins , Jay Vosburgh , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 154/207] bonding: fix NULL deref in bond_rr_gen_slave_id Date: Mon, 26 Sep 2022 12:12:23 +0200 Message-Id: <20220926100813.544905260@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jonathan Toppins [ Upstream commit 0e400d602f46360752e4b32ce842dba3808e15e6 ] Fix a NULL dereference of the struct bonding.rr_tx_counter member because if a bond is initially created with an initial mode !=3D zero (Round Robin) the memory required for the counter is never created and when the mode is changed there is never any attempt to verify the memory is allocated upon switching modes. This causes the following Oops on an aarch64 machine: [ 334.686773] Unable to handle kernel paging request at virtual addres= s ffff2c91ac905000 [ 334.694703] Mem abort info: [ 334.697486] ESR =3D 0x0000000096000004 [ 334.701234] EC =3D 0x25: DABT (current EL), IL =3D 32 bits [ 334.706536] SET =3D 0, FnV =3D 0 [ 334.709579] EA =3D 0, S1PTW =3D 0 [ 334.712719] FSC =3D 0x04: level 0 translation fault [ 334.717586] Data abort info: [ 334.720454] ISV =3D 0, ISS =3D 0x00000004 [ 334.724288] CM =3D 0, WnR =3D 0 [ 334.727244] swapper pgtable: 4k pages, 48-bit VAs, pgdp=3D000008044d= 662000 [ 334.733944] [ffff2c91ac905000] pgd=3D0000000000000000, p4d=3D0000000= 000000000 [ 334.740734] Internal error: Oops: 96000004 [#1] SMP [ 334.745602] Modules linked in: bonding tls veth rfkill sunrpc arm_sp= e_pmu vfat fat acpi_ipmi ipmi_ssif ixgbe igb i40e mdio ipmi_devintf ipmi_ms= ghandler arm_cmn arm_dsu_pmu cppc_cpufreq acpi_tad fuse zram crct10dif_ce a= st ghash_ce sbsa_gwdt nvme drm_vram_helper drm_ttm_helper nvme_core ttm xge= ne_hwmon [ 334.772217] CPU: 7 PID: 2214 Comm: ping Not tainted 6.0.0-rc4-00133-= g64ae13ed4784 #4 [ 334.779950] Hardware name: GIGABYTE R272-P31-00/MP32-AR1-00, BIOS F1= 8v (SCP: 1.08.20211002) 12/01/2021 [ 334.789244] pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BT= YPE=3D--) [ 334.796196] pc : bond_rr_gen_slave_id+0x40/0x124 [bonding] [ 334.801691] lr : bond_xmit_roundrobin_slave_get+0x38/0xdc [bonding] [ 334.807962] sp : ffff8000221733e0 [ 334.811265] x29: ffff8000221733e0 x28: ffffdbac8572d198 x27: ffff800= 02217357c [ 334.818392] x26: 000000000000002a x25: ffffdbacb33ee000 x24: ffff07f= f980fa000 [ 334.825519] x23: ffffdbacb2e398ba x22: ffff07ff98102000 x21: ffff07f= f981029c0 [ 334.832646] x20: 0000000000000001 x19: ffff07ff981029c0 x18: 0000000= 000000014 [ 334.839773] x17: 0000000000000000 x16: ffffdbacb1004364 x15: 0000aaa= abe2f5a62 [ 334.846899] x14: ffff07ff8e55d968 x13: ffff07ff8e55db30 x12: 0000000= 000000000 [ 334.854026] x11: ffffdbacb21532e8 x10: 0000000000000001 x9 : ffffdba= c857178ec [ 334.861153] x8 : ffff07ff9f6e5a28 x7 : 0000000000000000 x6 : 0000000= 07c2b3742 [ 334.868279] x5 : ffff2c91ac905000 x4 : ffff2c91ac905000 x3 : ffff07f= f9f554400 [ 334.875406] x2 : ffff2c91ac905000 x1 : 0000000000000001 x0 : ffff07f= f981029c0 [ 334.882532] Call trace: [ 334.884967] bond_rr_gen_slave_id+0x40/0x124 [bonding] [ 334.890109] bond_xmit_roundrobin_slave_get+0x38/0xdc [bonding] [ 334.896033] __bond_start_xmit+0x128/0x3a0 [bonding] [ 334.901001] bond_start_xmit+0x54/0xb0 [bonding] [ 334.905622] dev_hard_start_xmit+0xb4/0x220 [ 334.909798] __dev_queue_xmit+0x1a0/0x720 [ 334.913799] arp_xmit+0x3c/0xbc [ 334.916932] arp_send_dst+0x98/0xd0 [ 334.920410] arp_solicit+0xe8/0x230 [ 334.923888] neigh_probe+0x60/0xb0 [ 334.927279] __neigh_event_send+0x3b0/0x470 [ 334.931453] neigh_resolve_output+0x70/0x90 [ 334.935626] ip_finish_output2+0x158/0x514 [ 334.939714] __ip_finish_output+0xac/0x1a4 [ 334.943800] ip_finish_output+0x40/0xfc [ 334.947626] ip_output+0xf8/0x1a4 [ 334.950931] ip_send_skb+0x5c/0x100 [ 334.954410] ip_push_pending_frames+0x3c/0x60 [ 334.958758] raw_sendmsg+0x458/0x6d0 [ 334.962325] inet_sendmsg+0x50/0x80 [ 334.965805] sock_sendmsg+0x60/0x6c [ 334.969286] __sys_sendto+0xc8/0x134 [ 334.972853] __arm64_sys_sendto+0x34/0x4c [ 334.976854] invoke_syscall+0x78/0x100 [ 334.980594] el0_svc_common.constprop.0+0x4c/0xf4 [ 334.985287] do_el0_svc+0x38/0x4c [ 334.988591] el0_svc+0x34/0x10c [ 334.991724] el0t_64_sync_handler+0x11c/0x150 [ 334.996072] el0t_64_sync+0x190/0x194 [ 334.999726] Code: b9001062 f9403c02 d53cd044 8b040042 (b8210040) [ 335.005810] ---[ end trace 0000000000000000 ]--- [ 335.010416] Kernel panic - not syncing: Oops: Fatal exception in int= errupt [ 335.017279] SMP: stopping secondary CPUs [ 335.021374] Kernel Offset: 0x5baca8eb0000 from 0xffff800008000000 [ 335.027456] PHYS_OFFSET: 0x80000000 [ 335.030932] CPU features: 0x0000,0085c029,19805c82 [ 335.035713] Memory Limit: none [ 335.038756] Rebooting in 180 seconds.. The fix is to allocate the memory in bond_open() which is guaranteed to be called before any packets are processed. Fixes: 848ca9182a7d ("net: bonding: Use per-cpu rr_tx_counter") CC: Jussi Maki Signed-off-by: Jonathan Toppins Acked-by: Jay Vosburgh Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/bonding/bond_main.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_mai= n.c index 83852e6719e2..ab7cb48f8dfd 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -4155,6 +4155,12 @@ static int bond_open(struct net_device *bond_dev) struct list_head *iter; struct slave *slave; =20 + if (BOND_MODE(bond) =3D=3D BOND_MODE_ROUNDROBIN && !bond->rr_tx_counter) { + bond->rr_tx_counter =3D alloc_percpu(u32); + if (!bond->rr_tx_counter) + return -ENOMEM; + } + /* reset slave->backup and slave->inactive */ if (bond_has_slaves(bond)) { bond_for_each_slave(bond, slave, iter) { @@ -6210,15 +6216,6 @@ static int bond_init(struct net_device *bond_dev) if (!bond->wq) return -ENOMEM; =20 - if (BOND_MODE(bond) =3D=3D BOND_MODE_ROUNDROBIN) { - bond->rr_tx_counter =3D alloc_percpu(u32); - if (!bond->rr_tx_counter) { - destroy_workqueue(bond->wq); - bond->wq =3D NULL; - return -ENOMEM; - } - } - spin_lock_init(&bond->stats_lock); netdev_lockdep_set_classes(bond_dev); =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6465C07E9D for ; Mon, 26 Sep 2022 11:56:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233429AbiIZL4B (ORCPT ); Mon, 26 Sep 2022 07:56:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238586AbiIZLxC (ORCPT ); Mon, 26 Sep 2022 07:53:02 -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 01D812DD4; Mon, 26 Sep 2022 03:49: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 3AD86B80925; Mon, 26 Sep 2022 10:49:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7230DC433C1; Mon, 26 Sep 2022 10:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189343; bh=84ue8kk8ImhjCX9CoLwQR/AtWolF4BJFbvIPQ/+t29o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H/u1gsBJu4Mp6Qq0usVSCs58LTZruAtgZVBpLZs0moHJ68pEeO7xXpX/DHJrirBCs AN22slJA5JkTGuhsUXerO/G9ghMYgj9ZNP7ALxH2o0qH8gTpp761y47i4HEpZXqgxX Mp+yyPFZd5i6G7/X54cDBhT+1S8+XipvzQmagQ5Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Anderson , Andrew Lunn , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 155/207] net: sunhme: Fix packet reception for len < RX_COPY_THRESHOLD Date: Mon, 26 Sep 2022 12:12:24 +0200 Message-Id: <20220926100813.589625899@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Anderson [ Upstream commit 878e2405710aacfeeb19364c300f38b7a9abfe8f ] There is a separate receive path for small packets (under 256 bytes). Instead of allocating a new dma-capable skb to be used for the next packet, this path allocates a skb and copies the data into it (reusing the existing sbk for the next packet). There are two bytes of junk data at the beginning of every packet. I believe these are inserted in order to allow aligned DMA and IP headers. We skip over them using skb_reserve. Before copying over the data, we must use a barrier to ensure we see the whole packet. The current code only synchronizes len bytes, starting from the beginning of the packet, including the junk bytes. However, this leaves off the final two bytes in the packet. Synchronize the whole packet. To reproduce this problem, ping a HME with a payload size between 17 and 214 $ ping -s 17 which will complain rather loudly about the data mismatch. Small packets (below 60 bytes on the wire) do not have this issue. I suspect this is related to the padding added to increase the minimum packet size. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Sean Anderson Reviewed-by: Andrew Lunn Link: https://lore.kernel.org/r/20220920235018.1675956-1-seanga2@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/sun/sunhme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/s= unhme.c index 8594ee839628..88aa0d310aee 100644 --- a/drivers/net/ethernet/sun/sunhme.c +++ b/drivers/net/ethernet/sun/sunhme.c @@ -2020,9 +2020,9 @@ static void happy_meal_rx(struct happy_meal *hp, stru= ct net_device *dev) =20 skb_reserve(copy_skb, 2); skb_put(copy_skb, len); - dma_sync_single_for_cpu(hp->dma_dev, dma_addr, len, DMA_FROM_DEVICE); + dma_sync_single_for_cpu(hp->dma_dev, dma_addr, len + 2, DMA_FROM_DEVICE= ); skb_copy_from_linear_data(skb, copy_skb->data, len); - dma_sync_single_for_device(hp->dma_dev, dma_addr, len, DMA_FROM_DEVICE); + dma_sync_single_for_device(hp->dma_dev, dma_addr, len + 2, DMA_FROM_DEV= ICE); /* Reuse original ring buffer. */ hme_write_rxd(hp, this, (RXFLAG_OWN|((RX_BUF_ALLOC_SIZE-RX_OFFSET)<<16)), --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E2C6C6FA94 for ; Mon, 26 Sep 2022 11:59:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239415AbiIZL6u (ORCPT ); Mon, 26 Sep 2022 07:58:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239448AbiIZLze (ORCPT ); Mon, 26 Sep 2022 07:55:34 -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 36DB7796AE; Mon, 26 Sep 2022 03:51:06 -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 D710BB8095D; Mon, 26 Sep 2022 10:49:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D03EC433D7; Mon, 26 Sep 2022 10:49:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189346; bh=p3l9Daf0O6zTp8hpjyYiv/nHdGqWe/G0pHnU/Wl1hXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2oS8lddXsQqgXsrK3M2KRrUsr3/nOq8/ZTLS7QB2QsFOGLxXB8tbTIZWureFdDZix g4ZzTagSszzeXDLPXpJJTBUK5t6YXX9J4jvE3QNVSrp+WPa8VsM1IAbGC9NhyLu+AP usa9s/XJYb4M6nvs9zCIz+JM1cFK9UC1loV2G1fA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Vlad Buslov , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 156/207] net: sched: fix possible refcount leak in tc_new_tfilter() Date: Mon, 26 Sep 2022 12:12:25 +0200 Message-Id: <20220926100813.627048753@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hangyu Hua [ Upstream commit c2e1cfefcac35e0eea229e148c8284088ce437b5 ] tfilter_put need to be called to put the refount got by tp->ops->get to avoid possible refcount leak when chain->tmplt_ops !=3D NULL and chain->tmplt_ops !=3D tp->ops. Fixes: 7d5509fa0d3d ("net: sched: extend proto ops with 'put' callback") Signed-off-by: Hangyu Hua Reviewed-by: Vlad Buslov Link: https://lore.kernel.org/r/20220921092734.31700-1-hbh25y@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- net/sched/cls_api.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index ac366c99086f..7d7f7bac0216 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -2136,6 +2136,7 @@ static int tc_new_tfilter(struct sk_buff *skb, struct= nlmsghdr *n, } =20 if (chain->tmplt_ops && chain->tmplt_ops !=3D tp->ops) { + tfilter_put(tp, fh); NL_SET_ERR_MSG(extack, "Chain template is set to a different filter kind= "); err =3D -EINVAL; goto errout; --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 339EFC6FA86 for ; Mon, 26 Sep 2022 11:56:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238312AbiIZL4F (ORCPT ); Mon, 26 Sep 2022 07:56:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238301AbiIZLxH (ORCPT ); Mon, 26 Sep 2022 07:53:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC44B1F9; Mon, 26 Sep 2022 03:49:32 -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 E9388B80977; Mon, 26 Sep 2022 10:49:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 412AAC433D6; Mon, 26 Sep 2022 10:49:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189349; bh=pWaRJyjXJ4O6BGgYMnwLbJO+Jhs/QYK2pFYO54lvYUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lQqHEjS+X1Mp1R9XePRsK9NjjkvZv5b/c/o+fSO/QlA2fdw15QrlYybR9F093FatP UTheemVFZwxYN7mRyVelx8i2PnGKH0t8iJX4+9tnYbmY2e+ME/wEwGgOXvaw/27Cfi j+CEow4ERj3pvECurPyKJ3lyuACRcp5M/9N6t6yY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Gospodarek , Michael Chan , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 157/207] bnxt: prevent skb UAF after handing over to PTP worker Date: Mon, 26 Sep 2022 12:12:26 +0200 Message-Id: <20220926100813.673579991@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jakub Kicinski [ Upstream commit c31f26c8f69f776759cbbdfb38e40ea91aa0dd65 ] When reading the timestamp is required bnxt_tx_int() hands over the ownership of the completed skb to the PTP worker. The skb should not be used afterwards, as the worker may run before the rest of our code and free the skb, leading to a use-after-free. Since dev_kfree_skb_any() accepts NULL make the loss of ownership more obvious and set skb to NULL. Fixes: 83bb623c968e ("bnxt_en: Transmit and retrieve packet timestamps") Reviewed-by: Andy Gospodarek Reviewed-by: Michael Chan Link: https://lore.kernel.org/r/20220921201005.335390-1-kuba@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethern= et/broadcom/bnxt/bnxt.c index 964354536f9c..111a952f880e 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -662,7 +662,6 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_na= pi *bnapi, int nr_pkts) =20 for (i =3D 0; i < nr_pkts; i++) { struct bnxt_sw_tx_bd *tx_buf; - bool compl_deferred =3D false; struct sk_buff *skb; int j, last; =20 @@ -671,6 +670,8 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_na= pi *bnapi, int nr_pkts) skb =3D tx_buf->skb; tx_buf->skb =3D NULL; =20 + tx_bytes +=3D skb->len; + if (tx_buf->is_push) { tx_buf->is_push =3D 0; goto next_tx_int; @@ -691,8 +692,9 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_na= pi *bnapi, int nr_pkts) } if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS)) { if (bp->flags & BNXT_FLAG_CHIP_P5) { + /* PTP worker takes ownership of the skb */ if (!bnxt_get_tx_ts_p5(bp, skb)) - compl_deferred =3D true; + skb =3D NULL; else atomic_inc(&bp->ptp_cfg->tx_avail); } @@ -701,9 +703,7 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_na= pi *bnapi, int nr_pkts) next_tx_int: cons =3D NEXT_TX(cons); =20 - tx_bytes +=3D skb->len; - if (!compl_deferred) - dev_kfree_skb_any(skb); + dev_kfree_skb_any(skb); } =20 netdev_tx_completed_queue(txq, nr_pkts, tx_bytes); --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15E29C07E9D for ; Mon, 26 Sep 2022 12:21:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235437AbiIZMVg (ORCPT ); Mon, 26 Sep 2022 08:21:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239437AbiIZMU5 (ORCPT ); Mon, 26 Sep 2022 08:20: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 0C24F5E54A; Mon, 26 Sep 2022 04:03: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 dfw.source.kernel.org (Postfix) with ESMTPS id 468746068C; Mon, 26 Sep 2022 10:49:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CD2DC433D6; Mon, 26 Sep 2022 10:49:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189352; bh=4XjvDMY7+JMNNTaZ99vTKWavds7RXyMkidR26fFMFpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gmHF06wl3JqtTE4Qc5W7PpsZfKxRdlvi0y+z/w2n3jxOM+mJO+ohdi8Et9pcqPS4X bLNJ4ucVc7dX22tNxNS3SU8eKFV98SmceRAlsuHCT+Obwr7mRCAPdoKhpuIIiFyw8N K5uVouAowlRVSYrqBcs3FKv2RasWAF52h6gc9tTA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangbin Liu , Petr Machata , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 158/207] selftests: forwarding: add shebang for sch_red.sh Date: Mon, 26 Sep 2022 12:12:27 +0200 Message-Id: <20220926100813.726220380@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hangbin Liu [ Upstream commit 83e4b196838d90799a8879e5054a3beecf9ed256 ] RHEL/Fedora RPM build checks are stricter, and complain when executable files don't have a shebang line, e.g. *** WARNING: ./kselftests/net/forwarding/sch_red.sh is executable but has n= o shebang, removing executable bit Fix it by adding shebang line. Fixes: 6cf0291f9517 ("selftests: forwarding: Add a RED test for SW datapath= ") Signed-off-by: Hangbin Liu Reviewed-by: Petr Machata Link: https://lore.kernel.org/r/20220922024453.437757-1-liuhangbin@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- tools/testing/selftests/net/forwarding/sch_red.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/net/forwarding/sch_red.sh b/tools/test= ing/selftests/net/forwarding/sch_red.sh index e714bae473fb..81f31179ac88 100755 --- a/tools/testing/selftests/net/forwarding/sch_red.sh +++ b/tools/testing/selftests/net/forwarding/sch_red.sh @@ -1,3 +1,4 @@ +#!/bin/bash # SPDX-License-Identifier: GPL-2.0 =20 # This test sends one stream of traffic from H1 through a TBF shaper, to a= RED --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 584C1C07E9D for ; Mon, 26 Sep 2022 11:56:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236616AbiIZL4N (ORCPT ); Mon, 26 Sep 2022 07:56:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238364AbiIZLx2 (ORCPT ); Mon, 26 Sep 2022 07:53:28 -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 1E8EE1F636; Mon, 26 Sep 2022 03:49:42 -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 AD395B80976; Mon, 26 Sep 2022 10:49:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D3CFC433C1; Mon, 26 Sep 2022 10:49:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189355; bh=e0dN7MrU8TIdgGaJFqTE0O157ZpkWC3tkGGG1Eoh4NQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V/zoiy62DIHaoDdTcyjEDngzyNrYa+d6D3dn8UmzEcJ1VPyEBYqPLH2ChXmjvpkKp zAYARpqcfBcZgNG9VrHbGw/+S03X4ogJSgj0iabJDylsKlze/9blm/vT0Bof/7nN9v 7vFXIM8yFkZwkqE4WIv+lGqddCIK3GaxcCFNdjwk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Homin Rhee , Jens Axboe Subject: [PATCH 5.19 159/207] io_uring: ensure that cached task references are always put on exit Date: Mon, 26 Sep 2022 12:12:28 +0200 Message-Id: <20220926100813.774193328@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jens Axboe commit e775f93f2ab976a2cdb4a7b53063cbe890904f73 upstream. io_uring caches task references to avoid doing atomics for each of them per request. If a request is put from the same task that allocated it, then we can maintain a per-ctx cache of them. This obviously relies on io_uring always pruning caches in a reliable way, and there's currently a case off io_uring fd release where we can miss that. One example is a ring setup with IOPOLL, which relies on the task polling for completions, which will free them. However, if such a task submits a request and then exits or closes the ring without reaping the completion, then ring release will reap and put. If release happens from that very same task, the completed request task refs will get put back into the cache pool. This is problematic, as we're now beyond the point of pruning caches. Manually drop these caches after doing an IOPOLL reap. This releases references from the current task, which is enough. If another task happens to be doing the release, then the caching will not be triggered and there's no issue. Cc: stable@vger.kernel.org Fixes: e98e49b2bbf7 ("io_uring: extend task put optimisations") Reported-by: Homin Rhee Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- io_uring/io_uring.c | 3 +++ 1 file changed, 3 insertions(+) --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -10951,6 +10951,9 @@ static __cold void io_ring_ctx_wait_and_ io_poll_remove_all(ctx, NULL, true); /* if we failed setting up the ctx, we might not have any rings */ io_iopoll_try_reap_events(ctx); + /* drop cached put refs after potentially doing completions */ + if (current->io_uring) + io_uring_drop_tctx_refs(current); } =20 INIT_WORK(&ctx->exit_work, io_ring_exit_work); From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83BC2C07E9D for ; Mon, 26 Sep 2022 12:07:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239443AbiIZMHd (ORCPT ); Mon, 26 Sep 2022 08:07:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239972AbiIZMGC (ORCPT ); Mon, 26 Sep 2022 08:06:02 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F44B7E038; Mon, 26 Sep 2022 03:55:35 -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 sin.source.kernel.org (Postfix) with ESMTPS id C1156CE10DC; Mon, 26 Sep 2022 10:49:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 161C1C433C1; Mon, 26 Sep 2022 10:49:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189358; bh=xN7VbhVCMnKTVW43mRCQHob7/sSu/RcC7woljp5Xo80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kS37EpXKeNDDMkmunrSnJroiQuQYqtruX6zBq+btBMANDc/FAjviyDJZ8WigBpSKt FIdwNMPwyXKcSK+Y/DaYb9ihGzv6iSfIs5EYhwsc9fYxEeT2WCZQNndU2YEaiOjha2 JNDYPXa14ORsHWPJqCWqnqmz/de9r65M9gjBavaU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fugang Duan , Sherry Sun , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Lukas Wunner Subject: [PATCH 5.19 160/207] serial: fsl_lpuart: Reset prior to registration Date: Mon, 26 Sep 2022 12:12:29 +0200 Message-Id: <20220926100813.821388050@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lukas Wunner commit 60f361722ad2ae5ee667d0b0545d40c42f754daf upstream. Since commit bd5305dcabbc ("tty: serial: fsl_lpuart: do software reset for imx7ulp and imx8qxp"), certain i.MX UARTs are reset after they've already been registered. Register state may thus be clobbered after user space has begun to open and access the UART. Avoid by performing the reset prior to registration. Fixes: bd5305dcabbc ("tty: serial: fsl_lpuart: do software reset for imx7ul= p and imx8qxp") Cc: stable@vger.kernel.org # v5.15+ Cc: Fugang Duan Cc: Sherry Sun Reviewed-by: Ilpo J=C3=A4rvinen Signed-off-by: Lukas Wunner Link: https://lore.kernel.org/r/72fb646c1b0b11c989850c55f52f9ff343d1b2fa.16= 62884345.git.lukas@wunner.de Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/tty/serial/fsl_lpuart.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -2706,14 +2706,15 @@ static int lpuart_probe(struct platform_ lpuart_reg.cons =3D LPUART_CONSOLE; handler =3D lpuart_int; } - ret =3D uart_add_one_port(&lpuart_reg, &sport->port); - if (ret) - goto failed_attach_port; =20 ret =3D lpuart_global_reset(sport); if (ret) goto failed_reset; =20 + ret =3D uart_add_one_port(&lpuart_reg, &sport->port); + if (ret) + goto failed_attach_port; + ret =3D uart_get_rs485_mode(&sport->port); if (ret) goto failed_get_rs485; @@ -2736,9 +2737,9 @@ static int lpuart_probe(struct platform_ =20 failed_irq_request: failed_get_rs485: -failed_reset: uart_remove_one_port(&lpuart_reg, &sport->port); failed_attach_port: +failed_reset: lpuart_disable_clks(sport); return ret; } From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75DD7C07E9D for ; Mon, 26 Sep 2022 12:14:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239250AbiIZMOL (ORCPT ); Mon, 26 Sep 2022 08:14:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239512AbiIZMNf (ORCPT ); Mon, 26 Sep 2022 08:13:35 -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 64F2249B77; Mon, 26 Sep 2022 03:58:49 -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 F1BBD60B60; Mon, 26 Sep 2022 10:49:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03C11C433D6; Mon, 26 Sep 2022 10:49:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189361; bh=xMarRssPDX5kzxQMfKSIOrhgYAogBN3kRzzwyrV9xu4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gv0RibuL7E2FlMPxr16C+iLs/UlKBgJ1aO3ncccRQw//ZSHs3huC/ykRmQuws8j/Q Hg5DikwJx+/mMmCT4Gf26f3ynEfLhJcTVB96AoKp++yanW0/Q63W4AtP9EWUKW0PTm x0W9HruUZXI/LGBomc3pZKwK5b8iPj6Wkh8MGUpo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , stable , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 5.19 161/207] serial: Create uart_xmit_advance() Date: Mon, 26 Sep 2022 12:12:30 +0200 Message-Id: <20220926100813.873806970@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilpo J=C3=A4rvinen commit e77cab77f2cb3a1ca2ba8df4af45bb35617ac16d upstream. A very common pattern in the drivers is to advance xmit tail index and do bookkeeping of Tx'ed characters. Create uart_xmit_advance() to handle it. Reviewed-by: Andy Shevchenko Cc: stable Signed-off-by: Ilpo J=C3=A4rvinen Link: https://lore.kernel.org/r/20220901143934.8850-2-ilpo.jarvinen@linux.i= ntel.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- include/linux/serial_core.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -302,6 +302,23 @@ struct uart_state { /* number of characters left in xmit buffer before we ask for more */ #define WAKEUP_CHARS 256 =20 +/** + * uart_xmit_advance - Advance xmit buffer and account Tx'ed chars + * @up: uart_port structure describing the port + * @chars: number of characters sent + * + * This function advances the tail of circular xmit buffer by the number of + * @chars transmitted and handles accounting of transmitted bytes (into + * @up's icount.tx). + */ +static inline void uart_xmit_advance(struct uart_port *up, unsigned int ch= ars) +{ + struct circ_buf *xmit =3D &up->state->xmit; + + xmit->tail =3D (xmit->tail + chars) & (UART_XMIT_SIZE - 1); + up->icount.tx +=3D chars; +} + struct module; struct tty_driver; =20 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A20DC32771 for ; Mon, 26 Sep 2022 11:56:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238848AbiIZL4h (ORCPT ); Mon, 26 Sep 2022 07:56:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238849AbiIZLx6 (ORCPT ); Mon, 26 Sep 2022 07:53:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA82F101D3; Mon, 26 Sep 2022 03:49:44 -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 6D290B8095B; Mon, 26 Sep 2022 10:49:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAA39C433C1; Mon, 26 Sep 2022 10:49:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189367; bh=vOPXaVottFLXDjh23uGbUV0JWH7K6CBH8tJz+br+0xQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bjrh8jiETcnXiLhJw1t/jEWZya9YApJXy8sHPIOtahtSZ0iHH7iUUapSKE6KviKto CFcv+svloLt8E/QwFDQ852dRgYVBOEI1wuLZ9v1SA0wmhAxM2lFACX/Ipi4oeUYG+1 nVrP82hAc87VKQ6ES9rhvH8fvvim7cpUlCDQ/c5Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 5.19 162/207] serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting Date: Mon, 26 Sep 2022 12:12:31 +0200 Message-Id: <20220926100813.921698308@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilpo J=C3=A4rvinen commit 754f68044c7dd6c52534ba3e0f664830285c4b15 upstream. DMA complete & stop paths did not correctly account Tx'ed characters into icount.tx. Using uart_xmit_advance() fixes the problem. Fixes: e9ea096dd225 ("serial: tegra: add serial driver") Cc: # serial: Create uart_xmit_advance() Reviewed-by: Andy Shevchenko Signed-off-by: Ilpo J=C3=A4rvinen Link: https://lore.kernel.org/r/20220901143934.8850-3-ilpo.jarvinen@linux.i= ntel.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/tty/serial/serial-tegra.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/tty/serial/serial-tegra.c +++ b/drivers/tty/serial/serial-tegra.c @@ -525,7 +525,7 @@ static void tegra_uart_tx_dma_complete(v count =3D tup->tx_bytes_requested - state.residue; async_tx_ack(tup->tx_dma_desc); spin_lock_irqsave(&tup->uport.lock, flags); - xmit->tail =3D (xmit->tail + count) & (UART_XMIT_SIZE - 1); + uart_xmit_advance(&tup->uport, count); tup->tx_in_progress =3D 0; if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) uart_write_wakeup(&tup->uport); @@ -613,7 +613,6 @@ static unsigned int tegra_uart_tx_empty( static void tegra_uart_stop_tx(struct uart_port *u) { struct tegra_uart_port *tup =3D to_tegra_uport(u); - struct circ_buf *xmit =3D &tup->uport.state->xmit; struct dma_tx_state state; unsigned int count; =20 @@ -624,7 +623,7 @@ static void tegra_uart_stop_tx(struct ua dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state); count =3D tup->tx_bytes_requested - state.residue; async_tx_ack(tup->tx_dma_desc); - xmit->tail =3D (xmit->tail + count) & (UART_XMIT_SIZE - 1); + uart_xmit_advance(&tup->uport, count); tup->tx_in_progress =3D 0; } =20 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 110AEC6FA86 for ; Mon, 26 Sep 2022 11:59:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238384AbiIZL7K (ORCPT ); Mon, 26 Sep 2022 07:59:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239323AbiIZLzN (ORCPT ); Mon, 26 Sep 2022 07:55:13 -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 43BC078BE9; Mon, 26 Sep 2022 03:50:42 -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 7D35D60B4A; Mon, 26 Sep 2022 10:49:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78865C433D6; Mon, 26 Sep 2022 10:49:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189369; bh=xLv6Yp4tyzE+V2Ro4LgR0kyqrrBkxn5bGkLAx5w9QAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jWP2EGuIV81mMqSu1Er3qoMQXsfLGXmrylciEZEXNuGEAm5+cE4hEQ8NL1Tyasr9Z Kj1gcDnaF8xh/KyXAwfwItpHBjgR5m3H+EA6tERCLV92+hp3iEwv1x11hexOYBB0Cz EReUpfNFCnhHZ3J8LNJAdJKLKjnk+bBY8l9wWDro= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 5.19 163/207] serial: tegra-tcu: Use uart_xmit_advance(), fixes icount.tx accounting Date: Mon, 26 Sep 2022 12:12:32 +0200 Message-Id: <20220926100813.971169658@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilpo J=C3=A4rvinen commit 1d10cd4da593bc0196a239dcc54dac24b6b0a74e upstream. Tx'ing does not correctly account Tx'ed characters into icount.tx. Using uart_xmit_advance() fixes the problem. Fixes: 2d908b38d409 ("serial: Add Tegra Combined UART driver") Cc: # serial: Create uart_xmit_advance() Reviewed-by: Andy Shevchenko Signed-off-by: Ilpo J=C3=A4rvinen Link: https://lore.kernel.org/r/20220901143934.8850-4-ilpo.jarvinen@linux.i= ntel.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/tty/serial/tegra-tcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/serial/tegra-tcu.c +++ b/drivers/tty/serial/tegra-tcu.c @@ -101,7 +101,7 @@ static void tegra_tcu_uart_start_tx(stru break; =20 tegra_tcu_write(tcu, &xmit->buf[xmit->tail], count); - xmit->tail =3D (xmit->tail + count) & (UART_XMIT_SIZE - 1); + uart_xmit_advance(port, count); } =20 uart_write_wakeup(port); From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B37EDC07E9D for ; Mon, 26 Sep 2022 11:56:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238826AbiIZL4a (ORCPT ); Mon, 26 Sep 2022 07:56:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238813AbiIZLxu (ORCPT ); Mon, 26 Sep 2022 07:53:50 -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 2015D48CAF; Mon, 26 Sep 2022 03:49:53 -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 1DDF1B80921; Mon, 26 Sep 2022 10:49:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FA2FC433C1; Mon, 26 Sep 2022 10:49:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189372; bh=5Wecxc0YtwM+6k5gpDHuu2iI+A5vqPhrYMOoNyICU3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cT+qI3IyPIsyPDE6BHWc0YO4bKH4AMAts3Fh4BYuCmm0hSV6A1YPXJE0tJLD1tOLw dF7yl9atS8vlnYe7Tll1EjHyFZYLUWrJ8nuh8UUDd0d4uY5cDUKrek5YjVXeKcYLyC qUwR1GTF1Dx8/jVCJ/bqo1AvWp5HZeUDvcBDXjys= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marco Patalano , Muneendra , Ming Lei , Mukesh Ojha , Tejun Heo Subject: [PATCH 5.19 164/207] cgroup: cgroup_get_from_id() must check the looked-up kn is a directory Date: Mon, 26 Sep 2022 12:12:33 +0200 Message-Id: <20220926100814.011227446@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Lei commit df02452f3df069a59bc9e69c84435bf115cb6e37 upstream. cgroup has to be one kernfs dir, otherwise kernel panic is caused, especially cgroup id is provide from userspace. Reported-by: Marco Patalano Fixes: 6b658c4863c1 ("scsi: cgroup: Add cgroup_get_from_id()") Cc: Muneendra Signed-off-by: Ming Lei Acked-by: Mukesh Ojha Cc: stable@vger.kernel.org # v5.14+ Signed-off-by: Tejun Heo Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- kernel/cgroup/cgroup.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -6026,6 +6026,9 @@ struct cgroup *cgroup_get_from_id(u64 id if (!kn) goto out; =20 + if (kernfs_type(kn) !=3D KERNFS_DIR) + goto put; + rcu_read_lock(); =20 cgrp =3D rcu_dereference(*(void __rcu __force **)&kn->priv); @@ -6033,7 +6036,7 @@ struct cgroup *cgroup_get_from_id(u64 id cgrp =3D NULL; =20 rcu_read_unlock(); - +put: kernfs_put(kn); out: return cgrp; From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D307C6FA86 for ; Mon, 26 Sep 2022 12:01:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239194AbiIZMBD (ORCPT ); Mon, 26 Sep 2022 08:01:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239010AbiIZL5V (ORCPT ); Mon, 26 Sep 2022 07:57:21 -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 9E49179EF7; Mon, 26 Sep 2022 03:51:47 -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 0F085B8094E; Mon, 26 Sep 2022 10:51:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65411C433D6; Mon, 26 Sep 2022 10:51:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189488; bh=rPOYb/usdg3kKuCluI9ZiRDJ+/5EpnjMM/bZ0kffn6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G+hejAsZDwj0SNvEyPqdgMedsoYl5cLUhnkkGgoDJzgc+OTEYvlhAFrvNWB/lOh6I fHi3xE966VV0RcfsLWgyYafZYlMUaV6/V1Za/fdMkNAh02tlDUV2sDweUUw2Tmwekc crLEYIODZQ9+3HH+Z2qg59umw8E5Ksjb0hJVtYqY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shinichiro Kawasaki , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Vinod Koul Subject: [PATCH 5.19 165/207] phy: marvell: phy-mvebu-a3700-comphy: Remove broken reset support Date: Mon, 26 Sep 2022 12:12:34 +0200 Message-Id: <20220926100814.051873209@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pali Roh=C3=A1r commit 0a6fc70d76bddf98278af2ac000379c82aec8f11 upstream. Reset support for SATA PHY is somehow broken and after calling it, kernel is not able to detect and initialize SATA disk Samsung SSD 850 EMT0 [1]. Reset support was introduced in commit 934337080c6c ("phy: marvell: phy-mvebu-a3700-comphy: Add native kernel implementation") as part of complete rewrite of this driver. v1 patch series of that commit [2]=C2=A0did not contain reset support and was tested that is working fine with Ethernet, SATA and USB PHYs without issues too. So for now remove broken reset support and change implementation of power_off callback to power off all functions on specified lane (and not only selected function) because during startup kernel does not know which function was selected and configured by bootloader. Same logic was used also in v1 patch series of that commit. This change fixes issues with initialization of SATA disk Samsung SSD 850 and disk is working again, like before mentioned commit. Once problem with PHY reset callback is solved its functionality could be re-introduced. But for now it is unknown why it does not work. [1] - https://lore.kernel.org/r/20220531124159.3e4lgn2v462irbtz@shindev/ [2] - https://lore.kernel.org/r/20211028184242.22105-1-kabel@kernel.org/ Reported-by: Shinichiro Kawasaki Fixes: 934337080c6c ("phy: marvell: phy-mvebu-a3700-comphy: Add native kern= el implementation") Cc: stable@vger.kernel.org # v5.18+ Signed-off-by: Pali Roh=C3=A1r Tested-by: Shinichiro Kawasaki Link: https://lore.kernel.org/r/20220829083046.15082-1-pali@kernel.org Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/phy/marvell/phy-mvebu-a3700-comphy.c | 87 ++++---------------- 1 file changed, 17 insertions(+), 70 deletions(-) diff --git a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c b/drivers/phy/mar= vell/phy-mvebu-a3700-comphy.c index a4d7d9bd100d..67712c77d806 100644 --- a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c +++ b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c @@ -274,7 +274,6 @@ struct mvebu_a3700_comphy_lane { int submode; bool invert_tx; bool invert_rx; - bool needs_reset; }; =20 struct gbe_phy_init_data_fix { @@ -1097,40 +1096,12 @@ mvebu_a3700_comphy_pcie_power_off(struct mvebu_a370= 0_comphy_lane *lane) 0x0, PU_PLL_BIT | PU_RX_BIT | PU_TX_BIT); } =20 -static int mvebu_a3700_comphy_reset(struct phy *phy) +static void mvebu_a3700_comphy_usb3_power_off(struct mvebu_a3700_comphy_la= ne *lane) { - struct mvebu_a3700_comphy_lane *lane =3D phy_get_drvdata(phy); - u16 mask, data; - - dev_dbg(lane->dev, "resetting lane %d\n", lane->id); - - /* COMPHY reset for internal logic */ - comphy_lane_reg_set(lane, COMPHY_SFT_RESET, - SFT_RST_NO_REG, SFT_RST_NO_REG); - - /* COMPHY register reset (cleared automatically) */ - comphy_lane_reg_set(lane, COMPHY_SFT_RESET, SFT_RST, SFT_RST); - - /* PIPE soft and register reset */ - data =3D PIPE_SOFT_RESET | PIPE_REG_RESET; - mask =3D data; - comphy_lane_reg_set(lane, COMPHY_PIPE_RST_CLK_CTRL, data, mask); - - /* Release PIPE register reset */ - comphy_lane_reg_set(lane, COMPHY_PIPE_RST_CLK_CTRL, - 0x0, PIPE_REG_RESET); - - /* Reset SB configuration register (only for lanes 0 and 1) */ - if (lane->id =3D=3D 0 || lane->id =3D=3D 1) { - u32 mask, data; - - data =3D PIN_RESET_CORE_BIT | PIN_RESET_COMPHY_BIT | - PIN_PU_PLL_BIT | PIN_PU_RX_BIT | PIN_PU_TX_BIT; - mask =3D data | PIN_PU_IVREF_BIT | PIN_TX_IDLE_BIT; - comphy_periph_reg_set(lane, COMPHY_PHY_CFG1, data, mask); - } - - return 0; + /* + * The USB3 MAC sets the USB3 PHY to low state, so we do not + * need to power off USB3 PHY again. + */ } =20 static bool mvebu_a3700_comphy_check_mode(int lane, @@ -1171,10 +1142,6 @@ static int mvebu_a3700_comphy_set_mode(struct phy *p= hy, enum phy_mode mode, (lane->mode !=3D mode || lane->submode !=3D submode)) return -EBUSY; =20 - /* If changing mode, ensure reset is called */ - if (lane->mode !=3D PHY_MODE_INVALID && lane->mode !=3D mode) - lane->needs_reset =3D true; - /* Just remember the mode, ->power_on() will do the real setup */ lane->mode =3D mode; lane->submode =3D submode; @@ -1185,7 +1152,6 @@ static int mvebu_a3700_comphy_set_mode(struct phy *ph= y, enum phy_mode mode, static int mvebu_a3700_comphy_power_on(struct phy *phy) { struct mvebu_a3700_comphy_lane *lane =3D phy_get_drvdata(phy); - int ret; =20 if (!mvebu_a3700_comphy_check_mode(lane->id, lane->mode, lane->submode)) { @@ -1193,14 +1159,6 @@ static int mvebu_a3700_comphy_power_on(struct phy *p= hy) return -EINVAL; } =20 - if (lane->needs_reset) { - ret =3D mvebu_a3700_comphy_reset(phy); - if (ret) - return ret; - - lane->needs_reset =3D false; - } - switch (lane->mode) { case PHY_MODE_USB_HOST_SS: dev_dbg(lane->dev, "set lane %d to USB3 host mode\n", lane->id); @@ -1224,38 +1182,28 @@ static int mvebu_a3700_comphy_power_off(struct phy = *phy) { struct mvebu_a3700_comphy_lane *lane =3D phy_get_drvdata(phy); =20 - switch (lane->mode) { - case PHY_MODE_USB_HOST_SS: - /* - * The USB3 MAC sets the USB3 PHY to low state, so we do not - * need to power off USB3 PHY again. - */ - break; - - case PHY_MODE_SATA: - mvebu_a3700_comphy_sata_power_off(lane); - break; - - case PHY_MODE_ETHERNET: + switch (lane->id) { + case 0: + mvebu_a3700_comphy_usb3_power_off(lane); mvebu_a3700_comphy_ethernet_power_off(lane); - break; - - case PHY_MODE_PCIE: + return 0; + case 1: mvebu_a3700_comphy_pcie_power_off(lane); - break; - + mvebu_a3700_comphy_ethernet_power_off(lane); + return 0; + case 2: + mvebu_a3700_comphy_usb3_power_off(lane); + mvebu_a3700_comphy_sata_power_off(lane); + return 0; default: dev_err(lane->dev, "invalid COMPHY mode\n"); return -EINVAL; } - - return 0; } =20 static const struct phy_ops mvebu_a3700_comphy_ops =3D { .power_on =3D mvebu_a3700_comphy_power_on, .power_off =3D mvebu_a3700_comphy_power_off, - .reset =3D mvebu_a3700_comphy_reset, .set_mode =3D mvebu_a3700_comphy_set_mode, .owner =3D THIS_MODULE, }; @@ -1393,8 +1341,7 @@ static int mvebu_a3700_comphy_probe(struct platform_d= evice *pdev) * To avoid relying on the bootloader/firmware configuration, * power off all comphys. */ - mvebu_a3700_comphy_reset(phy); - lane->needs_reset =3D false; + mvebu_a3700_comphy_power_off(phy); } =20 provider =3D devm_of_phy_provider_register(&pdev->dev, --=20 2.37.3 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB376C6FA92 for ; Mon, 26 Sep 2022 11:59:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238999AbiIZL7Q (ORCPT ); Mon, 26 Sep 2022 07:59:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239490AbiIZLzn (ORCPT ); Mon, 26 Sep 2022 07:55:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93FE05852B; Mon, 26 Sep 2022 03:51:04 -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 92B6460BAF; Mon, 26 Sep 2022 10:49:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9ACD2C433C1; Mon, 26 Sep 2022 10:49:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189396; bh=75DfJ5Yqg1z2SFT3L+O7MKMIFpGoOqNpgcehWq6lixc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EEHSSawhAJfRsVeNEpHR7QwmZhcB7y55fx4gxpAsxZFP13nejiUzFCt3I9zZ5ZuvF nrE3X7kE6EguyMFvMCSG+WMVR151wcthge7LEV6DnFtS0Gjc02Z9zpu9xz/1MzI5WC 0GEEOoyG2pRsCJJLebdhqtmIU0SFjWIg/Y1LC/QA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Haberland , Jan Hoeppner , Jens Axboe Subject: [PATCH 5.19 166/207] s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing pavgroup Date: Mon, 26 Sep 2022 12:12:35 +0200 Message-Id: <20220926100814.089405843@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stefan Haberland commit db7ba07108a48c0f95b74fabbfd5d63e924f992d upstream. Fix Oops in dasd_alias_get_start_dev() function caused by the pavgroup pointer being NULL. The pavgroup pointer is checked on the entrance of the function but without the lcu->lock being held. Therefore there is a race window between dasd_alias_get_start_dev() and _lcu_update() which sets pavgroup to NULL with the lcu->lock held. Fix by checking the pavgroup pointer with lcu->lock held. Cc: # 2.6.25+ Fixes: 8e09f21574ea ("[S390] dasd: add hyper PAV support to DASD device dri= ver, part 1") Signed-off-by: Stefan Haberland Reviewed-by: Jan Hoeppner Link: https://lore.kernel.org/r/20220919154931.4123002-2-sth@linux.ibm.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/s390/block/dasd_alias.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/drivers/s390/block/dasd_alias.c +++ b/drivers/s390/block/dasd_alias.c @@ -675,12 +675,12 @@ int dasd_alias_remove_device(struct dasd struct dasd_device *dasd_alias_get_start_dev(struct dasd_device *base_devi= ce) { struct dasd_eckd_private *alias_priv, *private =3D base_device->private; - struct alias_pav_group *group =3D private->pavgroup; struct alias_lcu *lcu =3D private->lcu; struct dasd_device *alias_device; + struct alias_pav_group *group; unsigned long flags; =20 - if (!group || !lcu) + if (!lcu) return NULL; if (lcu->pav =3D=3D NO_PAV || lcu->flags & (NEED_UAC_UPDATE | UPDATE_PENDING)) @@ -697,6 +697,11 @@ struct dasd_device *dasd_alias_get_start } =20 spin_lock_irqsave(&lcu->lock, flags); + group =3D private->pavgroup; + if (!group) { + spin_unlock_irqrestore(&lcu->lock, flags); + return NULL; + } alias_device =3D group->next; if (!alias_device) { if (list_empty(&group->aliaslist)) { From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 937CAC07E9D for ; Mon, 26 Sep 2022 11:58:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239100AbiIZL56 (ORCPT ); Mon, 26 Sep 2022 07:57:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239230AbiIZLyz (ORCPT ); Mon, 26 Sep 2022 07:54:55 -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 3AB91580B9; Mon, 26 Sep 2022 03:50:30 -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 46E9360A4D; Mon, 26 Sep 2022 10:50:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58F1CC433C1; Mon, 26 Sep 2022 10:50:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189427; bh=n/jQe5Kdc5RRzX8YMydVC81lOY8DOiPwkvEUwB32+O4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kfob+XuBY3WNO0epn8TcFkas86m3awDJYrdemIcVHgrEo0KbB6xKXkmcLnQlx+Qbl EN9dlK5BYTeKeeCCBE5CFJZlKCeDYTKUuJssml4LdHRbydvAOzupVhj/wVBKNrtlJj UPm8l1PSLUrHz7571YwBCfzWnyZRttDRpdeL+fMg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Jani Nikula , =?UTF-8?q?Jouni=20H=C3=B6gander?= , Mika Kahola , =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Subject: [PATCH 5.19 167/207] drm/i915/display: Fix handling of enable_psr parameter Date: Mon, 26 Sep 2022 12:12:36 +0200 Message-Id: <20220926100814.131449678@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jos=C3=A9 Roberto de Souza commit 5c57c099f442acab13129c9e15ad2a0c31151c98 upstream. Commit 3cf050762534 ("drm/i915/bios: Split VBT data into per-panel vs. global parts") cause PSR to be disabled when enable_psr has the default value and there is at least one DP port that do not supports PSR. That was happening because intel_psr_init() is called for every DP port and then enable_psr is globaly set to 0 based on the PSR support of the DP port. Here dropping the enable_psr overwritten and using the VBT PSR value when enable_psr is set as default. Fixes: 3cf050762534 ("drm/i915/bios: Split VBT data into per-panel vs. glob= al parts") Cc: Ville Syrj=C3=A4l=C3=A4 Cc: Jani Nikula Cc: Jouni H=C3=B6gander Cc: Mika Kahola Signed-off-by: Jos=C3=A9 Roberto de Souza Reviewed-by: Jouni H=C3=B6gander Link: https://patchwork.freedesktop.org/patch/msgid/20220608203344.513082-1= -jose.souza@intel.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/i915/display/intel_psr.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/drivers/gpu/drm/i915/display/intel_psr.c +++ b/drivers/gpu/drm/i915/display/intel_psr.c @@ -86,10 +86,13 @@ =20 static bool psr_global_enabled(struct intel_dp *intel_dp) { + struct intel_connector *connector =3D intel_dp->attached_connector; struct drm_i915_private *i915 =3D dp_to_i915(intel_dp); =20 switch (intel_dp->psr.debug & I915_PSR_DEBUG_MODE_MASK) { case I915_PSR_DEBUG_DEFAULT: + if (i915->params.enable_psr =3D=3D -1) + return connector->panel.vbt.psr.enable; return i915->params.enable_psr; case I915_PSR_DEBUG_DISABLE: return false; @@ -2371,10 +2374,6 @@ void intel_psr_init(struct intel_dp *int =20 intel_dp->psr.source_support =3D true; =20 - if (dev_priv->params.enable_psr =3D=3D -1) - if (!connector->panel.vbt.psr.enable) - dev_priv->params.enable_psr =3D 0; - /* Set link_standby x link_off defaults */ if (DISPLAY_VER(dev_priv) < 12) /* For new platforms up to TGL let's respect VBT back again */ From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DB68C07E9D for ; Mon, 26 Sep 2022 12:00:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239173AbiIZMAv (ORCPT ); Mon, 26 Sep 2022 08:00:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238972AbiIZL5F (ORCPT ); Mon, 26 Sep 2022 07:57:05 -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 4FA9B7A74B; Mon, 26 Sep 2022 03:51:40 -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 079C1B80782; Mon, 26 Sep 2022 10:51:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E64FC433C1; Mon, 26 Sep 2022 10:50:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189459; bh=NR2nGKHCqMCbiIzfzdxCOwBE57OSql4xqN0iC9Rp7Uo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qD9beS6T7VcqO26fPylTqA+psdAV6w0gKAzYpbxdamuYdr6NwedXUXSpQvlwRBPPz DXDnVbhlLmg7l7zmcMPLI4zZsqXvZVnlQobz+Q6CtNbejRWMCqNhy9eTea930B8RCt /uQ8uYejDPd9MWUs53gnT63Lc7N3AJsX8K00QeOU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Ming Lei , Jens Axboe Subject: [PATCH 5.19 168/207] blk-mq: fix error handling in __blk_mq_alloc_disk Date: Mon, 26 Sep 2022 12:12:37 +0200 Message-Id: <20220926100814.177713877@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christoph Hellwig commit 0a3e5cc7bbfcd571a2e53779ef7d7aa3c57d5432 upstream. To fully clean up the queue if the disk allocation fails we need to call blk_mq_destroy_queue and not just blk_put_queue. Fixes: 6f8191fdf41d ("block: simplify disk shutdown") Signed-off-by: Christoph Hellwig Reviewed-by: Ming Lei Link: https://lore.kernel.org/r/20220720130541.1323531-1-hch@lst.de Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- block/blk-mq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -3949,7 +3949,7 @@ struct gendisk *__blk_mq_alloc_disk(stru =20 disk =3D __alloc_disk_node(q, set->numa_node, lkclass); if (!disk) { - blk_put_queue(q); + blk_mq_destroy_queue(q); return ERR_PTR(-ENOMEM); } set_bit(GD_OWNS_QUEUE, &disk->state); From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CECA4C07E9D for ; Mon, 26 Sep 2022 12:00:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239142AbiIZMA3 (ORCPT ); Mon, 26 Sep 2022 08:00:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238947AbiIZL46 (ORCPT ); Mon, 26 Sep 2022 07:56:58 -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 4A7D17A767; Mon, 26 Sep 2022 03:51:44 -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 C1AFFB80926; Mon, 26 Sep 2022 10:51:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21DF7C433C1; Mon, 26 Sep 2022 10:51:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189471; bh=y7Mlu+4vaXSTwuWXF2lDCSOlXNwTXgB3fXmnlL3jX8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lNbCOFQ67SoPir/eh7Se0i6IzODxVCr2FdsrJOFQsifIgveCY7NafyQgbfv4nPlri 4Phetmpos4PvpRRJMM/zxrZxVyGEOmXZPwIPi/oHN0JCa5VHaN/aTJZJPNm4LWd1jg IlfpIKGy18mBTEUCFasilww/WFbMI0p/USaUzVZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Ming Lei , Jens Axboe Subject: [PATCH 5.19 169/207] block: call blk_mq_exit_queue from disk_release for never added disks Date: Mon, 26 Sep 2022 12:12:38 +0200 Message-Id: <20220926100814.224159894@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christoph Hellwig commit c5db2cfc6274692d821d33b59acb6ff615e350c1 upstream. To undo the all initialization from blk_mq_init_allocated_queue in case of a probe failure where add_disk is never called we have to call blk_mq_exit_queue from put_disk. This relies on the fact that drivers always call blk_mq_free_tag_set after calling put_disk in the probe error path if they have a gendisk at all. We should be doing this in general, but can't do it for the normal teardown case (yet) as the tagset can be gone by the time the disk is released once it was added. I hope to sort this out properly eventually but for now this isolated hack will do it. Fixes: 6f8191fdf41d ("block: simplify disk shutdown") Signed-off-by: Christoph Hellwig Reviewed-by: Ming Lei Link: https://lore.kernel.org/r/20220720130541.1323531-2-hch@lst.de Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- block/genhd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) --- a/block/genhd.c +++ b/block/genhd.c @@ -1158,6 +1158,18 @@ static void disk_release(struct device * might_sleep(); WARN_ON_ONCE(disk_live(disk)); =20 + /* + * To undo the all initialization from blk_mq_init_allocated_queue in + * case of a probe failure where add_disk is never called we have to + * call blk_mq_exit_queue here. We can't do this for the more common + * teardown case (yet) as the tagset can be gone by the time the disk + * is released once it was added. + */ + if (queue_is_mq(disk->queue) && + test_bit(GD_OWNS_QUEUE, &disk->state) && + !test_bit(GD_ADDED, &disk->state)) + blk_mq_exit_queue(disk->queue); + blkcg_exit_queue(disk->queue); =20 disk_release_events(disk); @@ -1422,6 +1434,9 @@ EXPORT_SYMBOL(__blk_alloc_disk); * This decrements the refcount for the struct gendisk. When this reaches 0 * we'll have disk_release() called. * + * Note: for blk-mq disk put_disk must be called before freeing the tag_set + * when handling probe errors (that is before add_disk() is called). + * * Context: Any context, but the last reference must not be dropped from * atomic context. */ From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 914BEC07E9D for ; Mon, 26 Sep 2022 13:19:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235162AbiIZNTV (ORCPT ); Mon, 26 Sep 2022 09:19:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235894AbiIZNSz (ORCPT ); Mon, 26 Sep 2022 09:18:55 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E8D3DB; Mon, 26 Sep 2022 04:45:33 -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 sin.source.kernel.org (Postfix) with ESMTPS id 3B8A2CE111C; Mon, 26 Sep 2022 10:51:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1923AC433C1; Mon, 26 Sep 2022 10:51:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189474; bh=LgrIYa0at/wSsDhTrNC+RUwDkoQVOs7ROK/IsjTDK8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=intx3gVkN2TpnFO2WOtfqLjpfVpwQJyUDh0AhTFP+Y/F9idjS7X9FO3V9YdoFKdR9 xBATgYzsdZIaE0nGSvAVK3Q80MBYeeaevTGLrqtfvhabxoZ2vFOBQX2Ol/7WxFF8Dz 8gYhB/dL8ICfZOqDEshXvOI38v/CFORKr7v1kny0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+31c9594f6e43b9289b25@syzkaller.appspotmail.com, Hillf Danton , Rafael Mendonca , Christoph Hellwig , Jens Axboe Subject: [PATCH 5.19 170/207] block: Do not call blk_put_queue() if gendisk allocation fails Date: Mon, 26 Sep 2022 12:12:39 +0200 Message-Id: <20220926100814.266479156@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rafael Mendonca commit aa0c680c3aa96a5f9f160d90dd95402ad578e2b0 upstream. Commit 6f8191fdf41d ("block: simplify disk shutdown") removed the call to blk_get_queue() during gendisk allocation but missed to remove the corresponding cleanup code blk_put_queue() for it. Thus, if the gendisk allocation fails, the request_queue refcount gets decremented and reaches 0, causing blk_mq_release() to be called with a hctx still alive. That triggers a WARNING report, as found by syzkaller: Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz ------------[ cut here ]------------ WARNING: CPU: 0 PID: 23016 at block/blk-mq.c:3881 blk_mq_release+0xf8/0x3e0 block/blk-mq.c:3881 [...] stripped RIP: 0010:blk_mq_release+0xf8/0x3e0 block/blk-mq.c:3881 [...] stripped Call Trace: blk_release_queue+0x153/0x270 block/blk-sysfs.c:780 kobject_cleanup lib/kobject.c:673 [inline] kobject_release lib/kobject.c:704 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1c8/0x540 lib/kobject.c:721 __alloc_disk_node+0x4f7/0x610 block/genhd.c:1388 __blk_mq_alloc_disk+0x13b/0x1f0 block/blk-mq.c:3961 loop_add+0x3e2/0xaf0 drivers/block/loop.c:1978 loop_control_ioctl+0x133/0x620 drivers/block/loop.c:2150 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd [...] stripped Fixes: 6f8191fdf41d ("block: simplify disk shutdown") Reported-by: syzbot+31c9594f6e43b9289b25@syzkaller.appspotmail.com Suggested-by: Hillf Danton Signed-off-by: Rafael Mendonca Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20220811232338.254673-1-rafaelmendsr@gmail.= com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/genhd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/block/genhd.c +++ b/block/genhd.c @@ -1359,7 +1359,7 @@ struct gendisk *__alloc_disk_node(struct =20 disk =3D kzalloc_node(sizeof(struct gendisk), GFP_KERNEL, node_id); if (!disk) - goto out_put_queue; + return NULL; =20 disk->bdi =3D bdi_alloc(node_id); if (!disk->bdi) @@ -1403,8 +1403,6 @@ out_free_bdi: bdi_put(disk->bdi); out_free_disk: kfree(disk); -out_put_queue: - blk_put_queue(q); return NULL; } From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDC8DC6FA83 for ; Mon, 26 Sep 2022 12:23:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236879AbiIZMX4 (ORCPT ); Mon, 26 Sep 2022 08:23:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237146AbiIZMXV (ORCPT ); Mon, 26 Sep 2022 08:23:21 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EE055A3DD; Mon, 26 Sep 2022 04:05:15 -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 sin.source.kernel.org (Postfix) with ESMTPS id E598BCE1122; Mon, 26 Sep 2022 10:51:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5C61C433C1; Mon, 26 Sep 2022 10:51:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189477; bh=F0QpExpqRDTwj0Px6tY3UgvVq9CTES248BvTZVN/jfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QteQ670lN0iUnUFm7QgQa8JgxM3qVBLh9xQCPn4bjc6cQAfXlIvyvSP7i0AxV5QjX XJAPvtim76HHQ3LATpShdLtFPlKMYFGEW9kCdC8vPOXJxSyLB0rFXfbjLzxTN9cbZp 10p/4OeFkNTEusqi62fQXm71u+Hm4o0tIxbJC5kQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Kelley , Vitaly Kuznetsov , Wei Liu , Sasha Levin Subject: [PATCH 5.19 171/207] Drivers: hv: Never allocate anything besides framebuffer from framebuffer memory region Date: Mon, 26 Sep 2022 12:12:40 +0200 Message-Id: <20220926100814.314587683@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vitaly Kuznetsov [ Upstream commit f0880e2cb7e1f8039a048fdd01ce45ab77247221 ] Passed through PCI device sometimes misbehave on Gen1 VMs when Hyper-V DRM driver is also loaded. Looking at IOMEM assignment, we can see e.g. $ cat /proc/iomem ... f8000000-fffbffff : PCI Bus 0000:00 f8000000-fbffffff : 0000:00:08.0 f8000000-f8001fff : bb8c4f33-2ba2-4808-9f7f-02f3b4da22fe ... fe0000000-fffffffff : PCI Bus 0000:00 fe0000000-fe07fffff : bb8c4f33-2ba2-4808-9f7f-02f3b4da22fe fe0000000-fe07fffff : 2ba2:00:02.0 fe0000000-fe07fffff : mlx4_core the interesting part is the 'f8000000' region as it is actually the VM's framebuffer: $ lspci -v ... 0000:00:08.0 VGA compatible controller: Microsoft Corporation Hyper-V virtu= al VGA (prog-if 00 [VGA controller]) Flags: bus master, fast devsel, latency 0, IRQ 11 Memory at f8000000 (32-bit, non-prefetchable) [size=3D64M] ... hv_vmbus: registering driver hyperv_drm hyperv_drm 5620e0c7-8062-4dce-aeb7-520c7ef76171: [drm] Synthvid Version ma= jor 3, minor 5 hyperv_drm 0000:00:08.0: vgaarb: deactivate vga console hyperv_drm 0000:00:08.0: BAR 0: can't reserve [mem 0xf8000000-0xfbffffff] hyperv_drm 5620e0c7-8062-4dce-aeb7-520c7ef76171: [drm] Cannot request fram= ebuffer, boot fb still active? Note: "Cannot request framebuffer" is not a fatal error in hyperv_setup_gen1() as the code assumes there's some other framebuffer device there but we actually have some other PCI device (mlx4 in this case) config space there! The problem appears to be that vmbus_allocate_mmio() can use dedicated framebuffer region to serve any MMIO request from any device. The semantics one might assume of a parameter named "fb_overlap_ok" aren't implemented because !fb_overlap_ok essentially has no effect. The existing semantics are really "prefer_fb_overlap". This patch implements the expected and needed semantics, which is to not allocate from the frame buffer space when !fb_overlap_ok. Note, Gen2 VMs are usually unaffected by the issue because framebuffer region is already taken by EFI fb (in case kernel supports it) but Gen1 VMs may have this region unclaimed by the time Hyper-V PCI pass-through driver tries allocating MMIO space if Hyper-V DRM/FB drivers load after it. Devices can be brought up in any sequence so let's resolve the issue by always ignoring 'fb_mmio' region for non-FB requests, even if the region is unclaimed. Reviewed-by: Michael Kelley Signed-off-by: Vitaly Kuznetsov Link: https://lore.kernel.org/r/20220827130345.1320254-4-vkuznets@redhat.com Signed-off-by: Wei Liu Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/hv/vmbus_drv.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 547ae334e5cd..027029efb008 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -2309,7 +2309,7 @@ int vmbus_allocate_mmio(struct resource **new, struct= hv_device *device_obj, bool fb_overlap_ok) { struct resource *iter, *shadow; - resource_size_t range_min, range_max, start; + resource_size_t range_min, range_max, start, end; const char *dev_n =3D dev_name(&device_obj->device); int retval; =20 @@ -2344,6 +2344,14 @@ int vmbus_allocate_mmio(struct resource **new, struc= t hv_device *device_obj, range_max =3D iter->end; start =3D (range_min + align - 1) & ~(align - 1); for (; start + size - 1 <=3D range_max; start +=3D align) { + end =3D start + size - 1; + + /* Skip the whole fb_mmio region if not fb_overlap_ok */ + if (!fb_overlap_ok && fb_mmio && + (((start >=3D fb_mmio->start) && (start <=3D fb_mmio->end)) || + ((end >=3D fb_mmio->start) && (end <=3D fb_mmio->end)))) + continue; + shadow =3D __request_region(iter, start, size, NULL, IORESOURCE_BUSY); if (!shadow) --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE354C32771 for ; Mon, 26 Sep 2022 12:02:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239166AbiIZMCK (ORCPT ); Mon, 26 Sep 2022 08:02:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239320AbiIZL6m (ORCPT ); Mon, 26 Sep 2022 07:58:42 -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 F2B617B78E; Mon, 26 Sep 2022 03:52: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 dfw.source.kernel.org (Postfix) with ESMTPS id 9A921609FE; Mon, 26 Sep 2022 10:51:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF980C433C1; Mon, 26 Sep 2022 10:51:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189480; bh=Q2ax4nHmUIsuSF4ftZGVkIdUdYbh9VYCFtJUZ59qKPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B320SmzzShhxg0Q0uuOMg5jRTo9vTQU8Mz0G3JyHhGMKhD2RK9asptIzi2Feepama 4Vy9gdKHSwPmIU1ZddtEUxqRuTgn7+i8Bd/DVhnW/2S7ubG6K2fezyJghiEiSEVJsW 4p6TNMSO2fO+53TdRYeHRG8oFcZj+5OzeA0mig8Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Patrik Jakobsson , Sasha Levin Subject: [PATCH 5.19 172/207] drm/gma500: Fix BUG: sleeping function called from invalid context errors Date: Mon, 26 Sep 2022 12:12:41 +0200 Message-Id: <20220926100814.362842799@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit 63e37a79f7bd939314997e29c2f5a9f0ef184281 ] gma_crtc_page_flip() was holding the event_lock spinlock while calling crtc_funcs->mode_set_base() which takes ww_mutex. The only reason to hold event_lock is to clear gma_crtc->page_flip_event on mode_set_base() errors. Instead unlock it after setting gma_crtc->page_flip_event and on errors re-take the lock and clear gma_crtc->page_flip_event it it is still set. This fixes the following WARN/stacktrace: [ 512.122953] BUG: sleeping function called from invalid context at kernel= /locking/mutex.c:870 [ 512.123004] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 1253,= name: gnome-shell [ 512.123031] preempt_count: 1, expected: 0 [ 512.123048] RCU nest depth: 0, expected: 0 [ 512.123066] INFO: lockdep is turned off. [ 512.123080] irq event stamp: 0 [ 512.123094] hardirqs last enabled at (0): [<0000000000000000>] 0x0 [ 512.123134] hardirqs last disabled at (0): [] copy_pro= cess+0x9fc/0x1de0 [ 512.123176] softirqs last enabled at (0): [] copy_pro= cess+0x9fc/0x1de0 [ 512.123207] softirqs last disabled at (0): [<0000000000000000>] 0x0 [ 512.123233] Preemption disabled at: [ 512.123241] [<0000000000000000>] 0x0 [ 512.123275] CPU: 3 PID: 1253 Comm: gnome-shell Tainted: G W = 5.19.0+ #1 [ 512.123304] Hardware name: Packard Bell dot s/SJE01_CT, BIOS V1.10 07/23= /2013 [ 512.123323] Call Trace: [ 512.123346] [ 512.123370] dump_stack_lvl+0x5b/0x77 [ 512.123412] __might_resched.cold+0xff/0x13a [ 512.123458] ww_mutex_lock+0x1e/0xa0 [ 512.123495] psb_gem_pin+0x2c/0x150 [gma500_gfx] [ 512.123601] gma_pipe_set_base+0x76/0x240 [gma500_gfx] [ 512.123708] gma_crtc_page_flip+0x95/0x130 [gma500_gfx] [ 512.123808] drm_mode_page_flip_ioctl+0x57d/0x5d0 [ 512.123897] ? drm_mode_cursor2_ioctl+0x10/0x10 [ 512.123936] drm_ioctl_kernel+0xa1/0x150 [ 512.123984] drm_ioctl+0x21f/0x420 [ 512.124025] ? drm_mode_cursor2_ioctl+0x10/0x10 [ 512.124070] ? rcu_read_lock_bh_held+0xb/0x60 [ 512.124104] ? lock_release+0x1ef/0x2d0 [ 512.124161] __x64_sys_ioctl+0x8d/0xd0 [ 512.124203] do_syscall_64+0x58/0x80 [ 512.124239] ? do_syscall_64+0x67/0x80 [ 512.124267] ? trace_hardirqs_on_prepare+0x55/0xe0 [ 512.124300] ? do_syscall_64+0x67/0x80 [ 512.124340] ? rcu_read_lock_sched_held+0x10/0x80 [ 512.124377] entry_SYSCALL_64_after_hwframe+0x63/0xcd [ 512.124411] RIP: 0033:0x7fcc4a70740f [ 512.124442] Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 = 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <89= > c2 3d 00 f0 ff ff 77 18 48 8b 44 24 18 64 48 2b 04 25 28 00 00 [ 512.124470] RSP: 002b:00007ffda73f5390 EFLAGS: 00000246 ORIG_RAX: 000000= 0000000010 [ 512.124503] RAX: ffffffffffffffda RBX: 000055cc9e474500 RCX: 00007fcc4a7= 0740f [ 512.124524] RDX: 00007ffda73f5420 RSI: 00000000c01864b0 RDI: 00000000000= 00009 [ 512.124544] RBP: 00007ffda73f5420 R08: 000055cc9c0b0cb0 R09: 00000000000= 00034 [ 512.124564] R10: 0000000000000000 R11: 0000000000000246 R12: 00000000c01= 864b0 [ 512.124584] R13: 0000000000000009 R14: 000055cc9df484d0 R15: 000055cc9af= 5d0c0 [ 512.124647] Signed-off-by: Hans de Goede Signed-off-by: Patrik Jakobsson Link: https://patchwork.freedesktop.org/patch/msgid/20220906203852.527663-2= -hdegoede@redhat.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/gma500/gma_display.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/gma500/gma_display.c b/drivers/gpu/drm/gma500/= gma_display.c index 34ec3fca09ba..12287c9bb4d8 100644 --- a/drivers/gpu/drm/gma500/gma_display.c +++ b/drivers/gpu/drm/gma500/gma_display.c @@ -531,15 +531,18 @@ int gma_crtc_page_flip(struct drm_crtc *crtc, WARN_ON(drm_crtc_vblank_get(crtc) !=3D 0); =20 gma_crtc->page_flip_event =3D event; + spin_unlock_irqrestore(&dev->event_lock, flags); =20 /* Call this locked if we want an event at vblank interrupt. */ ret =3D crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y, old_fb); if (ret) { - gma_crtc->page_flip_event =3D NULL; - drm_crtc_vblank_put(crtc); + spin_lock_irqsave(&dev->event_lock, flags); + if (gma_crtc->page_flip_event) { + gma_crtc->page_flip_event =3D NULL; + drm_crtc_vblank_put(crtc); + } + spin_unlock_irqrestore(&dev->event_lock, flags); } - - spin_unlock_irqrestore(&dev->event_lock, flags); } else { ret =3D crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y, old_fb); } --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EF90C07E9D for ; Mon, 26 Sep 2022 12:01:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239219AbiIZMBH (ORCPT ); Mon, 26 Sep 2022 08:01:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239015AbiIZL5V (ORCPT ); Mon, 26 Sep 2022 07:57:21 -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 90D327A522; Mon, 26 Sep 2022 03:51:46 -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 36D2DB80930; Mon, 26 Sep 2022 10:51:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2838C433C1; Mon, 26 Sep 2022 10:51:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189483; bh=GBcGwIueOLO58Yp/xzMrac4ghKpdtAPg/t5F7+WWSzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ph2ehd3wVcFRhi3E1qTFe026WObPnl7oEFdvNV0B26D03pM55uhoN8cqmUve0swrg dDNHY23uJdmgPZDTv0upHXxOzQn/8qZ0xtT30zyuf9ov9yvT2nusxerI8rmz06AWwM 6Wu8zEv1iFYXUlSBs/7MomfQIwrgT9pr3d5NYOqE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Patrik Jakobsson , Sasha Levin Subject: [PATCH 5.19 173/207] drm/gma500: Fix WARN_ON(lock->magic != lock) error Date: Mon, 26 Sep 2022 12:12:42 +0200 Message-Id: <20220926100814.410572629@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit b6f25c3b94f2aadbf5cbef954db4073614943d74 ] psb_gem_unpin() calls dma_resv_lock() but the underlying ww_mutex gets destroyed by drm_gem_object_release() move the drm_gem_object_release() call in psb_gem_free_object() to after the unpin to fix the below warning: [ 79.693962] ------------[ cut here ]------------ [ 79.693992] DEBUG_LOCKS_WARN_ON(lock->magic !=3D lock) [ 79.694015] WARNING: CPU: 0 PID: 240 at kernel/locking/mutex.c:582 __ww_= mutex_lock.constprop.0+0x569/0xfb0 [ 79.694052] Modules linked in: rfcomm snd_seq_dummy snd_hrtimer qrtr bne= p ath9k ath9k_common ath9k_hw snd_hda_codec_realtek snd_hda_codec_generic l= edtrig_audio snd_hda_codec_hdmi snd_hda_intel ath3k snd_intel_dspcfg mac802= 11 snd_intel_sdw_acpi btusb snd_hda_codec btrtl btbcm btintel btmtk bluetoo= th at24 snd_hda_core snd_hwdep uvcvideo snd_seq libarc4 videobuf2_vmalloc a= th videobuf2_memops videobuf2_v4l2 videobuf2_common snd_seq_device videodev= acer_wmi intel_powerclamp coretemp mc snd_pcm joydev sparse_keymap ecdh_ge= neric pcspkr wmi_bmof cfg80211 i2c_i801 i2c_smbus snd_timer snd r8169 rfkil= l lpc_ich soundcore acpi_cpufreq zram rtsx_pci_sdmmc mmc_core serio_raw rts= x_pci gma500_gfx(E) video wmi ip6_tables ip_tables i2c_dev fuse [ 79.694436] CPU: 0 PID: 240 Comm: plymouthd Tainted: G W E = 6.0.0-rc3+ #490 [ 79.694457] Hardware name: Packard Bell dot s/SJE01_CT, BIOS V1.10 07/23= /2013 [ 79.694469] RIP: 0010:__ww_mutex_lock.constprop.0+0x569/0xfb0 [ 79.694496] Code: ff 85 c0 0f 84 15 fb ff ff 8b 05 ca 3c 11 01 85 c0 0f = 85 07 fb ff ff 48 c7 c6 30 cb 84 aa 48 c7 c7 a3 e1 82 aa e8 ac 29 f8 ff <0f= > 0b e9 ed fa ff ff e8 5b 83 8a ff 85 c0 74 10 44 8b 0d 98 3c 11 [ 79.694513] RSP: 0018:ffffad1dc048bbe0 EFLAGS: 00010282 [ 79.694623] RAX: 0000000000000028 RBX: 0000000000000000 RCX: 00000000000= 00000 [ 79.694636] RDX: 0000000000000001 RSI: ffffffffaa8b0ffc RDI: 00000000fff= fffff [ 79.694650] RBP: ffffad1dc048bc80 R08: 0000000000000000 R09: ffffad1dc04= 8ba90 [ 79.694662] R10: 0000000000000003 R11: ffffffffaad62fe8 R12: ffff9ff3021= 03138 [ 79.694675] R13: ffff9ff306ec8000 R14: ffff9ff307779078 R15: ffff9ff3014= c0270 [ 79.694690] FS: 00007ff1cccf1740(0000) GS:ffff9ff3bc200000(0000) knlGS:= 0000000000000000 [ 79.694705] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 79.694719] CR2: 0000559ecbcb4420 CR3: 0000000013210000 CR4: 00000000000= 006f0 [ 79.694734] Call Trace: [ 79.694749] [ 79.694761] ? __schedule+0x47f/0x1670 [ 79.694796] ? psb_gem_unpin+0x27/0x1a0 [gma500_gfx] [ 79.694830] ? lock_is_held_type+0xe3/0x140 [ 79.694864] ? ww_mutex_lock+0x38/0xa0 [ 79.694885] ? __cond_resched+0x1c/0x30 [ 79.694902] ww_mutex_lock+0x38/0xa0 [ 79.694925] psb_gem_unpin+0x27/0x1a0 [gma500_gfx] [ 79.694964] psb_gem_unpin+0x199/0x1a0 [gma500_gfx] [ 79.694996] drm_gem_object_release_handle+0x50/0x60 [ 79.695020] ? drm_gem_object_handle_put_unlocked+0xf0/0xf0 [ 79.695042] idr_for_each+0x4b/0xb0 [ 79.695066] ? _raw_spin_unlock_irqrestore+0x30/0x60 [ 79.695095] drm_gem_release+0x1c/0x30 [ 79.695118] drm_file_free.part.0+0x1ea/0x260 [ 79.695150] drm_release+0x6a/0x120 [ 79.695175] __fput+0x9f/0x260 [ 79.695203] task_work_run+0x59/0xa0 [ 79.695227] do_exit+0x387/0xbe0 [ 79.695250] ? seqcount_lockdep_reader_access.constprop.0+0x82/0x90 [ 79.695275] ? lockdep_hardirqs_on+0x7d/0x100 [ 79.695304] do_group_exit+0x33/0xb0 [ 79.695331] __x64_sys_exit_group+0x14/0x20 [ 79.695353] do_syscall_64+0x58/0x80 [ 79.695376] ? up_read+0x17/0x20 [ 79.695401] ? lock_is_held_type+0xe3/0x140 [ 79.695429] ? asm_exc_page_fault+0x22/0x30 [ 79.695450] ? lockdep_hardirqs_on+0x7d/0x100 [ 79.695473] entry_SYSCALL_64_after_hwframe+0x63/0xcd [ 79.695493] RIP: 0033:0x7ff1ccefe3f1 [ 79.695516] Code: Unable to access opcode bytes at RIP 0x7ff1ccefe3c7. [ 79.695607] RSP: 002b:00007ffed4413378 EFLAGS: 00000246 ORIG_RAX: 000000= 00000000e7 [ 79.695629] RAX: ffffffffffffffda RBX: 00007ff1cd0159e0 RCX: 00007ff1cce= fe3f1 [ 79.695644] RDX: 000000000000003c RSI: 00000000000000e7 RDI: 00000000000= 00000 [ 79.695656] RBP: 0000000000000000 R08: ffffffffffffff80 R09: 00007ff1cd0= 20b20 [ 79.695671] R10: 0000000000000000 R11: 0000000000000246 R12: 00007ff1cd0= 159e0 [ 79.695684] R13: 0000000000000000 R14: 00007ff1cd01aee8 R15: 00007ff1cd0= 1af00 [ 79.695733] [ 79.695746] irq event stamp: 725979 [ 79.695757] hardirqs last enabled at (725979): [] fin= ish_task_switch.isra.0+0xe4/0x3f0 [ 79.695780] hardirqs last disabled at (725978): [] __s= chedule+0xdd3/0x1670 [ 79.695803] softirqs last enabled at (725974): [] __i= rq_exit_rcu+0xed/0x160 [ 79.695825] softirqs last disabled at (725969): [] __i= rq_exit_rcu+0xed/0x160 [ 79.695845] ---[ end trace 0000000000000000 ]--- Signed-off-by: Hans de Goede Signed-off-by: Patrik Jakobsson Link: https://patchwork.freedesktop.org/patch/msgid/20220906203852.527663-3= -hdegoede@redhat.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/gma500/gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/gma500/gem.c b/drivers/gpu/drm/gma500/gem.c index dffe37490206..4b7627a72637 100644 --- a/drivers/gpu/drm/gma500/gem.c +++ b/drivers/gpu/drm/gma500/gem.c @@ -112,12 +112,12 @@ static void psb_gem_free_object(struct drm_gem_object= *obj) { struct psb_gem_object *pobj =3D to_psb_gem_object(obj); =20 - drm_gem_object_release(obj); - /* Undo the mmap pin if we are destroying the object */ if (pobj->mmapping) psb_gem_unpin(pobj); =20 + drm_gem_object_release(obj); + WARN_ON(pobj->in_gart && !pobj->stolen); =20 release_resource(&pobj->resource); --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC016C07E9D for ; Mon, 26 Sep 2022 12:02:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236806AbiIZMCe (ORCPT ); Mon, 26 Sep 2022 08:02:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239427AbiIZL6y (ORCPT ); Mon, 26 Sep 2022 07:58:54 -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 7CEF07C1BC; Mon, 26 Sep 2022 03:52:35 -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 7D7C960AF5; Mon, 26 Sep 2022 10:51:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D03CC433D6; Mon, 26 Sep 2022 10:51:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189485; bh=Jh04ZgCVJUOdoccO5CyvPwcmwvALBeyaIwi9Zen4+4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qggw+Yx0n6slXaV1AJs34t4Za0Uf7fhlnfdjKJ8ju7Wr/NdIRIPSIlN6v5gLeqrNe S8cY+12e70c+W80BJVsX7N8/m3VwyLYoNPQGeI9yqStA69SI4yq6FncUzY/g+QthcQ lHJphKWlY1z6zyQBIrmO1XI98p+e/0Av3lDA5ElI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Patrik Jakobsson , Sasha Levin Subject: [PATCH 5.19 174/207] drm/gma500: Fix (vblank) IRQs not working after suspend/resume Date: Mon, 26 Sep 2022 12:12:43 +0200 Message-Id: <20220926100814.441600933@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit 235fdbc32d559db21e580f85035c59372704f09e ] Fix gnome-shell (and other page-flip users) hanging after suspend/resume because of the gma500's IRQs not working. This fixes 2 problems with the IRQ handling: 1. gma_power_off() calls gma_irq_uninstall() which does a free_irq(), but gma_power_on() called gma_irq_preinstall() + gma_irq_postinstall() which do not call request_irq. Replace the pre- + post-install calls with gma_irq_install() which does prep + request + post. 2. After fixing 1. IRQs still do not work on a Packard Bell Dot SC (Intel Atom N2600, cedarview) netbook. Cederview uses MSI interrupts and it seems that the BIOS re-configures things back to normal APIC based interrupts during S3 suspend. There is some MSI PCI-config registers save/restore code which tries to deal with this, but on the Packard Bell Dot SC this is not sufficient to restore MSI IRQ functionality after a suspend/resume. Replace the PCI-config registers save/restore with pci_disable_msi() on suspend + pci_enable_msi() on resume. Fixing e.g. gnome-shell hanging. Signed-off-by: Hans de Goede Signed-off-by: Patrik Jakobsson Link: https://patchwork.freedesktop.org/patch/msgid/20220906203852.527663-4= -hdegoede@redhat.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/gma500/cdv_device.c | 4 +--- drivers/gpu/drm/gma500/oaktrail_device.c | 5 +---- drivers/gpu/drm/gma500/power.c | 8 +------- drivers/gpu/drm/gma500/psb_drv.c | 2 +- drivers/gpu/drm/gma500/psb_drv.h | 5 +---- drivers/gpu/drm/gma500/psb_irq.c | 15 ++++++++++++--- drivers/gpu/drm/gma500/psb_irq.h | 2 +- 7 files changed, 18 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/gma500/cdv_device.c b/drivers/gpu/drm/gma500/c= dv_device.c index dd32b484dd82..ce96234f3df2 100644 --- a/drivers/gpu/drm/gma500/cdv_device.c +++ b/drivers/gpu/drm/gma500/cdv_device.c @@ -581,11 +581,9 @@ static const struct psb_offset cdv_regmap[2] =3D { static int cdv_chip_setup(struct drm_device *dev) { struct drm_psb_private *dev_priv =3D to_drm_psb_private(dev); - struct pci_dev *pdev =3D to_pci_dev(dev->dev); INIT_WORK(&dev_priv->hotplug_work, cdv_hotplug_work_func); =20 - if (pci_enable_msi(pdev)) - dev_warn(dev->dev, "Enabling MSI failed!\n"); + dev_priv->use_msi =3D true; dev_priv->regmap =3D cdv_regmap; gma_get_core_freq(dev); psb_intel_opregion_init(dev); diff --git a/drivers/gpu/drm/gma500/oaktrail_device.c b/drivers/gpu/drm/gma= 500/oaktrail_device.c index 5923a9c89312..f90e628cb482 100644 --- a/drivers/gpu/drm/gma500/oaktrail_device.c +++ b/drivers/gpu/drm/gma500/oaktrail_device.c @@ -501,12 +501,9 @@ static const struct psb_offset oaktrail_regmap[2] =3D { static int oaktrail_chip_setup(struct drm_device *dev) { struct drm_psb_private *dev_priv =3D to_drm_psb_private(dev); - struct pci_dev *pdev =3D to_pci_dev(dev->dev); int ret; =20 - if (pci_enable_msi(pdev)) - dev_warn(dev->dev, "Enabling MSI failed!\n"); - + dev_priv->use_msi =3D true; dev_priv->regmap =3D oaktrail_regmap; =20 ret =3D mid_chip_setup(dev); diff --git a/drivers/gpu/drm/gma500/power.c b/drivers/gpu/drm/gma500/power.c index b91de6d36e41..66873085d450 100644 --- a/drivers/gpu/drm/gma500/power.c +++ b/drivers/gpu/drm/gma500/power.c @@ -139,8 +139,6 @@ static void gma_suspend_pci(struct pci_dev *pdev) dev_priv->regs.saveBSM =3D bsm; pci_read_config_dword(pdev, 0xFC, &vbt); dev_priv->regs.saveVBT =3D vbt; - pci_read_config_dword(pdev, PSB_PCIx_MSI_ADDR_LOC, &dev_priv->msi_addr); - pci_read_config_dword(pdev, PSB_PCIx_MSI_DATA_LOC, &dev_priv->msi_data); =20 pci_disable_device(pdev); pci_set_power_state(pdev, PCI_D3hot); @@ -168,9 +166,6 @@ static bool gma_resume_pci(struct pci_dev *pdev) pci_restore_state(pdev); pci_write_config_dword(pdev, 0x5c, dev_priv->regs.saveBSM); pci_write_config_dword(pdev, 0xFC, dev_priv->regs.saveVBT); - /* restoring MSI address and data in PCIx space */ - pci_write_config_dword(pdev, PSB_PCIx_MSI_ADDR_LOC, dev_priv->msi_addr); - pci_write_config_dword(pdev, PSB_PCIx_MSI_DATA_LOC, dev_priv->msi_data); ret =3D pci_enable_device(pdev); =20 if (ret !=3D 0) @@ -223,8 +218,7 @@ int gma_power_resume(struct device *_dev) mutex_lock(&power_mutex); gma_resume_pci(pdev); gma_resume_display(pdev); - gma_irq_preinstall(dev); - gma_irq_postinstall(dev); + gma_irq_install(dev); mutex_unlock(&power_mutex); return 0; } diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_= drv.c index 1d8744f3e702..54e756b48606 100644 --- a/drivers/gpu/drm/gma500/psb_drv.c +++ b/drivers/gpu/drm/gma500/psb_drv.c @@ -383,7 +383,7 @@ static int psb_driver_load(struct drm_device *dev, unsi= gned long flags) PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R); spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags); =20 - gma_irq_install(dev, pdev->irq); + gma_irq_install(dev); =20 dev->max_vblank_count =3D 0xffffff; /* only 24 bits of frame count */ =20 diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_= drv.h index 0ddfec1a0851..4c3fc5eaf6ad 100644 --- a/drivers/gpu/drm/gma500/psb_drv.h +++ b/drivers/gpu/drm/gma500/psb_drv.h @@ -490,6 +490,7 @@ struct drm_psb_private { int rpm_enabled; =20 /* MID specific */ + bool use_msi; bool has_gct; struct oaktrail_gct_data gct_data; =20 @@ -499,10 +500,6 @@ struct drm_psb_private { /* Register state */ struct psb_save_area regs; =20 - /* MSI reg save */ - uint32_t msi_addr; - uint32_t msi_data; - /* Hotplug handling */ struct work_struct hotplug_work; =20 diff --git a/drivers/gpu/drm/gma500/psb_irq.c b/drivers/gpu/drm/gma500/psb_= irq.c index e6e6d61bbeab..038f18ed0a95 100644 --- a/drivers/gpu/drm/gma500/psb_irq.c +++ b/drivers/gpu/drm/gma500/psb_irq.c @@ -316,17 +316,24 @@ void gma_irq_postinstall(struct drm_device *dev) spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags); } =20 -int gma_irq_install(struct drm_device *dev, unsigned int irq) +int gma_irq_install(struct drm_device *dev) { + struct drm_psb_private *dev_priv =3D to_drm_psb_private(dev); + struct pci_dev *pdev =3D to_pci_dev(dev->dev); int ret; =20 - if (irq =3D=3D IRQ_NOTCONNECTED) + if (dev_priv->use_msi && pci_enable_msi(pdev)) { + dev_warn(dev->dev, "Enabling MSI failed!\n"); + dev_priv->use_msi =3D false; + } + + if (pdev->irq =3D=3D IRQ_NOTCONNECTED) return -ENOTCONN; =20 gma_irq_preinstall(dev); =20 /* PCI devices require shared interrupts. */ - ret =3D request_irq(irq, gma_irq_handler, IRQF_SHARED, dev->driver->name,= dev); + ret =3D request_irq(pdev->irq, gma_irq_handler, IRQF_SHARED, dev->driver-= >name, dev); if (ret) return ret; =20 @@ -369,6 +376,8 @@ void gma_irq_uninstall(struct drm_device *dev) spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags); =20 free_irq(pdev->irq, dev); + if (dev_priv->use_msi) + pci_disable_msi(pdev); } =20 int gma_crtc_enable_vblank(struct drm_crtc *crtc) diff --git a/drivers/gpu/drm/gma500/psb_irq.h b/drivers/gpu/drm/gma500/psb_= irq.h index b51e395194ff..7648f69824a5 100644 --- a/drivers/gpu/drm/gma500/psb_irq.h +++ b/drivers/gpu/drm/gma500/psb_irq.h @@ -17,7 +17,7 @@ struct drm_device; =20 void gma_irq_preinstall(struct drm_device *dev); void gma_irq_postinstall(struct drm_device *dev); -int gma_irq_install(struct drm_device *dev, unsigned int irq); +int gma_irq_install(struct drm_device *dev); void gma_irq_uninstall(struct drm_device *dev); =20 int gma_crtc_enable_vblank(struct drm_crtc *crtc); --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9CA6C07E9D for ; Mon, 26 Sep 2022 11:59:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238784AbiIZL7c (ORCPT ); Mon, 26 Sep 2022 07:59:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238250AbiIZL4F (ORCPT ); Mon, 26 Sep 2022 07:56:05 -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 C46447963A; Mon, 26 Sep 2022 03:51: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 dfw.source.kernel.org (Postfix) with ESMTPS id 9104360A52; Mon, 26 Sep 2022 10:49:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BC33C433C1; Mon, 26 Sep 2022 10:49:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189399; bh=QU8P21MuAyq1H6RBQVtU3ITuaSUzlij2SD4xr4QQmzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i+sprgtUEbhG+nCERIp1kWYPyS79bPQqBfJnubiL7mIbRMGCeqsalwHvEtVDJEysa D1xRsXRaUlbvK4oYgWMHSY5u7daUqwGtsiYpUlBc65kXbYO7sOorXY+/OL+bOFWOV7 yZq5QupZ6EHZsAH2NBJtrds2JqWLy1lr5a6fT+yw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Linus Walleij , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.19 175/207] gpio: ixp4xx: Make irqchip immutable Date: Mon, 26 Sep 2022 12:12:44 +0200 Message-Id: <20220926100814.477596656@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Walleij [ Upstream commit 94e9bc73d85aa6ecfe249e985ff57abe0ab35f34 ] This turns the IXP4xx GPIO irqchip into an immutable irqchip, a bit different from the standard template due to being hierarchical. Tested on the IXP4xx which uses drivers/ata/pata_ixp4xx_cf.c for a rootfs on compact flash with IRQs from this GPIO block to the CF ATA controller. Cc: Marc Zyngier Signed-off-by: Linus Walleij Acked-by: Marc Zyngier Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpio/gpio-ixp4xx.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-ixp4xx.c b/drivers/gpio/gpio-ixp4xx.c index 312309be0287..56656fb519f8 100644 --- a/drivers/gpio/gpio-ixp4xx.c +++ b/drivers/gpio/gpio-ixp4xx.c @@ -63,6 +63,14 @@ static void ixp4xx_gpio_irq_ack(struct irq_data *d) __raw_writel(BIT(d->hwirq), g->base + IXP4XX_REG_GPIS); } =20 +static void ixp4xx_gpio_mask_irq(struct irq_data *d) +{ + struct gpio_chip *gc =3D irq_data_get_irq_chip_data(d); + + irq_chip_mask_parent(d); + gpiochip_disable_irq(gc, d->hwirq); +} + static void ixp4xx_gpio_irq_unmask(struct irq_data *d) { struct gpio_chip *gc =3D irq_data_get_irq_chip_data(d); @@ -72,6 +80,7 @@ static void ixp4xx_gpio_irq_unmask(struct irq_data *d) if (!(g->irq_edge & BIT(d->hwirq))) ixp4xx_gpio_irq_ack(d); =20 + gpiochip_enable_irq(gc, d->hwirq); irq_chip_unmask_parent(d); } =20 @@ -149,12 +158,14 @@ static int ixp4xx_gpio_irq_set_type(struct irq_data *= d, unsigned int type) return irq_chip_set_type_parent(d, IRQ_TYPE_LEVEL_HIGH); } =20 -static struct irq_chip ixp4xx_gpio_irqchip =3D { +static const struct irq_chip ixp4xx_gpio_irqchip =3D { .name =3D "IXP4GPIO", .irq_ack =3D ixp4xx_gpio_irq_ack, - .irq_mask =3D irq_chip_mask_parent, + .irq_mask =3D ixp4xx_gpio_mask_irq, .irq_unmask =3D ixp4xx_gpio_irq_unmask, .irq_set_type =3D ixp4xx_gpio_irq_set_type, + .flags =3D IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; =20 static int ixp4xx_gpio_child_to_parent_hwirq(struct gpio_chip *gc, @@ -263,7 +274,7 @@ static int ixp4xx_gpio_probe(struct platform_device *pd= ev) g->gc.owner =3D THIS_MODULE; =20 girq =3D &g->gc.irq; - girq->chip =3D &ixp4xx_gpio_irqchip; + gpio_irq_chip_set_chip(girq, &ixp4xx_gpio_irqchip); girq->fwnode =3D g->fwnode; girq->parent_domain =3D parent; girq->child_to_parent_hwirq =3D ixp4xx_gpio_child_to_parent_hwirq; --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA4C4C07E9D for ; Mon, 26 Sep 2022 11:57:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238980AbiIZL5H (ORCPT ); Mon, 26 Sep 2022 07:57:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239076AbiIZLya (ORCPT ); Mon, 26 Sep 2022 07:54:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C991876944; Mon, 26 Sep 2022 03:50: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 8642560AF5; Mon, 26 Sep 2022 10:50:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F157C433D6; Mon, 26 Sep 2022 10:50:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189402; bh=HQt0Dir2v/OKPiuSGmulQLZyU2gBxDWR9oKGbTv2oXI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=idMkFBqxSeeU6DA+wRMLR6Ca0w8ch7l5TpAIRnJ0q3iWunp9U/0yAPEy/Evy1YEMA FFeBzAjTvm5swPnJnsIBA7qZ+NFR+cgKgnDMknP12LobPeMxZhH1AZcpiKBcwo/y6O wdg9jygwCycsVdngLTcE73maR+Iry3LpfgXGfLOs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guchun Chen , Lijo Lazar , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 176/207] drm/amd/pm: disable BACO entry/exit completely on several sienna cichlid cards Date: Mon, 26 Sep 2022 12:12:45 +0200 Message-Id: <20220926100814.516349402@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guchun Chen [ Upstream commit 7c6fb61a400bf3218c6504cb2d48858f98822c9d ] To avoid hardware intermittent failures. Signed-off-by: Guchun Chen Reviewed-by: Lijo Lazar Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- .../gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/driv= ers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c index 32bb6b1d9526..d13e455c8827 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c @@ -368,6 +368,17 @@ static void sienna_cichlid_check_bxco_support(struct s= mu_context *smu) smu_baco->platform_support =3D (val & RCC_BIF_STRAP0__STRAP_PX_CAPABLE_MASK) ? true : false; + + /* + * Disable BACO entry/exit completely on below SKUs to + * avoid hardware intermittent failures. + */ + if (((adev->pdev->device =3D=3D 0x73A1) && + (adev->pdev->revision =3D=3D 0x00)) || + ((adev->pdev->device =3D=3D 0x73BF) && + (adev->pdev->revision =3D=3D 0xCF))) + smu_baco->platform_support =3D false; + } } =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF38FC07E9D for ; Mon, 26 Sep 2022 11:57:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239019AbiIZL5Z (ORCPT ); Mon, 26 Sep 2022 07:57:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239140AbiIZLyl (ORCPT ); Mon, 26 Sep 2022 07:54:41 -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 C836E77E8C; Mon, 26 Sep 2022 03:50: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 8EB1F60C13; Mon, 26 Sep 2022 10:50:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DC87C433D6; Mon, 26 Sep 2022 10:50:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189405; bh=1/1trZGEtev77HfDDQBWBt2AT66uUUujyyAtJ++NY0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dUG+vKPIH54PrfP89EYUK4CBOAaVLzn2/kGX+rRv8ypgmHKnP8AxhVwGfJLsllHp7 j7o76EZcs9nmJq/Mxm6A4lJLKvazHjp379iowftFak2hoMZsnIyMhl5zqCBDx7sRBU WyW/vjOCeAnaD7/7CY9uJfOFaWWgS8DEMFY30T/A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hamza Mahfooz , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 177/207] drm/amdgpu: use dirty framebuffer helper Date: Mon, 26 Sep 2022 12:12:46 +0200 Message-Id: <20220926100814.566867154@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hamza Mahfooz [ Upstream commit 66f99628eb24409cb8feb5061f78283c8b65f820 ] Currently, we aren't handling DRM_IOCTL_MODE_DIRTYFB. So, use drm_atomic_helper_dirtyfb() as the dirty callback in the amdgpu_fb_funcs struct. Signed-off-by: Hamza Mahfooz Acked-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/= amd/amdgpu/amdgpu_display.c index 4dfd6724b3ca..3451147beda3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -493,6 +494,7 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *= amdgpu_connector, static const struct drm_framebuffer_funcs amdgpu_fb_funcs =3D { .destroy =3D drm_gem_fb_destroy, .create_handle =3D drm_gem_fb_create_handle, + .dirty =3D drm_atomic_helper_dirtyfb, }; =20 uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev, --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD059C07E9D for ; Mon, 26 Sep 2022 11:57:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239027AbiIZL5c (ORCPT ); Mon, 26 Sep 2022 07:57:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239180AbiIZLyq (ORCPT ); Mon, 26 Sep 2022 07:54:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9012E78219; Mon, 26 Sep 2022 03:50:23 -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 79DC160C41; Mon, 26 Sep 2022 10:50:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AF72C433D6; Mon, 26 Sep 2022 10:50:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189407; bh=jR+9wdzZXg1ytd9GBg3XFo+5bh/ND8xS//zX2kiAkgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vialv12cO+qJjwDfCwEyqga7S/boVA0IRIlLYFaifSUblu/4IpXSn0ZQGpQdSw9t1 LC9/TDhVNejqPJ2WMVu5RRWwKlOJFDOiSobLiAbCEU39YWB0sEwV4sobyOhLxIkCIO E0Uv0ykDOH70nyg/hKqEqluqnTpU8Kr7SPqtT9ko= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Wang , Hawking Zhang , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 178/207] drm/amdgpu: change the alignment size of TMR BO to 1M Date: Mon, 26 Sep 2022 12:12:47 +0200 Message-Id: <20220926100814.598225135@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Wang [ Upstream commit 36de13fdb04abef3ee03ade5129ab146de63983b ] align TMR BO size TO tmr size is not necessary, modify the size to 1M to avoid re-create BO fail when serious VRAM fragmentation. v2: add new macro PSP_TMR_ALIGNMENT for TMR BO alignment size Signed-off-by: Yang Wang Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_psp.c index b19bf0c3f373..79ce654bd3da 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -748,7 +748,7 @@ static int psp_tmr_init(struct psp_context *psp) } =20 pptr =3D amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL; - ret =3D amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_SIZE(psp->ad= ev), + ret =3D amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_ALIGNMENT, AMDGPU_GEM_DOMAIN_VRAM, &psp->tmr_bo, &psp->tmr_mc_addr, pptr); =20 diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/= amdgpu/amdgpu_psp.h index e431f4994931..cd366c7f311f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h @@ -36,6 +36,7 @@ #define PSP_CMD_BUFFER_SIZE 0x1000 #define PSP_1_MEG 0x100000 #define PSP_TMR_SIZE(adev) ((adev)->asic_type =3D=3D CHIP_ALDEBARAN ? 0x80= 0000 : 0x400000) +#define PSP_TMR_ALIGNMENT 0x100000 #define PSP_FW_NAME_LEN 0x24 =20 enum psp_shared_mem_size { --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD7FBC07E9D for ; Mon, 26 Sep 2022 12:02:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239108AbiIZMCB (ORCPT ); Mon, 26 Sep 2022 08:02:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239254AbiIZL6h (ORCPT ); Mon, 26 Sep 2022 07:58:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E587B7B286; Mon, 26 Sep 2022 03:52:07 -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 2E084B80185; Mon, 26 Sep 2022 10:50:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EC71C433D6; Mon, 26 Sep 2022 10:50:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189410; bh=OJR+Kvk3y51iZ6Yjl4qfoMm5F58M8vlAqHec4fKuqLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tqFQlgzWbdv/AIYtolb0yAr8OafU+29c7LC4g0JUyYFRky1gku9GtK9mT4KaYA0nf voM8Yh+V8VQ3asvp92yxIittY9Z9FDTfxUhGsRtI3wbJ94EHIGp1h6dmmdS+e6c4V/ 3OoJQyb2xFsdFQIFgqfnFrebddWpZkNVeSpLeLwA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lijo Lazar , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 179/207] drm/amdgpu: add HDP remap functionality to nbio 7.7 Date: Mon, 26 Sep 2022 12:12:48 +0200 Message-Id: <20220926100814.634068640@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alex Deucher [ Upstream commit 8c5708d3da37b8c7c3c22c7e945b9a76a7c9539b ] Was missing before and would have resulted in a write to a non-existant register. Normally APUs don't use HDP, but other asics could use this code and APUs do use the HDP when used in passthrough. Reviewed-by: Lijo Lazar Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/nbio_v7_7.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v7_7.c b/drivers/gpu/drm/amd/a= mdgpu/nbio_v7_7.c index cdc0c9779848..6c1fd471a4c7 100644 --- a/drivers/gpu/drm/amd/amdgpu/nbio_v7_7.c +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v7_7.c @@ -28,6 +28,14 @@ #include "nbio/nbio_7_7_0_sh_mask.h" #include =20 +static void nbio_v7_7_remap_hdp_registers(struct amdgpu_device *adev) +{ + WREG32_SOC15(NBIO, 0, regBIF_BX0_REMAP_HDP_MEM_FLUSH_CNTL, + adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL); + WREG32_SOC15(NBIO, 0, regBIF_BX0_REMAP_HDP_REG_FLUSH_CNTL, + adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_REG_FLUSH_CNTL); +} + static u32 nbio_v7_7_get_rev_id(struct amdgpu_device *adev) { u32 tmp; @@ -237,4 +245,5 @@ const struct amdgpu_nbio_funcs nbio_v7_7_funcs =3D { .ih_doorbell_range =3D nbio_v7_7_ih_doorbell_range, .ih_control =3D nbio_v7_7_ih_control, .init_registers =3D nbio_v7_7_init_registers, + .remap_hdp_registers =3D nbio_v7_7_remap_hdp_registers, }; --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FFE1C32771 for ; Mon, 26 Sep 2022 12:23:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235335AbiIZMXy (ORCPT ); Mon, 26 Sep 2022 08:23:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235428AbiIZMXY (ORCPT ); Mon, 26 Sep 2022 08:23:24 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F160E726A9; Mon, 26 Sep 2022 04:05: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 sin.source.kernel.org (Postfix) with ESMTPS id 2EF44CE1119; Mon, 26 Sep 2022 10:50:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4831CC433C1; Mon, 26 Sep 2022 10:50:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189413; bh=ON79Ezb0W4s0GNf/NoqKu+FimfoSIUQjcZclqHc3mXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lUFgjLXT/BCIzWCh/YyBnOunHKxYhw5alYQyaW/UGwg76Z3WI3D58Dxeomgo6bHpR sVMk5DgIr977na1NHhcGFh0O/GvJrLOBSS6npn/FK8/yozf+Voewg97RCTGXu+opnQ ytAjQDaznUqPKDJSmCDO5rBssnkvFTOg+xvquN2c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Candice Li , Hawking Zhang , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 180/207] drm/amdgpu: Skip reset error status for psp v13_0_0 Date: Mon, 26 Sep 2022 12:12:49 +0200 Message-Id: <20220926100814.672275789@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Candice Li [ Upstream commit 86875d558b91cb46f43be112799c06ecce60ec1e ] No need to reset error status since only umc ras supported on psp v13_0_0. Signed-off-by: Candice Li Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_ras.c index dac202ae864d..9193ca5d6fe7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c @@ -1805,7 +1805,8 @@ static void amdgpu_ras_log_on_err_counter(struct amdg= pu_device *adev) amdgpu_ras_query_error_status(adev, &info); =20 if (adev->ip_versions[MP0_HWIP][0] !=3D IP_VERSION(11, 0, 2) && - adev->ip_versions[MP0_HWIP][0] !=3D IP_VERSION(11, 0, 4)) { + adev->ip_versions[MP0_HWIP][0] !=3D IP_VERSION(11, 0, 4) && + adev->ip_versions[MP0_HWIP][0] !=3D IP_VERSION(13, 0, 0)) { if (amdgpu_ras_reset_error_status(adev, info.head.block)) dev_warn(adev->dev, "Failed to reset error counter and error status"); } --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5A40C32771 for ; Mon, 26 Sep 2022 12:00:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239123AbiIZMAF (ORCPT ); Mon, 26 Sep 2022 08:00:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238528AbiIZL4O (ORCPT ); Mon, 26 Sep 2022 07:56:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CD967960B; Mon, 26 Sep 2022 03:51:33 -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 0ADB360C17; Mon, 26 Sep 2022 10:50:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 139AFC433C1; Mon, 26 Sep 2022 10:50:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189416; bh=Tb00sjBAY3nprOehK04zLLPf89XDrBubey8KUxfTO+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LCE3cZ949iWzr+X6asa9CJUJWT7H7PE5rFKD7VPfdK2mPWLQC+8LmAoEB9KmGekew TVlNVnWrqjZszdFDPQeDbVHqfr/6m5LI5OdqkpmsHMnwBbWy7ajuqhQUgTnpKvWJL6 8mrMxQ7yOhTSUYa+RjhGBaA1vqYezOghQf29RjfY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Wheeler , Krunoslav Kovac , Aric Cyr , Pavle Kotarac , Yao Wang1 , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 181/207] drm/amd/display: Limit user regamma to a valid value Date: Mon, 26 Sep 2022 12:12:50 +0200 Message-Id: <20220926100814.709822293@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yao Wang1 [ Upstream commit 3601d620f22e37740cf73f8278eabf9f2aa19eb7 ] [Why] For HDR mode, we get total 512 tf_point and after switching to SDR mode we actually get 400 tf_point and the rest of points(401~512) still use dirty value from HDR mode. We should limit the rest of the points to max value. [How] Limit the value when coordinates_x.x > 1, just like what we do in translate_from_linear_space for other re-gamma build paths. Tested-by: Daniel Wheeler Reviewed-by: Krunoslav Kovac Reviewed-by: Aric Cyr Acked-by: Pavle Kotarac Signed-off-by: Yao Wang1 Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/amd/display/modules/color/color_gamma.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/driv= ers/gpu/drm/amd/display/modules/color/color_gamma.c index 64a38f08f497..5a51be753e87 100644 --- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c +++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c @@ -1603,6 +1603,7 @@ static void interpolate_user_regamma(uint32_t hw_poin= ts_num, struct fixed31_32 lut2; struct fixed31_32 delta_lut; struct fixed31_32 delta_index; + const struct fixed31_32 one =3D dc_fixpt_from_int(1); =20 i =3D 0; /* fixed_pt library has problems handling too small values */ @@ -1631,6 +1632,9 @@ static void interpolate_user_regamma(uint32_t hw_poin= ts_num, } else hw_x =3D coordinates_x[i].x; =20 + if (dc_fixpt_le(one, hw_x)) + hw_x =3D one; + norm_x =3D dc_fixpt_mul(norm_factor, hw_x); index =3D dc_fixpt_floor(norm_x); if (index < 0 || index > 255) --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64381C07E9D for ; Mon, 26 Sep 2022 12:24:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239402AbiIZMYX (ORCPT ); Mon, 26 Sep 2022 08:24:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239581AbiIZMXo (ORCPT ); Mon, 26 Sep 2022 08:23:44 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB6307EFFA; Mon, 26 Sep 2022 04:05:18 -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 sin.source.kernel.org (Postfix) with ESMTPS id 0CB7FCE111F; Mon, 26 Sep 2022 10:50:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE1D7C433C1; Mon, 26 Sep 2022 10:50:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189419; bh=oYdRjpsQ0y7Yda6NsSDe3hEm5WkcByYSTqzOz7KnoXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2GzGnYA7lyMCowq+RP5i4Np/olwz2QvFpecnsv+sFDlXkBA1jF87xMH1gLF5w0iWR m6QHJ90TC60+QkAq5rz7ilXYsNpmSKQxP/BEEIYtJAVpveP8/vNlUGNrbKHi6KyCnZ CTdoXalUqG03FhoEVir+Y/29HoWKmtIBdb+xJBrU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Sudip Mukherjee (Codethink)" , =?UTF-8?q?Ma=C3=ADra=20Canal?= , Rodrigo Siqueira , Nathan Chancellor , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 182/207] drm/amd/display: Reduce number of arguments of dml31s CalculateWatermarksAndDRAMSpeedChangeSupport() Date: Mon, 26 Sep 2022 12:12:51 +0200 Message-Id: <20220926100814.751079022@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Chancellor [ Upstream commit 37934d4118e22bceb80141804391975078f31734 ] Most of the arguments are identical between the two call sites and they can be accessed through the 'struct vba_vars_st' pointer. This reduces the total amount of stack space that dml31_ModeSupportAndSystemConfigurationFull() uses by 240 bytes with LLVM 16 (2216 -> 1976), helping clear up the following clang warning: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn31/display_mode_vba_31.c:= 3908:6: error: stack frame size (2216) exceeds limit (2048) in 'dml31_ModeS= upportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than] void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib = *mode_lib) ^ 1 error generated. Link: https://github.com/ClangBuiltLinux/linux/issues/1681 Reported-by: "Sudip Mukherjee (Codethink)" Tested-by: Ma=C3=ADra Canal Reviewed-by: Rodrigo Siqueira Signed-off-by: Nathan Chancellor Signed-off-by: Rodrigo Siqueira Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- .../dc/dml/dcn31/display_mode_vba_31.c | 248 ++++-------------- 1 file changed, 52 insertions(+), 196 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c= b/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c index e4b9fd31223c..586825d85d66 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c @@ -321,64 +321,28 @@ static void CalculateVupdateAndDynamicMetadataParamet= ers( static void CalculateWatermarksAndDRAMSpeedChangeSupport( struct display_mode_lib *mode_lib, unsigned int PrefetchMode, - unsigned int NumberOfActivePlanes, - unsigned int MaxLineBufferLines, - unsigned int LineBufferSize, - unsigned int WritebackInterfaceBufferSize, double DCFCLK, double ReturnBW, - bool SynchronizedVBlank, - unsigned int dpte_group_bytes[], - unsigned int MetaChunkSize, double UrgentLatency, double ExtraLatency, - double WritebackLatency, - double WritebackChunkSize, double SOCCLK, - double DRAMClockChangeLatency, - double SRExitTime, - double SREnterPlusExitTime, - double SRExitZ8Time, - double SREnterPlusExitZ8Time, double DCFCLKDeepSleep, unsigned int DETBufferSizeY[], unsigned int DETBufferSizeC[], unsigned int SwathHeightY[], unsigned int SwathHeightC[], - unsigned int LBBitPerPixel[], double SwathWidthY[], double SwathWidthC[], - double HRatio[], - double HRatioChroma[], - unsigned int vtaps[], - unsigned int VTAPsChroma[], - double VRatio[], - double VRatioChroma[], - unsigned int HTotal[], - double PixelClock[], - unsigned int BlendingAndTiming[], unsigned int DPPPerPlane[], double BytePerPixelDETY[], double BytePerPixelDETC[], - double DSTXAfterScaler[], - double DSTYAfterScaler[], - bool WritebackEnable[], - enum source_format_class WritebackPixelFormat[], - double WritebackDestinationWidth[], - double WritebackDestinationHeight[], - double WritebackSourceHeight[], bool UnboundedRequestEnabled, int unsigned CompressedBufferSizeInkByte, enum clock_change_support *DRAMClockChangeSupport, - double *UrgentWatermark, - double *WritebackUrgentWatermark, - double *DRAMClockChangeWatermark, - double *WritebackDRAMClockChangeWatermark, double *StutterExitWatermark, double *StutterEnterPlusExitWatermark, double *Z8StutterExitWatermark, - double *Z8StutterEnterPlusExitWatermark, - double *MinActiveDRAMClockChangeLatencySupported); + double *Z8StutterEnterPlusExitWatermark); =20 static void CalculateDCFCLKDeepSleep( struct display_mode_lib *mode_lib, @@ -3027,64 +2991,28 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchPar= ametersWatermarksAndPerforman CalculateWatermarksAndDRAMSpeedChangeSupport( mode_lib, PrefetchMode, - v->NumberOfActivePlanes, - v->MaxLineBufferLines, - v->LineBufferSize, - v->WritebackInterfaceBufferSize, v->DCFCLK, v->ReturnBW, - v->SynchronizedVBlank, - v->dpte_group_bytes, - v->MetaChunkSize, v->UrgentLatency, v->UrgentExtraLatency, - v->WritebackLatency, - v->WritebackChunkSize, v->SOCCLK, - v->DRAMClockChangeLatency, - v->SRExitTime, - v->SREnterPlusExitTime, - v->SRExitZ8Time, - v->SREnterPlusExitZ8Time, v->DCFCLKDeepSleep, v->DETBufferSizeY, v->DETBufferSizeC, v->SwathHeightY, v->SwathHeightC, - v->LBBitPerPixel, v->SwathWidthY, v->SwathWidthC, - v->HRatio, - v->HRatioChroma, - v->vtaps, - v->VTAPsChroma, - v->VRatio, - v->VRatioChroma, - v->HTotal, - v->PixelClock, - v->BlendingAndTiming, v->DPPPerPlane, v->BytePerPixelDETY, v->BytePerPixelDETC, - v->DSTXAfterScaler, - v->DSTYAfterScaler, - v->WritebackEnable, - v->WritebackPixelFormat, - v->WritebackDestinationWidth, - v->WritebackDestinationHeight, - v->WritebackSourceHeight, v->UnboundedRequestEnabled, v->CompressedBufferSizeInkByte, &DRAMClockChangeSupport, - &v->UrgentWatermark, - &v->WritebackUrgentWatermark, - &v->DRAMClockChangeWatermark, - &v->WritebackDRAMClockChangeWatermark, &v->StutterExitWatermark, &v->StutterEnterPlusExitWatermark, &v->Z8StutterExitWatermark, - &v->Z8StutterEnterPlusExitWatermark, - &v->MinActiveDRAMClockChangeLatencySupported); + &v->Z8StutterEnterPlusExitWatermark); =20 for (k =3D 0; k < v->NumberOfActivePlanes; ++k) { if (v->WritebackEnable[k] =3D=3D true) { @@ -5481,64 +5409,28 @@ void dml31_ModeSupportAndSystemConfigurationFull(st= ruct display_mode_lib *mode_l CalculateWatermarksAndDRAMSpeedChangeSupport( mode_lib, v->PrefetchModePerState[i][j], - v->NumberOfActivePlanes, - v->MaxLineBufferLines, - v->LineBufferSize, - v->WritebackInterfaceBufferSize, v->DCFCLKState[i][j], v->ReturnBWPerState[i][j], - v->SynchronizedVBlank, - v->dpte_group_bytes, - v->MetaChunkSize, v->UrgLatency[i], v->ExtraLatency, - v->WritebackLatency, - v->WritebackChunkSize, v->SOCCLKPerState[i], - v->DRAMClockChangeLatency, - v->SRExitTime, - v->SREnterPlusExitTime, - v->SRExitZ8Time, - v->SREnterPlusExitZ8Time, v->ProjectedDCFCLKDeepSleep[i][j], v->DETBufferSizeYThisState, v->DETBufferSizeCThisState, v->SwathHeightYThisState, v->SwathHeightCThisState, - v->LBBitPerPixel, v->SwathWidthYThisState, v->SwathWidthCThisState, - v->HRatio, - v->HRatioChroma, - v->vtaps, - v->VTAPsChroma, - v->VRatio, - v->VRatioChroma, - v->HTotal, - v->PixelClock, - v->BlendingAndTiming, v->NoOfDPPThisState, v->BytePerPixelInDETY, v->BytePerPixelInDETC, - v->DSTXAfterScaler, - v->DSTYAfterScaler, - v->WritebackEnable, - v->WritebackPixelFormat, - v->WritebackDestinationWidth, - v->WritebackDestinationHeight, - v->WritebackSourceHeight, UnboundedRequestEnabledThisState, CompressedBufferSizeInkByteThisState, &v->DRAMClockChangeSupport[i][j], - &v->UrgentWatermark, - &v->WritebackUrgentWatermark, - &v->DRAMClockChangeWatermark, - &v->WritebackDRAMClockChangeWatermark, - &dummy, &dummy, &dummy, &dummy, - &v->MinActiveDRAMClockChangeLatencySupported); + &dummy); } } =20 @@ -5663,64 +5555,28 @@ void dml31_ModeSupportAndSystemConfigurationFull(st= ruct display_mode_lib *mode_l static void CalculateWatermarksAndDRAMSpeedChangeSupport( struct display_mode_lib *mode_lib, unsigned int PrefetchMode, - unsigned int NumberOfActivePlanes, - unsigned int MaxLineBufferLines, - unsigned int LineBufferSize, - unsigned int WritebackInterfaceBufferSize, double DCFCLK, double ReturnBW, - bool SynchronizedVBlank, - unsigned int dpte_group_bytes[], - unsigned int MetaChunkSize, double UrgentLatency, double ExtraLatency, - double WritebackLatency, - double WritebackChunkSize, double SOCCLK, - double DRAMClockChangeLatency, - double SRExitTime, - double SREnterPlusExitTime, - double SRExitZ8Time, - double SREnterPlusExitZ8Time, double DCFCLKDeepSleep, unsigned int DETBufferSizeY[], unsigned int DETBufferSizeC[], unsigned int SwathHeightY[], unsigned int SwathHeightC[], - unsigned int LBBitPerPixel[], double SwathWidthY[], double SwathWidthC[], - double HRatio[], - double HRatioChroma[], - unsigned int vtaps[], - unsigned int VTAPsChroma[], - double VRatio[], - double VRatioChroma[], - unsigned int HTotal[], - double PixelClock[], - unsigned int BlendingAndTiming[], unsigned int DPPPerPlane[], double BytePerPixelDETY[], double BytePerPixelDETC[], - double DSTXAfterScaler[], - double DSTYAfterScaler[], - bool WritebackEnable[], - enum source_format_class WritebackPixelFormat[], - double WritebackDestinationWidth[], - double WritebackDestinationHeight[], - double WritebackSourceHeight[], bool UnboundedRequestEnabled, int unsigned CompressedBufferSizeInkByte, enum clock_change_support *DRAMClockChangeSupport, - double *UrgentWatermark, - double *WritebackUrgentWatermark, - double *DRAMClockChangeWatermark, - double *WritebackDRAMClockChangeWatermark, double *StutterExitWatermark, double *StutterEnterPlusExitWatermark, double *Z8StutterExitWatermark, - double *Z8StutterEnterPlusExitWatermark, - double *MinActiveDRAMClockChangeLatencySupported) + double *Z8StutterEnterPlusExitWatermark) { struct vba_vars_st *v =3D &mode_lib->vba; double EffectiveLBLatencyHidingY; @@ -5740,103 +5596,103 @@ static void CalculateWatermarksAndDRAMSpeedChange= Support( double TotalPixelBW =3D 0.0; int k, j; =20 - *UrgentWatermark =3D UrgentLatency + ExtraLatency; + v->UrgentWatermark =3D UrgentLatency + ExtraLatency; =20 #ifdef __DML_VBA_DEBUG__ dml_print("DML::%s: UrgentLatency =3D %f\n", __func__, UrgentLatency); dml_print("DML::%s: ExtraLatency =3D %f\n", __func__, ExtraLatency); - dml_print("DML::%s: UrgentWatermark =3D %f\n", __func__, *UrgentWatermark= ); + dml_print("DML::%s: UrgentWatermark =3D %f\n", __func__, v->UrgentWaterma= rk); #endif =20 - *DRAMClockChangeWatermark =3D DRAMClockChangeLatency + *UrgentWatermark; + v->DRAMClockChangeWatermark =3D v->DRAMClockChangeLatency + v->UrgentWate= rmark; =20 #ifdef __DML_VBA_DEBUG__ - dml_print("DML::%s: DRAMClockChangeLatency =3D %f\n", __func__, DRAMClock= ChangeLatency); - dml_print("DML::%s: DRAMClockChangeWatermark =3D %f\n", __func__, *DRAMCl= ockChangeWatermark); + dml_print("DML::%s: v->DRAMClockChangeLatency =3D %f\n", __func__, v->DRA= MClockChangeLatency); + dml_print("DML::%s: DRAMClockChangeWatermark =3D %f\n", __func__, v->DRAM= ClockChangeWatermark); #endif =20 v->TotalActiveWriteback =3D 0; - for (k =3D 0; k < NumberOfActivePlanes; ++k) { - if (WritebackEnable[k] =3D=3D true) { + for (k =3D 0; k < v->NumberOfActivePlanes; ++k) { + if (v->WritebackEnable[k] =3D=3D true) { v->TotalActiveWriteback =3D v->TotalActiveWriteback + 1; } } =20 if (v->TotalActiveWriteback <=3D 1) { - *WritebackUrgentWatermark =3D WritebackLatency; + v->WritebackUrgentWatermark =3D v->WritebackLatency; } else { - *WritebackUrgentWatermark =3D WritebackLatency + WritebackChunkSize * 10= 24.0 / 32.0 / SOCCLK; + v->WritebackUrgentWatermark =3D v->WritebackLatency + v->WritebackChunkS= ize * 1024.0 / 32.0 / SOCCLK; } =20 if (v->TotalActiveWriteback <=3D 1) { - *WritebackDRAMClockChangeWatermark =3D DRAMClockChangeLatency + Writebac= kLatency; + v->WritebackDRAMClockChangeWatermark =3D v->DRAMClockChangeLatency + v->= WritebackLatency; } else { - *WritebackDRAMClockChangeWatermark =3D DRAMClockChangeLatency + Writebac= kLatency + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK; + v->WritebackDRAMClockChangeWatermark =3D v->DRAMClockChangeLatency + v->= WritebackLatency + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK; } =20 - for (k =3D 0; k < NumberOfActivePlanes; ++k) { + for (k =3D 0; k < v->NumberOfActivePlanes; ++k) { TotalPixelBW =3D TotalPixelBW - + DPPPerPlane[k] * (SwathWidthY[k] * BytePerPixelDETY[k] * VRatio[k] += SwathWidthC[k] * BytePerPixelDETC[k] * VRatioChroma[k]) - / (HTotal[k] / PixelClock[k]); + + DPPPerPlane[k] * (SwathWidthY[k] * BytePerPixelDETY[k] * v->VRatio[k= ] + SwathWidthC[k] * BytePerPixelDETC[k] * v->VRatioChroma[k]) + / (v->HTotal[k] / v->PixelClock[k]); } =20 - for (k =3D 0; k < NumberOfActivePlanes; ++k) { + for (k =3D 0; k < v->NumberOfActivePlanes; ++k) { double EffectiveDETBufferSizeY =3D DETBufferSizeY[k]; =20 v->LBLatencyHidingSourceLinesY =3D dml_min( - (double) MaxLineBufferLines, - dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthY[k] / dml_ma= x(HRatio[k], 1.0)), 1)) - (vtaps[k] - 1); + (double) v->MaxLineBufferLines, + dml_floor(v->LineBufferSize / v->LBBitPerPixel[k] / (SwathWidthY[k] / = dml_max(v->HRatio[k], 1.0)), 1)) - (v->vtaps[k] - 1); =20 v->LBLatencyHidingSourceLinesC =3D dml_min( - (double) MaxLineBufferLines, - dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthC[k] / dml_ma= x(HRatioChroma[k], 1.0)), 1)) - (VTAPsChroma[k] - 1); + (double) v->MaxLineBufferLines, + dml_floor(v->LineBufferSize / v->LBBitPerPixel[k] / (SwathWidthC[k] / = dml_max(v->HRatioChroma[k], 1.0)), 1)) - (v->VTAPsChroma[k] - 1); =20 - EffectiveLBLatencyHidingY =3D v->LBLatencyHidingSourceLinesY / VRatio[k]= * (HTotal[k] / PixelClock[k]); + EffectiveLBLatencyHidingY =3D v->LBLatencyHidingSourceLinesY / v->VRatio= [k] * (v->HTotal[k] / v->PixelClock[k]); =20 - EffectiveLBLatencyHidingC =3D v->LBLatencyHidingSourceLinesC / VRatioChr= oma[k] * (HTotal[k] / PixelClock[k]); + EffectiveLBLatencyHidingC =3D v->LBLatencyHidingSourceLinesC / v->VRatio= Chroma[k] * (v->HTotal[k] / v->PixelClock[k]); =20 if (UnboundedRequestEnabled) { EffectiveDETBufferSizeY =3D EffectiveDETBufferSizeY - + CompressedBufferSizeInkByte * 1024 * SwathWidthY[k] * BytePerPixelD= ETY[k] * VRatio[k] / (HTotal[k] / PixelClock[k]) / TotalPixelBW; + + CompressedBufferSizeInkByte * 1024 * SwathWidthY[k] * BytePerPixelD= ETY[k] * v->VRatio[k] / (v->HTotal[k] / v->PixelClock[k]) / TotalPixelBW; } =20 LinesInDETY[k] =3D (double) EffectiveDETBufferSizeY / BytePerPixelDETY[k= ] / SwathWidthY[k]; LinesInDETYRoundedDownToSwath[k] =3D dml_floor(LinesInDETY[k], SwathHeig= htY[k]); - FullDETBufferingTimeY =3D LinesInDETYRoundedDownToSwath[k] * (HTotal[k] = / PixelClock[k]) / VRatio[k]; + FullDETBufferingTimeY =3D LinesInDETYRoundedDownToSwath[k] * (v->HTotal[= k] / v->PixelClock[k]) / v->VRatio[k]; if (BytePerPixelDETC[k] > 0) { LinesInDETC =3D v->DETBufferSizeC[k] / BytePerPixelDETC[k] / SwathWidth= C[k]; LinesInDETCRoundedDownToSwath =3D dml_floor(LinesInDETC, SwathHeightC[k= ]); - FullDETBufferingTimeC =3D LinesInDETCRoundedDownToSwath * (HTotal[k] / = PixelClock[k]) / VRatioChroma[k]; + FullDETBufferingTimeC =3D LinesInDETCRoundedDownToSwath * (v->HTotal[k]= / v->PixelClock[k]) / v->VRatioChroma[k]; } else { LinesInDETC =3D 0; FullDETBufferingTimeC =3D 999999; } =20 ActiveDRAMClockChangeLatencyMarginY =3D EffectiveLBLatencyHidingY + Full= DETBufferingTimeY - - ((double) DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) * HTo= tal[k] / PixelClock[k] - *UrgentWatermark - *DRAMClockChangeWatermark; + - ((double) v->DSTXAfterScaler[k] / v->HTotal[k] + v->DSTYAfterScaler[= k]) * v->HTotal[k] / v->PixelClock[k] - v->UrgentWatermark - v->DRAMClockCh= angeWatermark; =20 - if (NumberOfActivePlanes > 1) { + if (v->NumberOfActivePlanes > 1) { ActiveDRAMClockChangeLatencyMarginY =3D ActiveDRAMClockChangeLatencyMar= ginY - - (1 - 1.0 / NumberOfActivePlanes) * SwathHeightY[k] * HTotal[k] / Pi= xelClock[k] / VRatio[k]; + - (1 - 1.0 / v->NumberOfActivePlanes) * SwathHeightY[k] * v->HTotal[k= ] / v->PixelClock[k] / v->VRatio[k]; } =20 if (BytePerPixelDETC[k] > 0) { ActiveDRAMClockChangeLatencyMarginC =3D EffectiveLBLatencyHidingC + Ful= lDETBufferingTimeC - - ((double) DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) * HT= otal[k] / PixelClock[k] - *UrgentWatermark - *DRAMClockChangeWatermark; + - ((double) v->DSTXAfterScaler[k] / v->HTotal[k] + v->DSTYAfterScaler= [k]) * v->HTotal[k] / v->PixelClock[k] - v->UrgentWatermark - v->DRAMClockC= hangeWatermark; =20 - if (NumberOfActivePlanes > 1) { + if (v->NumberOfActivePlanes > 1) { ActiveDRAMClockChangeLatencyMarginC =3D ActiveDRAMClockChangeLatencyMa= rginC - - (1 - 1.0 / NumberOfActivePlanes) * SwathHeightC[k] * HTotal[k] / P= ixelClock[k] / VRatioChroma[k]; + - (1 - 1.0 / v->NumberOfActivePlanes) * SwathHeightC[k] * v->HTotal[= k] / v->PixelClock[k] / v->VRatioChroma[k]; } v->ActiveDRAMClockChangeLatencyMargin[k] =3D dml_min(ActiveDRAMClockCha= ngeLatencyMarginY, ActiveDRAMClockChangeLatencyMarginC); } else { v->ActiveDRAMClockChangeLatencyMargin[k] =3D ActiveDRAMClockChangeLaten= cyMarginY; } =20 - if (WritebackEnable[k] =3D=3D true) { - WritebackDRAMClockChangeLatencyHiding =3D WritebackInterfaceBufferSize = * 1024 - / (WritebackDestinationWidth[k] * WritebackDestinationHeight[k] / (Wr= itebackSourceHeight[k] * HTotal[k] / PixelClock[k]) * 4); - if (WritebackPixelFormat[k] =3D=3D dm_444_64) { + if (v->WritebackEnable[k] =3D=3D true) { + WritebackDRAMClockChangeLatencyHiding =3D v->WritebackInterfaceBufferSi= ze * 1024 + / (v->WritebackDestinationWidth[k] * v->WritebackDestinationHeight[k]= / (v->WritebackSourceHeight[k] * v->HTotal[k] / v->PixelClock[k]) * 4); + if (v->WritebackPixelFormat[k] =3D=3D dm_444_64) { WritebackDRAMClockChangeLatencyHiding =3D WritebackDRAMClockChangeLate= ncyHiding / 2; } WritebackDRAMClockChangeLatencyMargin =3D WritebackDRAMClockChangeLaten= cyHiding - v->WritebackDRAMClockChangeWatermark; @@ -5846,14 +5702,14 @@ static void CalculateWatermarksAndDRAMSpeedChangeSu= pport( =20 v->MinActiveDRAMClockChangeMargin =3D 999999; PlaneWithMinActiveDRAMClockChangeMargin =3D 0; - for (k =3D 0; k < NumberOfActivePlanes; ++k) { + for (k =3D 0; k < v->NumberOfActivePlanes; ++k) { if (v->ActiveDRAMClockChangeLatencyMargin[k] < v->MinActiveDRAMClockChan= geMargin) { v->MinActiveDRAMClockChangeMargin =3D v->ActiveDRAMClockChangeLatencyMa= rgin[k]; - if (BlendingAndTiming[k] =3D=3D k) { + if (v->BlendingAndTiming[k] =3D=3D k) { PlaneWithMinActiveDRAMClockChangeMargin =3D k; } else { - for (j =3D 0; j < NumberOfActivePlanes; ++j) { - if (BlendingAndTiming[k] =3D=3D j) { + for (j =3D 0; j < v->NumberOfActivePlanes; ++j) { + if (v->BlendingAndTiming[k] =3D=3D j) { PlaneWithMinActiveDRAMClockChangeMargin =3D j; } } @@ -5861,11 +5717,11 @@ static void CalculateWatermarksAndDRAMSpeedChangeSu= pport( } } =20 - *MinActiveDRAMClockChangeLatencySupported =3D v->MinActiveDRAMClockChange= Margin + DRAMClockChangeLatency; + v->MinActiveDRAMClockChangeLatencySupported =3D v->MinActiveDRAMClockChan= geMargin + v->DRAMClockChangeLatency ; =20 SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank =3D 999999; - for (k =3D 0; k < NumberOfActivePlanes; ++k) { - if (!((k =3D=3D PlaneWithMinActiveDRAMClockChangeMargin) && (BlendingAnd= Timing[k] =3D=3D k)) && !(BlendingAndTiming[k] =3D=3D PlaneWithMinActiveDRA= MClockChangeMargin) + for (k =3D 0; k < v->NumberOfActivePlanes; ++k) { + if (!((k =3D=3D PlaneWithMinActiveDRAMClockChangeMargin) && (v->Blending= AndTiming[k] =3D=3D k)) && !(v->BlendingAndTiming[k] =3D=3D PlaneWithMinAct= iveDRAMClockChangeMargin) && v->ActiveDRAMClockChangeLatencyMargin[k] < SecondMinActiveDRAMClock= ChangeMarginOneDisplayInVBLank) { SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank =3D v->ActiveDRA= MClockChangeLatencyMargin[k]; } @@ -5873,25 +5729,25 @@ static void CalculateWatermarksAndDRAMSpeedChangeSu= pport( =20 v->TotalNumberOfActiveOTG =3D 0; =20 - for (k =3D 0; k < NumberOfActivePlanes; ++k) { - if (BlendingAndTiming[k] =3D=3D k) { + for (k =3D 0; k < v->NumberOfActivePlanes; ++k) { + if (v->BlendingAndTiming[k] =3D=3D k) { v->TotalNumberOfActiveOTG =3D v->TotalNumberOfActiveOTG + 1; } } =20 if (v->MinActiveDRAMClockChangeMargin > 0 && PrefetchMode =3D=3D 0) { *DRAMClockChangeSupport =3D dm_dram_clock_change_vactive; - } else if ((SynchronizedVBlank =3D=3D true || v->TotalNumberOfActiveOTG = =3D=3D 1 + } else if ((v->SynchronizedVBlank =3D=3D true || v->TotalNumberOfActiveOT= G =3D=3D 1 || SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank > 0) && Prefe= tchMode =3D=3D 0) { *DRAMClockChangeSupport =3D dm_dram_clock_change_vblank; } else { *DRAMClockChangeSupport =3D dm_dram_clock_change_unsupported; } =20 - *StutterExitWatermark =3D SRExitTime + ExtraLatency + 10 / DCFCLKDeepSlee= p; - *StutterEnterPlusExitWatermark =3D (SREnterPlusExitTime + ExtraLatency + = 10 / DCFCLKDeepSleep); - *Z8StutterExitWatermark =3D SRExitZ8Time + ExtraLatency + 10 / DCFCLKDeep= Sleep; - *Z8StutterEnterPlusExitWatermark =3D SREnterPlusExitZ8Time + ExtraLatency= + 10 / DCFCLKDeepSleep; + *StutterExitWatermark =3D v->SRExitTime + ExtraLatency + 10 / DCFCLKDeepS= leep; + *StutterEnterPlusExitWatermark =3D (v->SREnterPlusExitTime + ExtraLatency= + 10 / DCFCLKDeepSleep); + *Z8StutterExitWatermark =3D v->SRExitZ8Time + ExtraLatency + 10 / DCFCLKD= eepSleep; + *Z8StutterEnterPlusExitWatermark =3D v->SREnterPlusExitZ8Time + ExtraLate= ncy + 10 / DCFCLKDeepSleep; =20 #ifdef __DML_VBA_DEBUG__ dml_print("DML::%s: StutterExitWatermark =3D %f\n", __func__, *StutterExi= tWatermark); --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A10EC32771 for ; Mon, 26 Sep 2022 12:00:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236747AbiIZMAl (ORCPT ); Mon, 26 Sep 2022 08:00:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238962AbiIZL5E (ORCPT ); Mon, 26 Sep 2022 07:57:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4867579A7B; Mon, 26 Sep 2022 03:51:32 -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 8229AB80171; Mon, 26 Sep 2022 10:50:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0E9DC433C1; Mon, 26 Sep 2022 10:50:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189422; bh=FtwDgHom7j0u6AGoS2AkrkclrI63h8CA0BZH3cF+vKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vquZUGPCYsHYx7n0SR6eL/XaL/iilFyS+04CVfIsZpiyA0LVP0k5gsEkbzVA3Po2c OIGJDS7w0RK5EZC6muUUBHtEjDzZr4zKas3LwdOE0ZzGVFPDHED99wnJWKJyf+v/8m 9wLOT6pGqsNK/0E0nTgqFRHprq/LPOjFUABq0Wxk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Sudip Mukherjee (Codethink)" , =?UTF-8?q?Ma=C3=ADra=20Canal?= , Rodrigo Siqueira , Nathan Chancellor , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 183/207] drm/amd/display: Reduce number of arguments of dml31s CalculateFlipSchedule() Date: Mon, 26 Sep 2022 12:12:52 +0200 Message-Id: <20220926100814.801813402@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Chancellor [ Upstream commit 21485d3da659b66c37d99071623af83ee1c6733d ] Most of the arguments are identical between the two call sites and they can be accessed through the 'struct vba_vars_st' pointer. This reduces the total amount of stack space that dml31_ModeSupportAndSystemConfigurationFull() uses by 112 bytes with LLVM 16 (1976 -> 1864), helping clear up the following clang warning: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn31/display_mode_vba_31.c:= 3908:6: error: stack frame size (2216) exceeds limit (2048) in 'dml31_ModeS= upportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than] void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib = *mode_lib) ^ 1 error generated. Link: https://github.com/ClangBuiltLinux/linux/issues/1681 Reported-by: "Sudip Mukherjee (Codethink)" Tested-by: Ma=C3=ADra Canal Reviewed-by: Rodrigo Siqueira Signed-off-by: Nathan Chancellor Signed-off-by: Rodrigo Siqueira Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- .../dc/dml/dcn31/display_mode_vba_31.c | 172 +++++------------- 1 file changed, 47 insertions(+), 125 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c= b/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c index 586825d85d66..40a672236198 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c @@ -261,33 +261,13 @@ static void CalculateRowBandwidth( =20 static void CalculateFlipSchedule( struct display_mode_lib *mode_lib, + unsigned int k, double HostVMInefficiencyFactor, double UrgentExtraLatency, double UrgentLatency, - unsigned int GPUVMMaxPageTableLevels, - bool HostVMEnable, - unsigned int HostVMMaxNonCachedPageTableLevels, - bool GPUVMEnable, - double HostVMMinPageSize, double PDEAndMetaPTEBytesPerFrame, double MetaRowBytes, - double DPTEBytesPerRow, - double BandwidthAvailableForImmediateFlip, - unsigned int TotImmediateFlipBytes, - enum source_format_class SourcePixelFormat, - double LineTime, - double VRatio, - double VRatioChroma, - double Tno_bw, - bool DCCEnable, - unsigned int dpte_row_height, - unsigned int meta_row_height, - unsigned int dpte_row_height_chroma, - unsigned int meta_row_height_chroma, - double *DestinationLinesToRequestVMInImmediateFlip, - double *DestinationLinesToRequestRowInImmediateFlip, - double *final_flip_bw, - bool *ImmediateFlipSupportedForPipe); + double DPTEBytesPerRow); static double CalculateWriteBackDelay( enum source_format_class WritebackPixelFormat, double WritebackHRatio, @@ -2878,33 +2858,13 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchPar= ametersWatermarksAndPerforman for (k =3D 0; k < v->NumberOfActivePlanes; ++k) { CalculateFlipSchedule( mode_lib, + k, HostVMInefficiencyFactor, v->UrgentExtraLatency, v->UrgentLatency, - v->GPUVMMaxPageTableLevels, - v->HostVMEnable, - v->HostVMMaxNonCachedPageTableLevels, - v->GPUVMEnable, - v->HostVMMinPageSize, v->PDEAndMetaPTEBytesFrame[k], v->MetaRowByte[k], - v->PixelPTEBytesPerRow[k], - v->BandwidthAvailableForImmediateFlip, - v->TotImmediateFlipBytes, - v->SourcePixelFormat[k], - v->HTotal[k] / v->PixelClock[k], - v->VRatio[k], - v->VRatioChroma[k], - v->Tno_bw[k], - v->DCCEnable[k], - v->dpte_row_height[k], - v->meta_row_height[k], - v->dpte_row_height_chroma[k], - v->meta_row_height_chroma[k], - &v->DestinationLinesToRequestVMInImmediateFlip[k], - &v->DestinationLinesToRequestRowInImmediateFlip[k], - &v->final_flip_bw[k], - &v->ImmediateFlipSupportedForPipe[k]); + v->PixelPTEBytesPerRow[k]); } =20 v->total_dcn_read_bw_with_flip =3D 0.0; @@ -3624,61 +3584,43 @@ static void CalculateRowBandwidth( =20 static void CalculateFlipSchedule( struct display_mode_lib *mode_lib, + unsigned int k, double HostVMInefficiencyFactor, double UrgentExtraLatency, double UrgentLatency, - unsigned int GPUVMMaxPageTableLevels, - bool HostVMEnable, - unsigned int HostVMMaxNonCachedPageTableLevels, - bool GPUVMEnable, - double HostVMMinPageSize, double PDEAndMetaPTEBytesPerFrame, double MetaRowBytes, - double DPTEBytesPerRow, - double BandwidthAvailableForImmediateFlip, - unsigned int TotImmediateFlipBytes, - enum source_format_class SourcePixelFormat, - double LineTime, - double VRatio, - double VRatioChroma, - double Tno_bw, - bool DCCEnable, - unsigned int dpte_row_height, - unsigned int meta_row_height, - unsigned int dpte_row_height_chroma, - unsigned int meta_row_height_chroma, - double *DestinationLinesToRequestVMInImmediateFlip, - double *DestinationLinesToRequestRowInImmediateFlip, - double *final_flip_bw, - bool *ImmediateFlipSupportedForPipe) + double DPTEBytesPerRow) { + struct vba_vars_st *v =3D &mode_lib->vba; double min_row_time =3D 0.0; unsigned int HostVMDynamicLevelsTrips; double TimeForFetchingMetaPTEImmediateFlip; double TimeForFetchingRowInVBlankImmediateFlip; double ImmediateFlipBW; + double LineTime =3D v->HTotal[k] / v->PixelClock[k]; =20 - if (GPUVMEnable =3D=3D true && HostVMEnable =3D=3D true) { - HostVMDynamicLevelsTrips =3D HostVMMaxNonCachedPageTableLevels; + if (v->GPUVMEnable =3D=3D true && v->HostVMEnable =3D=3D true) { + HostVMDynamicLevelsTrips =3D v->HostVMMaxNonCachedPageTableLevels; } else { HostVMDynamicLevelsTrips =3D 0; } =20 - if (GPUVMEnable =3D=3D true || DCCEnable =3D=3D true) { - ImmediateFlipBW =3D (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEByt= esPerRow) * BandwidthAvailableForImmediateFlip / TotImmediateFlipBytes; + if (v->GPUVMEnable =3D=3D true || v->DCCEnable[k] =3D=3D true) { + ImmediateFlipBW =3D (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEByt= esPerRow) * v->BandwidthAvailableForImmediateFlip / v->TotImmediateFlipByte= s; } =20 - if (GPUVMEnable =3D=3D true) { + if (v->GPUVMEnable =3D=3D true) { TimeForFetchingMetaPTEImmediateFlip =3D dml_max3( - Tno_bw + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / Immed= iateFlipBW, - UrgentExtraLatency + UrgentLatency * (GPUVMMaxPageTableLevels * (HostV= MDynamicLevelsTrips + 1) - 1), + v->Tno_bw[k] + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor /= ImmediateFlipBW, + UrgentExtraLatency + UrgentLatency * (v->GPUVMMaxPageTableLevels * (Ho= stVMDynamicLevelsTrips + 1) - 1), LineTime / 4.0); } else { TimeForFetchingMetaPTEImmediateFlip =3D 0; } =20 - *DestinationLinesToRequestVMInImmediateFlip =3D dml_ceil(4.0 * (TimeForFe= tchingMetaPTEImmediateFlip / LineTime), 1) / 4.0; - if ((GPUVMEnable =3D=3D true || DCCEnable =3D=3D true)) { + v->DestinationLinesToRequestVMInImmediateFlip[k] =3D dml_ceil(4.0 * (Time= ForFetchingMetaPTEImmediateFlip / LineTime), 1) / 4.0; + if ((v->GPUVMEnable =3D=3D true || v->DCCEnable[k] =3D=3D true)) { TimeForFetchingRowInVBlankImmediateFlip =3D dml_max3( (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / Immediat= eFlipBW, UrgentLatency * (HostVMDynamicLevelsTrips + 1), @@ -3687,54 +3629,54 @@ static void CalculateFlipSchedule( TimeForFetchingRowInVBlankImmediateFlip =3D 0; } =20 - *DestinationLinesToRequestRowInImmediateFlip =3D dml_ceil(4.0 * (TimeForF= etchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0; + v->DestinationLinesToRequestRowInImmediateFlip[k] =3D dml_ceil(4.0 * (Tim= eForFetchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0; =20 - if (GPUVMEnable =3D=3D true) { - *final_flip_bw =3D dml_max( - PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (*DestinationL= inesToRequestVMInImmediateFlip * LineTime), - (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (*Destin= ationLinesToRequestRowInImmediateFlip * LineTime)); - } else if ((GPUVMEnable =3D=3D true || DCCEnable =3D=3D true)) { - *final_flip_bw =3D (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyF= actor) / (*DestinationLinesToRequestRowInImmediateFlip * LineTime); + if (v->GPUVMEnable =3D=3D true) { + v->final_flip_bw[k] =3D dml_max( + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (v->Destinatio= nLinesToRequestVMInImmediateFlip[k] * LineTime), + (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (v->Dest= inationLinesToRequestRowInImmediateFlip[k] * LineTime)); + } else if ((v->GPUVMEnable =3D=3D true || v->DCCEnable[k] =3D=3D true)) { + v->final_flip_bw[k] =3D (MetaRowBytes + DPTEBytesPerRow * HostVMIneffici= encyFactor) / (v->DestinationLinesToRequestRowInImmediateFlip[k] * LineTime= ); } else { - *final_flip_bw =3D 0; + v->final_flip_bw[k] =3D 0; } =20 - if (SourcePixelFormat =3D=3D dm_420_8 || SourcePixelFormat =3D=3D dm_420_= 10 || SourcePixelFormat =3D=3D dm_rgbe_alpha) { - if (GPUVMEnable =3D=3D true && DCCEnable !=3D true) { - min_row_time =3D dml_min(dpte_row_height * LineTime / VRatio, dpte_row_= height_chroma * LineTime / VRatioChroma); - } else if (GPUVMEnable !=3D true && DCCEnable =3D=3D true) { - min_row_time =3D dml_min(meta_row_height * LineTime / VRatio, meta_row_= height_chroma * LineTime / VRatioChroma); + if (v->SourcePixelFormat[k] =3D=3D dm_420_8 || v->SourcePixelFormat[k] = =3D=3D dm_420_10 || v->SourcePixelFormat[k] =3D=3D dm_rgbe_alpha) { + if (v->GPUVMEnable =3D=3D true && v->DCCEnable[k] !=3D true) { + min_row_time =3D dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k= ], v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k]); + } else if (v->GPUVMEnable !=3D true && v->DCCEnable[k] =3D=3D true) { + min_row_time =3D dml_min(v->meta_row_height[k] * LineTime / v->VRatio[k= ], v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]); } else { min_row_time =3D dml_min4( - dpte_row_height * LineTime / VRatio, - meta_row_height * LineTime / VRatio, - dpte_row_height_chroma * LineTime / VRatioChroma, - meta_row_height_chroma * LineTime / VRatioChroma); + v->dpte_row_height[k] * LineTime / v->VRatio[k], + v->meta_row_height[k] * LineTime / v->VRatio[k], + v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k], + v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]); } } else { - if (GPUVMEnable =3D=3D true && DCCEnable !=3D true) { - min_row_time =3D dpte_row_height * LineTime / VRatio; - } else if (GPUVMEnable !=3D true && DCCEnable =3D=3D true) { - min_row_time =3D meta_row_height * LineTime / VRatio; + if (v->GPUVMEnable =3D=3D true && v->DCCEnable[k] !=3D true) { + min_row_time =3D v->dpte_row_height[k] * LineTime / v->VRatio[k]; + } else if (v->GPUVMEnable !=3D true && v->DCCEnable[k] =3D=3D true) { + min_row_time =3D v->meta_row_height[k] * LineTime / v->VRatio[k]; } else { - min_row_time =3D dml_min(dpte_row_height * LineTime / VRatio, meta_row_= height * LineTime / VRatio); + min_row_time =3D dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k= ], v->meta_row_height[k] * LineTime / v->VRatio[k]); } } =20 - if (*DestinationLinesToRequestVMInImmediateFlip >=3D 32 || *DestinationLi= nesToRequestRowInImmediateFlip >=3D 16 + if (v->DestinationLinesToRequestVMInImmediateFlip[k] >=3D 32 || v->Destin= ationLinesToRequestRowInImmediateFlip[k] >=3D 16 || TimeForFetchingMetaPTEImmediateFlip + 2 * TimeForFetchingRowInVBlank= ImmediateFlip > min_row_time) { - *ImmediateFlipSupportedForPipe =3D false; + v->ImmediateFlipSupportedForPipe[k] =3D false; } else { - *ImmediateFlipSupportedForPipe =3D true; + v->ImmediateFlipSupportedForPipe[k] =3D true; } =20 #ifdef __DML_VBA_DEBUG__ - dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip =3D %f\n",= __func__, *DestinationLinesToRequestVMInImmediateFlip); - dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip =3D %f\n"= , __func__, *DestinationLinesToRequestRowInImmediateFlip); + dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip =3D %f\n",= __func__, v->DestinationLinesToRequestVMInImmediateFlip[k]); + dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip =3D %f\n"= , __func__, v->DestinationLinesToRequestRowInImmediateFlip[k]); dml_print("DML::%s: TimeForFetchingMetaPTEImmediateFlip =3D %f\n", __func= __, TimeForFetchingMetaPTEImmediateFlip); dml_print("DML::%s: TimeForFetchingRowInVBlankImmediateFlip =3D %f\n", __= func__, TimeForFetchingRowInVBlankImmediateFlip); dml_print("DML::%s: min_row_time =3D %f\n", __func__, min_row_time); - dml_print("DML::%s: ImmediateFlipSupportedForPipe =3D %d\n", __func__, *I= mmediateFlipSupportedForPipe); + dml_print("DML::%s: ImmediateFlipSupportedForPipe =3D %d\n", __func__, v-= >ImmediateFlipSupportedForPipe[k]); #endif =20 } @@ -5325,33 +5267,13 @@ void dml31_ModeSupportAndSystemConfigurationFull(st= ruct display_mode_lib *mode_l for (k =3D 0; k < v->NumberOfActivePlanes; k++) { CalculateFlipSchedule( mode_lib, + k, HostVMInefficiencyFactor, v->ExtraLatency, v->UrgLatency[i], - v->GPUVMMaxPageTableLevels, - v->HostVMEnable, - v->HostVMMaxNonCachedPageTableLevels, - v->GPUVMEnable, - v->HostVMMinPageSize, v->PDEAndMetaPTEBytesPerFrame[i][j][k], v->MetaRowBytes[i][j][k], - v->DPTEBytesPerRow[i][j][k], - v->BandwidthAvailableForImmediateFlip, - v->TotImmediateFlipBytes, - v->SourcePixelFormat[k], - v->HTotal[k] / v->PixelClock[k], - v->VRatio[k], - v->VRatioChroma[k], - v->Tno_bw[k], - v->DCCEnable[k], - v->dpte_row_height[k], - v->meta_row_height[k], - v->dpte_row_height_chroma[k], - v->meta_row_height_chroma[k], - &v->DestinationLinesToRequestVMInImmediateFlip[k], - &v->DestinationLinesToRequestRowInImmediateFlip[k], - &v->final_flip_bw[k], - &v->ImmediateFlipSupportedForPipe[k]); + v->DPTEBytesPerRow[i][j][k]); } v->total_dcn_read_bw_with_flip =3D 0.0; for (k =3D 0; k < v->NumberOfActivePlanes; k++) { --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 928C4C07E9D for ; Mon, 26 Sep 2022 11:57:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239079AbiIZL5p (ORCPT ); Mon, 26 Sep 2022 07:57:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239205AbiIZLyu (ORCPT ); Mon, 26 Sep 2022 07:54:50 -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 9C10B785AB; Mon, 26 Sep 2022 03:50: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 dfw.source.kernel.org (Postfix) with ESMTPS id 93F8E60B2F; Mon, 26 Sep 2022 10:50:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6851C433D6; Mon, 26 Sep 2022 10:50:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189425; bh=zcF7iAfpBljxrp6SL+VwuiFaA9Cu7r63gUi7FJYR51M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ANSkJR0UOe2QgAujfFVM5bbOkjSUpqRfDI7QxQ3GbDkjGzrHVsLVX6CLKQrK1HVHo TYCdR4TQmxjN0FaW9JtjS56jrT6x9VnHly4oWCEI4B03igwnmW7ZS/tSnbrRQK/Dt7 5ohEuuVOVzBHoD8bd7uW2c8pBEfEdAnzykBrvoS8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Sudip Mukherjee (Codethink)" , =?UTF-8?q?Ma=C3=ADra=20Canal?= , Rodrigo Siqueira , Nathan Chancellor , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 184/207] drm/amd/display: Mark dml30s UseMinimumDCFCLK() as noinline for stack usage Date: Mon, 26 Sep 2022 12:12:53 +0200 Message-Id: <20220926100814.842720755@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Chancellor [ Upstream commit 41012d715d5d7b9751ae84b8fb255e404ac9c5d0 ] This function consumes a lot of stack space and it blows up the size of dml30_ModeSupportAndSystemConfigurationFull() with clang: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:= 3542:6: error: stack frame size (2200) exceeds limit (2048) in 'dml30_ModeS= upportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than] void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib = *mode_lib) ^ 1 error generated. Commit a0f7e7f759cf ("drm/amd/display: fix i386 frame size warning") aimed to address this for i386 but it did not help x86_64. To reduce the amount of stack space that dml30_ModeSupportAndSystemConfigurationFull() uses, mark UseMinimumDCFCLK() as noinline, using the _for_stack variant for documentation. While this will increase the total amount of stack usage between the two functions (1632 and 1304 bytes respectively), it will make sure both stay below the limit of 2048 bytes for these files. The aforementioned change does help reduce UseMinimumDCFCLK()'s stack usage so it should not be reverted in favor of this change. Link: https://github.com/ClangBuiltLinux/linux/issues/1681 Reported-by: "Sudip Mukherjee (Codethink)" Tested-by: Ma=C3=ADra Canal Reviewed-by: Rodrigo Siqueira Signed-off-by: Nathan Chancellor Signed-off-by: Rodrigo Siqueira Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c= b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c index f47d82da115c..42a567e71439 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c @@ -6651,8 +6651,7 @@ static double CalculateUrgentLatency( return ret; } =20 - -static void UseMinimumDCFCLK( +static noinline_for_stack void UseMinimumDCFCLK( struct display_mode_lib *mode_lib, int MaxInterDCNTileRepeaters, int MaxPrefetchMode, --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65D07C32771 for ; Mon, 26 Sep 2022 12:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239118AbiIZL77 (ORCPT ); Mon, 26 Sep 2022 07:59:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238569AbiIZL4I (ORCPT ); Mon, 26 Sep 2022 07:56:08 -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 70D947A500; Mon, 26 Sep 2022 03:51:29 -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 C7D9CB80925; Mon, 26 Sep 2022 10:50:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BF5CC433C1; Mon, 26 Sep 2022 10:50:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189430; bh=EOo8A0LNKB9v3Vdh0DEnHZtQ+go5c6JO/8RMY50XP14=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hpMXDidzgQwh39ZVU7ilHrmKEKOIZwQopsLywsS8Spg1bxqLyAuosyiGtrz7d/mV8 WMdnPgs35TDGh43OoLSW1qc6an5+p0I/BiE3/tijLdbNF74/Nqa19zTMyULElylWg+ o7lrooR4Q/6Q5bJRS+RDLkLV1BaSTTODPynuAEyc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , llvm@lists.linux.dev, Nathan Huckleberry , Nathan Chancellor , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.19 185/207] drm/rockchip: Fix return type of cdn_dp_connector_mode_valid Date: Mon, 26 Sep 2022 12:12:54 +0200 Message-Id: <20220926100814.892864169@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nathan Huckleberry [ Upstream commit b0b9408f132623dc88e78adb5282f74e4b64bb57 ] The mode_valid field in drm_connector_helper_funcs is expected to be of type: enum drm_mode_status (* mode_valid) (struct drm_connector *connector, struct drm_display_mode *mode); The mismatched return type breaks forward edge kCFI since the underlying function definition does not match the function hook definition. The return type of cdn_dp_connector_mode_valid should be changed from int to enum drm_mode_status. Reported-by: Dan Carpenter Link: https://github.com/ClangBuiltLinux/linux/issues/1703 Cc: llvm@lists.linux.dev Signed-off-by: Nathan Huckleberry Reviewed-by: Nathan Chancellor Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/20220913205555.155149-1= -nhuck@google.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/rockchip/cdn-dp-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockc= hip/cdn-dp-core.c index c204e9b95c1f..518ee13b1d6f 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -283,8 +283,9 @@ static int cdn_dp_connector_get_modes(struct drm_connec= tor *connector) return ret; } =20 -static int cdn_dp_connector_mode_valid(struct drm_connector *connector, - struct drm_display_mode *mode) +static enum drm_mode_status +cdn_dp_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) { struct cdn_dp_device *dp =3D connector_to_dp(connector); struct drm_display_info *display_info =3D &dp->connector.display_info; --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F37C4C6FA83 for ; Mon, 26 Sep 2022 11:57:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238333AbiIZL5h (ORCPT ); Mon, 26 Sep 2022 07:57:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239202AbiIZLyu (ORCPT ); Mon, 26 Sep 2022 07:54:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79D5E786D5; Mon, 26 Sep 2022 03:50:34 -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 1DEE860AF3; Mon, 26 Sep 2022 10:50:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30EAFC433D7; Mon, 26 Sep 2022 10:50:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189433; bh=ltWOdhCi4WgafmHd2YL/5444t2bzTYe2PF/tCbDgrRY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LpK1ApOv8qWYb3YkX1EZhVRYsEaj0FKbUfpROOd2v5ohm20hB/jN7RIMfxQc8tQHL qx4KlaXn3qIzFOgfIzyHr/pb7lxPUgS1L3P/CpzD0pdZkZsXyTudUcg5+dNRN7VQoE 1/XtAkZHA83aldCUUpuoljY9hA7OghYcP2x9/cEY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= , Sergio Paracuellos , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.19 186/207] gpio: mt7621: Make the irqchip immutable Date: Mon, 26 Sep 2022 12:12:55 +0200 Message-Id: <20220926100814.939982732@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergio Paracuellos [ Upstream commit 09eed5a1ed3c752892663976837eb4244c2f1984 ] Commit 6c846d026d49 ("gpio: Don't fiddle with irqchips marked as immutable") added a warning to indicate if the gpiolib is altering the internals of irqchips. Following this change the following warnings are now observed for the mt7621 driver: gpio gpiochip0: (1e000600.gpio-bank0): not an immutable chip, please consid= er fixing it! gpio gpiochip1: (1e000600.gpio-bank1): not an immutable chip, please consid= er fixing it! gpio gpiochip2: (1e000600.gpio-bank2): not an immutable chip, please consid= er fixing it! Fix this by making the irqchip in the mt7621 driver immutable. Tested-by: Ar=C4=B1n=C3=A7 =C3=9CNAL Signed-off-by: Sergio Paracuellos Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpio/gpio-mt7621.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpio-mt7621.c b/drivers/gpio/gpio-mt7621.c index d8a26e503ca5..f163f5ca857b 100644 --- a/drivers/gpio/gpio-mt7621.c +++ b/drivers/gpio/gpio-mt7621.c @@ -112,6 +112,8 @@ mediatek_gpio_irq_unmask(struct irq_data *d) unsigned long flags; u32 rise, fall, high, low; =20 + gpiochip_enable_irq(gc, d->hwirq); + spin_lock_irqsave(&rg->lock, flags); rise =3D mtk_gpio_r32(rg, GPIO_REG_REDGE); fall =3D mtk_gpio_r32(rg, GPIO_REG_FEDGE); @@ -143,6 +145,8 @@ mediatek_gpio_irq_mask(struct irq_data *d) mtk_gpio_w32(rg, GPIO_REG_HLVL, high & ~BIT(pin)); mtk_gpio_w32(rg, GPIO_REG_LLVL, low & ~BIT(pin)); spin_unlock_irqrestore(&rg->lock, flags); + + gpiochip_disable_irq(gc, d->hwirq); } =20 static int @@ -204,6 +208,16 @@ mediatek_gpio_xlate(struct gpio_chip *chip, return gpio % MTK_BANK_WIDTH; } =20 +static const struct irq_chip mt7621_irq_chip =3D { + .name =3D "mt7621-gpio", + .irq_mask_ack =3D mediatek_gpio_irq_mask, + .irq_mask =3D mediatek_gpio_irq_mask, + .irq_unmask =3D mediatek_gpio_irq_unmask, + .irq_set_type =3D mediatek_gpio_irq_type, + .flags =3D IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + static int mediatek_gpio_bank_probe(struct device *dev, int bank) { @@ -238,11 +252,6 @@ mediatek_gpio_bank_probe(struct device *dev, int bank) return -ENOMEM; =20 rg->chip.offset =3D bank * MTK_BANK_WIDTH; - rg->irq_chip.name =3D dev_name(dev); - rg->irq_chip.irq_unmask =3D mediatek_gpio_irq_unmask; - rg->irq_chip.irq_mask =3D mediatek_gpio_irq_mask; - rg->irq_chip.irq_mask_ack =3D mediatek_gpio_irq_mask; - rg->irq_chip.irq_set_type =3D mediatek_gpio_irq_type; =20 if (mtk->gpio_irq) { struct gpio_irq_chip *girq; @@ -262,7 +271,7 @@ mediatek_gpio_bank_probe(struct device *dev, int bank) } =20 girq =3D &rg->chip.irq; - girq->chip =3D &rg->irq_chip; + gpio_irq_chip_set_chip(girq, &mt7621_irq_chip); /* This will let us handle the parent IRQ in the driver */ girq->parent_handler =3D NULL; girq->num_parents =3D 0; --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90784C6FA83 for ; Mon, 26 Sep 2022 11:59:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239038AbiIZL72 (ORCPT ); Mon, 26 Sep 2022 07:59:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238275AbiIZL4F (ORCPT ); Mon, 26 Sep 2022 07:56:05 -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 0F1EC79EF1; Mon, 26 Sep 2022 03:51:27 -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 AA25BB801BF; Mon, 26 Sep 2022 10:50:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07438C433D6; Mon, 26 Sep 2022 10:50:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189436; bh=ta6WOsgekpI1LcjSNwrf+fIaiHq0dPDmyVFgINRy+pA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uLZnjgQFzM4Dhht1dVVt6pCh4ojF/QQ7svuTkqAa/vAoxUfkQsQrM7z0+Z1mXcZRG LnlAfh9QiwqVZ6dF1L6uvkmyiArCRa2bBtP3L0pY7hlY8KO//VRG5PGa7Ybwtv+09J A9LEFKpvJFKxLoSCDZdLVSfh7f8hmpUeP1LbBn3A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Jane Chu , Christoph Hellwig , Dan Williams , Sasha Levin Subject: [PATCH 5.19 187/207] pmem: fix a name collision Date: Mon, 26 Sep 2022 12:12:56 +0200 Message-Id: <20220926100814.986280270@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jane Chu [ Upstream commit 149d17140bcedc906082c4f874dec98b1ffc5a90 ] Kernel test robot detected name collision when compiled on 'um' architecture. Rename "to_phys()" to "pmem_to_phys()". >> drivers/nvdimm/pmem.c:48:20: error: conflicting types for 'to_phys'; hav= e 'phys_addr_t(struct pmem_device *, phys_addr_t)' {aka 'long long unsigned= int(struct pmem_device *, long long unsigned int)'} 48 | static phys_addr_t to_phys(struct pmem_device *pmem, phys_addr_t= offset) | ^~~~~~~ In file included from arch/um/include/asm/page.h:98, from arch/um/include/asm/thread_info.h:15, from include/linux/thread_info.h:60, from include/asm-generic/preempt.h:5, from ./arch/um/include/generated/asm/preempt.h:1, arch/um/include/shared/mem.h:12:29: note: previous definition of 'to_phy= s' with type 'long unsigned int(void *)' 12 | static inline unsigned long to_phys(void *virt) | ^~~~~~~ vim +48 drivers/nvdimm/pmem.c 47 > 48 static phys_addr_t to_phys(struct pmem_device *pmem, phys_addr_t off= set) 49 { 50 return pmem->phys_addr + offset; 51 } 52 Fixes: 9409c9b6709e (pmem: refactor pmem_clear_poison()) Reported-by: kernel test robot Signed-off-by: Jane Chu Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20220630182802.3250449-1-jane.chu@oracle.com Signed-off-by: Dan Williams Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/nvdimm/pmem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 629d10fcf53b..b9f1a8e9f88c 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -45,7 +45,7 @@ static struct nd_region *to_region(struct pmem_device *pm= em) return to_nd_region(to_dev(pmem)->parent); } =20 -static phys_addr_t to_phys(struct pmem_device *pmem, phys_addr_t offset) +static phys_addr_t pmem_to_phys(struct pmem_device *pmem, phys_addr_t offs= et) { return pmem->phys_addr + offset; } @@ -63,7 +63,7 @@ static phys_addr_t to_offset(struct pmem_device *pmem, se= ctor_t sector) static void pmem_mkpage_present(struct pmem_device *pmem, phys_addr_t offs= et, unsigned int len) { - phys_addr_t phys =3D to_phys(pmem, offset); + phys_addr_t phys =3D pmem_to_phys(pmem, offset); unsigned long pfn_start, pfn_end, pfn; =20 /* only pmem in the linear map supports HWPoison */ @@ -97,7 +97,7 @@ static void pmem_clear_bb(struct pmem_device *pmem, secto= r_t sector, long blks) static long __pmem_clear_poison(struct pmem_device *pmem, phys_addr_t offset, unsigned int len) { - phys_addr_t phys =3D to_phys(pmem, offset); + phys_addr_t phys =3D pmem_to_phys(pmem, offset); long cleared =3D nvdimm_clear_poison(to_dev(pmem), phys, len); =20 if (cleared > 0) { --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB3FCC32771 for ; Mon, 26 Sep 2022 12:01:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238242AbiIZMB3 (ORCPT ); Mon, 26 Sep 2022 08:01:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238929AbiIZL6W (ORCPT ); Mon, 26 Sep 2022 07:58:22 -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 C380D7B2A3; Mon, 26 Sep 2022 03:52:11 -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 0AC4D60AF3; Mon, 26 Sep 2022 10:50:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C4F1C433D7; Mon, 26 Sep 2022 10:50:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189439; bh=Ut33842hwx4a/yaziEGJ5m5FGmvxrtCCOxpdvH3Jrog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DIBZC7YSGQRxeUG4D2QGCezfb8uXQH62YZsLoPyKEaUfI7dE2ffXYl45LYJxHOmFi h4pMwqzq3htNaHbmoApoZtYzCb8o00erHvv6qSWaHO8H88uSclrGCiIp/PSz+iP2wG Oi6CNJsyoIsWLqgok59Crcl0BAa3mzsf8YvUmkVQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Jinlin , "Darrick J. Wong" , Dan Williams , Sasha Levin Subject: [PATCH 5.19 188/207] fsdax: Fix infinite loop in dax_iomap_rw() Date: Mon, 26 Sep 2022 12:12:57 +0200 Message-Id: <20220926100815.032294339@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Li Jinlin [ Upstream commit 17d9c15c9b9e7fb285f7ac5367dfb5f00ff575e3 ] I got an infinite loop and a WARNING report when executing a tail command in virtiofs. WARNING: CPU: 10 PID: 964 at fs/iomap/iter.c:34 iomap_iter+0x3a2/0x3d0 Modules linked in: CPU: 10 PID: 964 Comm: tail Not tainted 5.19.0-rc7 Call Trace: dax_iomap_rw+0xea/0x620 ? __this_cpu_preempt_check+0x13/0x20 fuse_dax_read_iter+0x47/0x80 fuse_file_read_iter+0xae/0xd0 new_sync_read+0xfe/0x180 ? 0xffffffff81000000 vfs_read+0x14d/0x1a0 ksys_read+0x6d/0xf0 __x64_sys_read+0x1a/0x20 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd The tail command will call read() with a count of 0. In this case, iomap_iter() will report this WARNING, and always return 1 which casuing the infinite loop in dax_iomap_rw(). Fixing by checking count whether is 0 in dax_iomap_rw(). Fixes: ca289e0b95af ("fsdax: switch dax_iomap_rw to use iomap_iter") Signed-off-by: Li Jinlin Reviewed-by: Darrick J. Wong Link: https://lore.kernel.org/r/20220725032050.3873372-1-lijinlin3@huawei.c= om Signed-off-by: Dan Williams Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/dax.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/dax.c b/fs/dax.c index 4155a6107fa1..7ab248ed21aa 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -1241,6 +1241,9 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *ite= r, loff_t done =3D 0; int ret; =20 + if (!iomi.len) + return 0; + if (iov_iter_rw(iter) =3D=3D WRITE) { lockdep_assert_held_write(&iomi.inode->i_rwsem); iomi.flags |=3D IOMAP_WRITE; --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76D9FC32771 for ; Mon, 26 Sep 2022 12:01:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239227AbiIZMBO (ORCPT ); Mon, 26 Sep 2022 08:01:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238244AbiIZL5f (ORCPT ); Mon, 26 Sep 2022 07:57:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EB077AC21; Mon, 26 Sep 2022 03:51: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 C22F960A55; Mon, 26 Sep 2022 10:50:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3CDFC433C1; Mon, 26 Sep 2022 10:50:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189442; bh=iBEv28YXbxo+cUe3FhyzyxG21m501nMtoBPjMrC11p8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bV5VMspjyMZV7ORvbIXWxW/OsOmA/wMZPTCB8pMzwaX0RwitMSblKlj8Uwu7APHcV lRyavYsRKNcHISu2VTv++UJvgvdFXk3MG1XBi9Lv9CpA4e9fMuEviq2LpvE7FfCvwi +YglYeDa2MPloW4tB+3KOFgvXmoxkm31cwyVlHm0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hillf Danton , Lai Jiangshan , Johannes Berg , Tetsuo Handa , Tejun Heo , Sasha Levin Subject: [PATCH 5.19 189/207] workqueue: dont skip lockdep work dependency in cancel_work_sync() Date: Mon, 26 Sep 2022 12:12:58 +0200 Message-Id: <20220926100815.074288435@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tetsuo Handa [ Upstream commit c0feea594e058223973db94c1c32a830c9807c86 ] Like Hillf Danton mentioned syzbot should have been able to catch cancel_work_sync() in work context by checking lockdep_map in __flush_work() for both flush and cancel. in [1], being unable to report an obvious deadlock scenario shown below is broken. From locking dependency perspective, sync version of cancel request should behave as if flush request, for it waits for completion of work if that work has already started execution. ---------- #include #include static DEFINE_MUTEX(mutex); static void work_fn(struct work_struct *work) { schedule_timeout_uninterruptible(HZ / 5); mutex_lock(&mutex); mutex_unlock(&mutex); } static DECLARE_WORK(work, work_fn); static int __init test_init(void) { schedule_work(&work); schedule_timeout_uninterruptible(HZ / 10); mutex_lock(&mutex); cancel_work_sync(&work); mutex_unlock(&mutex); return -EINVAL; } module_init(test_init); MODULE_LICENSE("GPL"); ---------- The check this patch restores was added by commit 0976dfc1d0cd80a4 ("workqueue: Catch more locking problems with flush_work()"). Then, lockdep's crossrelease feature was added by commit b09be676e0ff25bd ("locking/lockdep: Implement the 'crossrelease' feature"). As a result, this check was once removed by commit fd1a5b04dfb899f8 ("workqueue: Remove now redundant lock acquisitions wrt. workqueue flushes"). But lockdep's crossrelease feature was removed by commit e966eaeeb623f099 ("locking/lockdep: Remove the cross-release locking checks"). At this point, this check should have been restored. Then, commit d6e89786bed977f3 ("workqueue: skip lockdep wq dependency in cancel_work_sync()") introduced a boolean flag in order to distinguish flush_work() and cancel_work_sync(), for checking "struct workqueue_struct" dependency when called from cancel_work_sync() was causing false positives. Then, commit 87915adc3f0acdf0 ("workqueue: re-add lockdep dependencies for flushing") tried to restore "struct work_struct" dependency check, but by error checked this boolean flag. Like an example shown above indicates, "struct work_struct" dependency needs to be checked for both flush_work() and cancel_work_sync(). Link: https://lkml.kernel.org/r/20220504044800.4966-1-hdanton@sina.com [1] Reported-by: Hillf Danton Suggested-by: Lai Jiangshan Fixes: 87915adc3f0acdf0 ("workqueue: re-add lockdep dependencies for flushi= ng") Cc: Johannes Berg Signed-off-by: Tetsuo Handa Signed-off-by: Tejun Heo Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- kernel/workqueue.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index aa8a82bc6738..fc6e4f252345 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -3066,10 +3066,8 @@ static bool __flush_work(struct work_struct *work, b= ool from_cancel) if (WARN_ON(!work->func)) return false; =20 - if (!from_cancel) { - lock_map_acquire(&work->lockdep_map); - lock_map_release(&work->lockdep_map); - } + lock_map_acquire(&work->lockdep_map); + lock_map_release(&work->lockdep_map); =20 if (start_flush_work(work, &barr, from_cancel)) { wait_for_completion(&barr.done); --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F387BC6FA86 for ; Mon, 26 Sep 2022 11:59:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239233AbiIZL6f (ORCPT ); Mon, 26 Sep 2022 07:58:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239343AbiIZLzQ (ORCPT ); Mon, 26 Sep 2022 07:55:16 -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 EFC265850A; Mon, 26 Sep 2022 03:50: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 dfw.source.kernel.org (Postfix) with ESMTPS id A4C4760C84; Mon, 26 Sep 2022 10:50:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B03F7C433C1; Mon, 26 Sep 2022 10:50:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189445; bh=Ka5PaCCHQrmEX4KQM/pycNos7zvlpFKjn3hje8kJk5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PsjnYkMoXG3t/AQ1EaOPRhSz6IHYAvozNDV5Pxnu/pzzaHiw3gnZAX0rXAmL/Z/IU rUpVlgSbGgroJ4Kj2ctjHeXyxFBwklw61RTdQY0fMsFnMQQn8LIV2nVzr85gSq31V0 8J4piza5UpxzPvz+dY4GIMYjzHK5x5zpAJmpfFEA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Oleksij Rempel , Wolfram Sang , Sasha Levin Subject: [PATCH 5.19 190/207] i2c: imx: If pm_runtime_get_sync() returned 1 device access is possible Date: Mon, 26 Sep 2022 12:12:59 +0200 Message-Id: <20220926100815.121146290@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 085aacaa73163f4b8a89dec24ecb32cfacd34017 ] pm_runtime_get_sync() returning 1 also means the device is powered. So resetting the chip registers in .remove() is possible and should be done. Reported-by: Dan Carpenter Fixes: d98bdd3a5b50 ("i2c: imx: Make sure to unregister adapter on remove()= ") Signed-off-by: Uwe Kleine-K=C3=B6nig Acked-by: Oleksij Rempel Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/i2c/busses/i2c-imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index e47fa3465671..3082183bd66a 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -1583,7 +1583,7 @@ static int i2c_imx_remove(struct platform_device *pde= v) if (i2c_imx->dma) i2c_imx_dma_free(i2c_imx); =20 - if (ret =3D=3D 0) { + if (ret >=3D 0) { /* setup chip registers to defaults */ imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IADR); imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IFDR); --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F1A5C6FA93 for ; Mon, 26 Sep 2022 11:59:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239278AbiIZL6l (ORCPT ); Mon, 26 Sep 2022 07:58:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239360AbiIZLzT (ORCPT ); Mon, 26 Sep 2022 07:55:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2D88792D8; Mon, 26 Sep 2022 03:50: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 dfw.source.kernel.org (Postfix) with ESMTPS id 669C560AD6; Mon, 26 Sep 2022 10:50:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76EA0C433C1; Mon, 26 Sep 2022 10:50:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189447; bh=wTrXeuY4sF/nmZ4OEG26edgOn2fk8co8QKNhySMR+Ws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QYfswLxGGB7sB/knENRhT/HUi2VzA2rMCeM6+IYSuHtxKQgjGeYBCA966w9qPFZS8 a4EhEAZbyq68f7w+n94KHEQlLwPAQLxyWBtwVwpggnuulTvCpCOXAj4WBwTG1aEuXl qg1fWYeZ1Ct2PrE075wFsa6fQf7KrRbAt6M+nkNI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Khalil Blaiech , Asmaa Mnebhi , Wolfram Sang , Sasha Levin Subject: [PATCH 5.19 191/207] i2c: mlxbf: incorrect base address passed during io write Date: Mon, 26 Sep 2022 12:13:00 +0200 Message-Id: <20220926100815.157819838@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Asmaa Mnebhi [ Upstream commit 2a5be6d1340c0fefcee8a6489cff7fd88a0d5b85 ] Correct the base address used during io write. This bug had no impact over the overall functionality of the read and write transactions. MLXBF_I2C_CAUSE_OR_CLEAR=3D0x18 so writing to (smbus->io + 0x= 18) instead of (mst_cause->ioi + 0x18) actually writes to the sc_low_timeout register which just sets the timeout value before a read/write aborts. Fixes: b5b5b32081cd206b (i2c: mlxbf: I2C SMBus driver for Mellanox BlueFiel= d SoC) Reviewed-by: Khalil Blaiech Signed-off-by: Asmaa Mnebhi Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/i2c/busses/i2c-mlxbf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c index 8716032f030a..612736906440 100644 --- a/drivers/i2c/busses/i2c-mlxbf.c +++ b/drivers/i2c/busses/i2c-mlxbf.c @@ -669,7 +669,7 @@ static int mlxbf_i2c_smbus_enable(struct mlxbf_i2c_priv= *priv, u8 slave, /* Clear status bits. */ writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_STATUS); /* Set the cause data. */ - writel(~0x0, priv->smbus->io + MLXBF_I2C_CAUSE_OR_CLEAR); + writel(~0x0, priv->mst_cause->io + MLXBF_I2C_CAUSE_OR_CLEAR); /* Zero PEC byte. */ writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_PEC); /* Zero byte count. */ --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4010C07E9D for ; Mon, 26 Sep 2022 12:00:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239153AbiIZMAi (ORCPT ); Mon, 26 Sep 2022 08:00:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238946AbiIZL46 (ORCPT ); Mon, 26 Sep 2022 07:56:58 -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 296A158DD2; Mon, 26 Sep 2022 03:51:37 -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 1ED6DB802C7; Mon, 26 Sep 2022 10:50:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74B5FC433C1; Mon, 26 Sep 2022 10:50:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189450; bh=LHbfAxI9VR2EHmiDD+iWvYmBe2VTbE4nYprnzVSn6EY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0m9/bhWIC17Y8VA1JSmQD7n2kOFLl049nOyr0xxVZCxl9CSG6HqEMmc5RnumTHJuq xNhMeCAkdFGrmRlMsGL2msOooCrT+ZKF8mQmVdLAbNi8yHCMhzdPMiGJzov3ll9AhE kRewgVb+zKXv/oaM3LPZPX7Pl1iuvMzg89OYnUS0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Khalil Blaiech , Asmaa Mnebhi , Wolfram Sang , Sasha Levin Subject: [PATCH 5.19 192/207] i2c: mlxbf: prevent stack overflow in mlxbf_i2c_smbus_start_transaction() Date: Mon, 26 Sep 2022 12:13:01 +0200 Message-Id: <20220926100815.204357524@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Asmaa Mnebhi [ Upstream commit de24aceb07d426b6f1c59f33889d6a964770547b ] memcpy() is called in a loop while 'operation->length' upper bound is not checked and 'data_idx' also increments. Fixes: b5b5b32081cd206b ("i2c: mlxbf: I2C SMBus driver for Mellanox BlueFie= ld SoC") Reviewed-by: Khalil Blaiech Signed-off-by: Asmaa Mnebhi Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/i2c/busses/i2c-mlxbf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c index 612736906440..ac93c0ccf53c 100644 --- a/drivers/i2c/busses/i2c-mlxbf.c +++ b/drivers/i2c/busses/i2c-mlxbf.c @@ -738,6 +738,9 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv= *priv, if (flags & MLXBF_I2C_F_WRITE) { write_en =3D 1; write_len +=3D operation->length; + if (data_idx + operation->length > + MLXBF_I2C_MASTER_DATA_DESC_SIZE) + return -ENOBUFS; memcpy(data_desc + data_idx, operation->buffer, operation->length); data_idx +=3D operation->length; --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55226C07E9D for ; Mon, 26 Sep 2022 12:00:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239145AbiIZMAc (ORCPT ); Mon, 26 Sep 2022 08:00:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238949AbiIZL46 (ORCPT ); Mon, 26 Sep 2022 07:56:58 -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 02E817A537; Mon, 26 Sep 2022 03:51:37 -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 079F8B8077B; Mon, 26 Sep 2022 10:50:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50CDEC433D7; Mon, 26 Sep 2022 10:50:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189453; bh=uqwQ4xFumLZK7vILotRgOAeVPu/TjUochUrYMphEC4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sdfj52MJdeG/ayb5ZBAG3NnjgzxYrRfju71D76Lf7JaMnHTt1PuuFTUbONcvWkHPs jfUB4ph3mOhM+/+uAQ8a37o6ff0LeTer+Yuwo3kUxp9G+1W6yzlW3TRgU5smHRhnV7 58b80alCaAYMcD6pbXVoRELuiAfyxzOAQQPcRdOs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Khalil Blaiech , Asmaa Mnebhi , Wolfram Sang , Sasha Levin Subject: [PATCH 5.19 193/207] i2c: mlxbf: Fix frequency calculation Date: Mon, 26 Sep 2022 12:13:02 +0200 Message-Id: <20220926100815.243440257@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Asmaa Mnebhi [ Upstream commit 37f071ec327b04c83d47637c5e5c2199b39899ca ] The i2c-mlxbf.c driver is currently broken because there is a bug in the calculation of the frequency. core_f, core_r and core_od are components read from hardware registers and are used to compute the frequency used to compute different timing parameters. The shifting mechanism used to get core_f, core_r and core_od is wrong. Use FIELD_GET to mask and shift the bitfields properly. Fixes: b5b5b32081cd206b (i2c: mlxbf: I2C SMBus driver for Mellanox BlueFiel= d SoC) Reviewed-by: Khalil Blaiech Signed-off-by: Asmaa Mnebhi Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/i2c/busses/i2c-mlxbf.c | 63 +++++++++++++--------------------- 1 file changed, 23 insertions(+), 40 deletions(-) diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c index ac93c0ccf53c..ad5efd7497d1 100644 --- a/drivers/i2c/busses/i2c-mlxbf.c +++ b/drivers/i2c/busses/i2c-mlxbf.c @@ -6,6 +6,7 @@ */ =20 #include +#include #include #include #include @@ -63,13 +64,14 @@ */ #define MLXBF_I2C_TYU_PLL_OUT_FREQ (400 * 1000 * 1000) /* Reference clock for Bluefield - 156 MHz. */ -#define MLXBF_I2C_PLL_IN_FREQ (156 * 1000 * 1000) +#define MLXBF_I2C_PLL_IN_FREQ 156250000ULL =20 /* Constant used to determine the PLL frequency. */ -#define MLNXBF_I2C_COREPLL_CONST 16384 +#define MLNXBF_I2C_COREPLL_CONST 16384ULL + +#define MLXBF_I2C_FREQUENCY_1GHZ 1000000000ULL =20 /* PLL registers. */ -#define MLXBF_I2C_CORE_PLL_REG0 0x0 #define MLXBF_I2C_CORE_PLL_REG1 0x4 #define MLXBF_I2C_CORE_PLL_REG2 0x8 =20 @@ -181,22 +183,15 @@ #define MLXBF_I2C_COREPLL_FREQ MLXBF_I2C_TYU_PLL_OUT_FREQ =20 /* Core PLL TYU configuration. */ -#define MLXBF_I2C_COREPLL_CORE_F_TYU_MASK GENMASK(12, 0) -#define MLXBF_I2C_COREPLL_CORE_OD_TYU_MASK GENMASK(3, 0) -#define MLXBF_I2C_COREPLL_CORE_R_TYU_MASK GENMASK(5, 0) - -#define MLXBF_I2C_COREPLL_CORE_F_TYU_SHIFT 3 -#define MLXBF_I2C_COREPLL_CORE_OD_TYU_SHIFT 16 -#define MLXBF_I2C_COREPLL_CORE_R_TYU_SHIFT 20 +#define MLXBF_I2C_COREPLL_CORE_F_TYU_MASK GENMASK(15, 3) +#define MLXBF_I2C_COREPLL_CORE_OD_TYU_MASK GENMASK(19, 16) +#define MLXBF_I2C_COREPLL_CORE_R_TYU_MASK GENMASK(25, 20) =20 /* Core PLL YU configuration. */ #define MLXBF_I2C_COREPLL_CORE_F_YU_MASK GENMASK(25, 0) #define MLXBF_I2C_COREPLL_CORE_OD_YU_MASK GENMASK(3, 0) -#define MLXBF_I2C_COREPLL_CORE_R_YU_MASK GENMASK(5, 0) +#define MLXBF_I2C_COREPLL_CORE_R_YU_MASK GENMASK(31, 26) =20 -#define MLXBF_I2C_COREPLL_CORE_F_YU_SHIFT 0 -#define MLXBF_I2C_COREPLL_CORE_OD_YU_SHIFT 1 -#define MLXBF_I2C_COREPLL_CORE_R_YU_SHIFT 26 =20 /* Core PLL frequency. */ static u64 mlxbf_i2c_corepll_frequency; @@ -479,8 +474,6 @@ static struct mutex mlxbf_i2c_bus_lock; #define MLXBF_I2C_MASK_8 GENMASK(7, 0) #define MLXBF_I2C_MASK_16 GENMASK(15, 0) =20 -#define MLXBF_I2C_FREQUENCY_1GHZ 1000000000 - /* * Function to poll a set of bits at a specific address; it checks whether * the bits are equal to zero when eq_zero is set to 'true', and not equal @@ -1410,24 +1403,19 @@ static int mlxbf_i2c_init_master(struct platform_de= vice *pdev, return 0; } =20 -static u64 mlxbf_calculate_freq_from_tyu(struct mlxbf_i2c_resource *corepl= l_res) +static u64 mlxbf_i2c_calculate_freq_from_tyu(struct mlxbf_i2c_resource *co= repll_res) { - u64 core_frequency, pad_frequency; + u64 core_frequency; u8 core_od, core_r; u32 corepll_val; u16 core_f; =20 - pad_frequency =3D MLXBF_I2C_PLL_IN_FREQ; - corepll_val =3D readl(corepll_res->io + MLXBF_I2C_CORE_PLL_REG1); =20 /* Get Core PLL configuration bits. */ - core_f =3D rol32(corepll_val, MLXBF_I2C_COREPLL_CORE_F_TYU_SHIFT) & - MLXBF_I2C_COREPLL_CORE_F_TYU_MASK; - core_od =3D rol32(corepll_val, MLXBF_I2C_COREPLL_CORE_OD_TYU_SHIFT) & - MLXBF_I2C_COREPLL_CORE_OD_TYU_MASK; - core_r =3D rol32(corepll_val, MLXBF_I2C_COREPLL_CORE_R_TYU_SHIFT) & - MLXBF_I2C_COREPLL_CORE_R_TYU_MASK; + core_f =3D FIELD_GET(MLXBF_I2C_COREPLL_CORE_F_TYU_MASK, corepll_val); + core_od =3D FIELD_GET(MLXBF_I2C_COREPLL_CORE_OD_TYU_MASK, corepll_val); + core_r =3D FIELD_GET(MLXBF_I2C_COREPLL_CORE_R_TYU_MASK, corepll_val); =20 /* * Compute PLL output frequency as follow: @@ -1439,31 +1427,26 @@ static u64 mlxbf_calculate_freq_from_tyu(struct mlx= bf_i2c_resource *corepll_res) * Where PLL_OUT_FREQ and PLL_IN_FREQ refer to CoreFrequency * and PadFrequency, respectively. */ - core_frequency =3D pad_frequency * (++core_f); + core_frequency =3D MLXBF_I2C_PLL_IN_FREQ * (++core_f); core_frequency /=3D (++core_r) * (++core_od); =20 return core_frequency; } =20 -static u64 mlxbf_calculate_freq_from_yu(struct mlxbf_i2c_resource *corepll= _res) +static u64 mlxbf_i2c_calculate_freq_from_yu(struct mlxbf_i2c_resource *cor= epll_res) { u32 corepll_reg1_val, corepll_reg2_val; - u64 corepll_frequency, pad_frequency; + u64 corepll_frequency; u8 core_od, core_r; u32 core_f; =20 - pad_frequency =3D MLXBF_I2C_PLL_IN_FREQ; - corepll_reg1_val =3D readl(corepll_res->io + MLXBF_I2C_CORE_PLL_REG1); corepll_reg2_val =3D readl(corepll_res->io + MLXBF_I2C_CORE_PLL_REG2); =20 /* Get Core PLL configuration bits */ - core_f =3D rol32(corepll_reg1_val, MLXBF_I2C_COREPLL_CORE_F_YU_SHIFT) & - MLXBF_I2C_COREPLL_CORE_F_YU_MASK; - core_r =3D rol32(corepll_reg1_val, MLXBF_I2C_COREPLL_CORE_R_YU_SHIFT) & - MLXBF_I2C_COREPLL_CORE_R_YU_MASK; - core_od =3D rol32(corepll_reg2_val, MLXBF_I2C_COREPLL_CORE_OD_YU_SHIFT) & - MLXBF_I2C_COREPLL_CORE_OD_YU_MASK; + core_f =3D FIELD_GET(MLXBF_I2C_COREPLL_CORE_F_YU_MASK, corepll_reg1_val); + core_r =3D FIELD_GET(MLXBF_I2C_COREPLL_CORE_R_YU_MASK, corepll_reg1_val); + core_od =3D FIELD_GET(MLXBF_I2C_COREPLL_CORE_OD_YU_MASK, corepll_reg2_val= ); =20 /* * Compute PLL output frequency as follow: @@ -1475,7 +1458,7 @@ static u64 mlxbf_calculate_freq_from_yu(struct mlxbf_= i2c_resource *corepll_res) * Where PLL_OUT_FREQ and PLL_IN_FREQ refer to CoreFrequency * and PadFrequency, respectively. */ - corepll_frequency =3D (pad_frequency * core_f) / MLNXBF_I2C_COREPLL_CONST; + corepll_frequency =3D (MLXBF_I2C_PLL_IN_FREQ * core_f) / MLNXBF_I2C_COREP= LL_CONST; corepll_frequency /=3D (++core_r) * (++core_od); =20 return corepll_frequency; @@ -2183,14 +2166,14 @@ static struct mlxbf_i2c_chip_info mlxbf_i2c_chip[] = =3D { [1] =3D &mlxbf_i2c_corepll_res[MLXBF_I2C_CHIP_TYPE_1], [2] =3D &mlxbf_i2c_gpio_res[MLXBF_I2C_CHIP_TYPE_1] }, - .calculate_freq =3D mlxbf_calculate_freq_from_tyu + .calculate_freq =3D mlxbf_i2c_calculate_freq_from_tyu }, [MLXBF_I2C_CHIP_TYPE_2] =3D { .type =3D MLXBF_I2C_CHIP_TYPE_2, .shared_res =3D { [0] =3D &mlxbf_i2c_corepll_res[MLXBF_I2C_CHIP_TYPE_2] }, - .calculate_freq =3D mlxbf_calculate_freq_from_yu + .calculate_freq =3D mlxbf_i2c_calculate_freq_from_yu } }; =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 542D6C07E9D for ; Mon, 26 Sep 2022 12:00:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239139AbiIZMAZ (ORCPT ); Mon, 26 Sep 2022 08:00:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238943AbiIZL46 (ORCPT ); Mon, 26 Sep 2022 07:56:58 -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 A084179EDF; Mon, 26 Sep 2022 03:51:38 -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 14B88B807EC; Mon, 26 Sep 2022 10:50:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 601BCC433D7; Mon, 26 Sep 2022 10:50:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189456; bh=IRzKGaMuCquRf/sme99rrXbn39SAxWDascXm7dwT+Q4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZPZgnpkgvcGRmJAbYxTxPGNcWHq9b2OvNuewOvF8Km9uxrp/QcFu3s/4Xn9sqDzPM F3Jj7GwCCWI6aeQvTRWTzdj3J4Z814jKyzsw8Zyor+kA+dp7kIVVaK5pANKRleCJpS 3V9ILuMCxusFBVUJ7lJK/mQhaUn3dj+5gCBvC8r0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Peter Rosin , "Gustavo A. R. Silva" , Wolfram Sang , Sasha Levin Subject: [PATCH 5.19 194/207] i2c: mux: harden i2c_mux_alloc() against integer overflows Date: Mon, 26 Sep 2022 12:13:03 +0200 Message-Id: <20220926100815.281336579@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit b7af938f4379a884f15713319648a7653497a907 ] A couple years back we went through the kernel an automatically converted size calculations to use struct_size() instead. The struct_size() calculation is protected against integer overflows. However it does not make sense to use the result from struct_size() for additional math operations as that would negate any safeness. Fixes: 1f3b69b6b939 ("i2c: mux: Use struct_size() in devm_kzalloc()") Signed-off-by: Dan Carpenter Acked-by: Peter Rosin Reviewed-by: Gustavo A. R. Silva Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/i2c/i2c-mux.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c index 774507b54b57..313904be5f3b 100644 --- a/drivers/i2c/i2c-mux.c +++ b/drivers/i2c/i2c-mux.c @@ -243,9 +243,10 @@ struct i2c_mux_core *i2c_mux_alloc(struct i2c_adapter = *parent, int (*deselect)(struct i2c_mux_core *, u32)) { struct i2c_mux_core *muxc; + size_t mux_size; =20 - muxc =3D devm_kzalloc(dev, struct_size(muxc, adapter, max_adapters) - + sizeof_priv, GFP_KERNEL); + mux_size =3D struct_size(muxc, adapter, max_adapters); + muxc =3D devm_kzalloc(dev, size_add(mux_size, sizeof_priv), GFP_KERNEL); if (!muxc) return NULL; if (sizeof_priv) --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29413C07E9D for ; Mon, 26 Sep 2022 12:25:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235478AbiIZMZz (ORCPT ); Mon, 26 Sep 2022 08:25:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239513AbiIZMZS (ORCPT ); Mon, 26 Sep 2022 08:25:18 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58F52A7226; Mon, 26 Sep 2022 04:06:32 -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 sin.source.kernel.org (Postfix) with ESMTPS id 73191CE1123; Mon, 26 Sep 2022 10:51:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F23BC433D7; Mon, 26 Sep 2022 10:51:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189462; bh=ww4b36ztulCznsgn7FjuKot9ify6pm/HPOVFFydwAlo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZLNKiRCi6NnrK0k2xCQ3w0vPucwzhM1K1vXNO+yJLMS35LeUstECymOlUn7zlHV57 9Wqzox/prQxBQDPhwgAFnkdNNTAVtJ5MA5FLtuhfM2ywGi3q46n04TfvLb1LnyfgHM XVoomzqzLRONb8GXX6m2nfvUM7HrMyfmXv1y1Hyk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arthur Marsh , Hamza Mahfooz , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 195/207] drm/amdgpu: dont register a dirty callback for non-atomic Date: Mon, 26 Sep 2022 12:13:04 +0200 Message-Id: <20220926100815.331593360@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alex Deucher [ Upstream commit abbc7a3dafb91b9d4ec56b70ec9a7520f8e13334 ] Some asics still support non-atomic code paths. Fixes: 66f99628eb2440 ("drm/amdgpu: use dirty framebuffer helper") Reported-by: Arthur Marsh Reviewed-by: Hamza Mahfooz Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/= amd/amdgpu/amdgpu_display.c index 3451147beda3..0a8c15c3a04c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -494,6 +495,11 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector = *amdgpu_connector, static const struct drm_framebuffer_funcs amdgpu_fb_funcs =3D { .destroy =3D drm_gem_fb_destroy, .create_handle =3D drm_gem_fb_create_handle, +}; + +static const struct drm_framebuffer_funcs amdgpu_fb_funcs_atomic =3D { + .destroy =3D drm_gem_fb_destroy, + .create_handle =3D drm_gem_fb_create_handle, .dirty =3D drm_atomic_helper_dirtyfb, }; =20 @@ -1071,7 +1077,10 @@ static int amdgpu_display_gem_fb_verify_and_init(str= uct drm_device *dev, if (ret) goto err; =20 - ret =3D drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); + if (drm_drv_uses_atomic_modeset(dev)) + ret =3D drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs_atomic); + else + ret =3D drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); if (ret) goto err; =20 --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43A71C07E9D for ; Mon, 26 Sep 2022 12:00:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239133AbiIZMAV (ORCPT ); Mon, 26 Sep 2022 08:00:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238922AbiIZL45 (ORCPT ); Mon, 26 Sep 2022 07:56:57 -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 A9FF67A753; Mon, 26 Sep 2022 03:51:40 -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 086F0B80760; Mon, 26 Sep 2022 10:51:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5211AC433C1; Mon, 26 Sep 2022 10:51:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189465; bh=Fc/MREbXhmqSicKDRHd8xiGwpUeUqcIPl54MgKzE5XI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n7Mjmb5c496CU8tstQINkerewr6u4TvlH717HZ22fzEvO/Y28DEEP80V5NX34tkEA K0PyzgzLt6kxVVadbIw+t1OghxdQil3g2EdJNZOw27jVTzu/bIoI1jEfRBgoXBSTOa CJPffmMJYOvbmZYDyjOuCxxEAYF6JZxXKBRBF2/Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada , Adam Borowski , Sasha Levin Subject: [PATCH 5.19 196/207] certs: make system keyring depend on built-in x509 parser Date: Mon, 26 Sep 2022 12:13:05 +0200 Message-Id: <20220926100815.371137182@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Masahiro Yamada [ Upstream commit 2154aca21408752eaa3eeaf2ba6e942724ff2a4d ] Commit e90886291c7c ("certs: make system keyring depend on x509 parser") is not the right fix because x509_load_certificate_list() can be modular. The combination of CONFIG_SYSTEM_TRUSTED_KEYRING=3Dy and CONFIG_X509_CERTIFICATE_PARSER=3Dm still results in the following error: LD .tmp_vmlinux.kallsyms1 ld: certs/system_keyring.o: in function `load_system_certificate_list': system_keyring.c:(.init.text+0x8c): undefined reference to `x509_load_cer= tificate_list' make: *** [Makefile:1169: vmlinux] Error 1 Fixes: e90886291c7c ("certs: make system keyring depend on x509 parser") Signed-off-by: Masahiro Yamada Tested-by: Adam Borowski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- certs/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/certs/Kconfig b/certs/Kconfig index bf9b511573d7..1f109b070877 100644 --- a/certs/Kconfig +++ b/certs/Kconfig @@ -43,7 +43,7 @@ config SYSTEM_TRUSTED_KEYRING bool "Provide system-wide ring of trusted keys" depends on KEYS depends on ASYMMETRIC_KEY_TYPE - depends on X509_CERTIFICATE_PARSER + depends on X509_CERTIFICATE_PARSER =3D y help Provide a system keyring to which trusted keys can be added. Keys in the keyring are considered to be trusted. Keys may be added at will --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 255A6C32771 for ; Mon, 26 Sep 2022 12:02:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238817AbiIZMB6 (ORCPT ); Mon, 26 Sep 2022 08:01:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239251AbiIZL6h (ORCPT ); Mon, 26 Sep 2022 07:58:37 -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 895E679A4F; Mon, 26 Sep 2022 03:52:13 -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 3823460A1E; Mon, 26 Sep 2022 10:51:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3968EC433D6; Mon, 26 Sep 2022 10:51:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189468; bh=AVRA1ujzvsdAyqlIxi/VLa//CtA1aWEcdrh9tMdOrcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xTcFDF9RCBSrzRsoY0Icsa5FostC3uLmDTq3qbk+Hmgp/czUDeqKT2jGaFuLq1fTB FWfyO3bgXJgoRKYI446ANMdEKdTzbsmkv6Ra9QUZDB3SBa3giO4PY74hZXB+KbyN6X 59ausWuBf+Te/xcKaXJBwAWu9NzdPIGmrNxiUW08= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andi Kleen , Dmitrii Bundin , Fangrui Song , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Sasha Levin Subject: [PATCH 5.19 197/207] Makefile.debug: set -g unconditional on CONFIG_DEBUG_INFO_SPLIT Date: Mon, 26 Sep 2022 12:13:06 +0200 Message-Id: <20220926100815.415112543@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nick Desaulniers [ Upstream commit 61f2b7c7497ba96cdde5bbaeb9e07f4c48f41f97 ] Dmitrii, Fangrui, and Mashahiro note: Before GCC 11 and Clang 12 -gsplit-dwarf implicitly uses -g2. Fix CONFIG_DEBUG_INFO_SPLIT for gcc-11+ & clang-12+ which now need -g specified in order for -gsplit-dwarf to work at all. -gsplit-dwarf has been mutually exclusive with -g since support for CONFIG_DEBUG_INFO_SPLIT was introduced in commit 866ced950bcd ("kbuild: Support split debug info v4") I don't think it ever needed to be. Link: https://lore.kernel.org/lkml/20220815013317.26121-1-dmitrii.bundin.a@= gmail.com/ Link: https://lore.kernel.org/lkml/CAK7LNARPAmsJD5XKAw7m_X2g7Fi-CAAsWDQiP7+= ANBjkg7R7ng@mail.gmail.com/ Link: https://reviews.llvm.org/D80391 Cc: Andi Kleen Reported-by: Dmitrii Bundin Reported-by: Fangrui Song Reported-by: Masahiro Yamada Suggested-by: Dmitrii Bundin Reviewed-by: Nathan Chancellor Signed-off-by: Nick Desaulniers Signed-off-by: Masahiro Yamada Stable-dep-of: 32ef9e5054ec ("Makefile.debug: re-enable debug info for .S f= iles") Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- scripts/Makefile.debug | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/Makefile.debug b/scripts/Makefile.debug index 9f39b0130551..26d6a9d97a20 100644 --- a/scripts/Makefile.debug +++ b/scripts/Makefile.debug @@ -1,9 +1,7 @@ -DEBUG_CFLAGS :=3D +DEBUG_CFLAGS :=3D -g =20 ifdef CONFIG_DEBUG_INFO_SPLIT DEBUG_CFLAGS +=3D -gsplit-dwarf -else -DEBUG_CFLAGS +=3D -g endif =20 ifndef CONFIG_AS_IS_LLVM --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FE3DC32771 for ; Mon, 26 Sep 2022 12:42:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237033AbiIZMm2 (ORCPT ); Mon, 26 Sep 2022 08:42:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235174AbiIZMmH (ORCPT ); Mon, 26 Sep 2022 08:42:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 214DA4B483; Mon, 26 Sep 2022 04:19:04 -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 EFC4860C09; Mon, 26 Sep 2022 10:51:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BAFDC433C1; Mon, 26 Sep 2022 10:51:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189518; bh=2cGH1mAPRTMCE+KtpGsX54UrcUXI3dW1W9qeiEFt52w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O94om6s9V3iDBxUPj8ScmqGIvZNKj29VWhOq4OseqvcrS4yLQJ4vY7VxRrVbpQzmh G2bV9cf2ahksJcEsTJ1AC+3VIROg0gQeyb+l5CNc/0GldmysPyOcoj3eTyVOufBZRJ KfA/Nr6zZoX6aDXl5uhpxYg7b+ZYSQNZHxMX3uVk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Alexandrov , Bill Wendling , Greg Thelen , Nathan Chancellor , Masahiro Yamada , Nick Desaulniers , Sasha Levin Subject: [PATCH 5.19 198/207] Makefile.debug: re-enable debug info for .S files Date: Mon, 26 Sep 2022 12:13:07 +0200 Message-Id: <20220926100815.462063478@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nick Desaulniers [ Upstream commit 32ef9e5054ec0321b9336058c58ec749e9c6b0fe ] Alexey reported that the fraction of unknown filename instances in kallsyms grew from ~0.3% to ~10% recently; Bill and Greg tracked it down to assembler defined symbols, which regressed as a result of: commit b8a9092330da ("Kbuild: do not emit debug info for assembly with LLVM= _IAS=3D1") In that commit, I allude to restoring debug info for assembler defined symbols in a follow up patch, but it seems I forgot to do so in commit a66049e2cf0e ("Kbuild: make DWARF version a choice") Link: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D31bf18= 645d98b4d3d7357353be840e320649a67d Fixes: b8a9092330da ("Kbuild: do not emit debug info for assembly with LLVM= _IAS=3D1") Reported-by: Alexey Alexandrov Reported-by: Bill Wendling Reported-by: Greg Thelen Reviewed-by: Nathan Chancellor Suggested-by: Masahiro Yamada Signed-off-by: Nick Desaulniers Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- lib/Kconfig.debug | 4 +++- scripts/Makefile.debug | 21 +++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 2e24db4bff19..c399ab486557 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -264,8 +264,10 @@ config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT config DEBUG_INFO_DWARF4 bool "Generate DWARF Version 4 debuginfo" select DEBUG_INFO + depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && A= S_VERSION >=3D 23502))) help - Generate DWARF v4 debug info. This requires gcc 4.5+ and gdb 7.0+. + Generate DWARF v4 debug info. This requires gcc 4.5+, binutils 2.35.2 + if using clang without clang's integrated assembler, and gdb 7.0+. =20 If you have consumers of DWARF debug info that are not ready for newer revisions of DWARF, you may wish to choose this or have your diff --git a/scripts/Makefile.debug b/scripts/Makefile.debug index 26d6a9d97a20..8cf1cb22dd93 100644 --- a/scripts/Makefile.debug +++ b/scripts/Makefile.debug @@ -1,18 +1,19 @@ -DEBUG_CFLAGS :=3D -g +DEBUG_CFLAGS :=3D +debug-flags-y :=3D -g =20 ifdef CONFIG_DEBUG_INFO_SPLIT DEBUG_CFLAGS +=3D -gsplit-dwarf endif =20 -ifndef CONFIG_AS_IS_LLVM -KBUILD_AFLAGS +=3D -Wa,-gdwarf-2 -endif - -ifndef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT -dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) :=3D 4 -dwarf-version-$(CONFIG_DEBUG_INFO_DWARF5) :=3D 5 -DEBUG_CFLAGS +=3D -gdwarf-$(dwarf-version-y) +debug-flags-$(CONFIG_DEBUG_INFO_DWARF4) +=3D -gdwarf-4 +debug-flags-$(CONFIG_DEBUG_INFO_DWARF5) +=3D -gdwarf-5 +ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_AS_IS_GNU),yy) +# Clang does not pass -g or -gdwarf-* option down to GAS. +# Add -Wa, prefix to explicitly specify the flags. +KBUILD_AFLAGS +=3D $(addprefix -Wa$(comma), $(debug-flags-y)) endif +DEBUG_CFLAGS +=3D $(debug-flags-y) +KBUILD_AFLAGS +=3D $(debug-flags-y) =20 ifdef CONFIG_DEBUG_INFO_REDUCED DEBUG_CFLAGS +=3D -fno-var-tracking @@ -27,5 +28,5 @@ KBUILD_AFLAGS +=3D -gz=3Dzlib KBUILD_LDFLAGS +=3D --compress-debug-sections=3Dzlib endif =20 -KBUILD_CFLAGS +=3D $(DEBUG_CFLAGS) +KBUILD_CFLAGS +=3D $(DEBUG_CFLAGS) export DEBUG_CFLAGS --=20 2.35.1 From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA8DAC07E9D for ; Mon, 26 Sep 2022 12:02:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239235AbiIZMCV (ORCPT ); Mon, 26 Sep 2022 08:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239417AbiIZL6v (ORCPT ); Mon, 26 Sep 2022 07:58:51 -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 D8DE67A774; Mon, 26 Sep 2022 03:52:41 -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 33F1A60BAF; Mon, 26 Sep 2022 10:51:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41375C433D6; Mon, 26 Sep 2022 10:51:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189491; bh=sgHXT3LlirVMkqBoHOPqiiag2KMBYEjerSrFk8IJX/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j+DztX8PyDc8T/y7mOazTgZhgvu0NvGeRESaIxxg2EK9+fM86FTP5LogUL6mXKIUI gmp+ya4EbLo13dKv/xDt9ZLbmm3mnyBkt5k5mVQizFi8ouio0YFAvsorYPlDtJV3nM OZ7qHC3NRh9opFKaMIAf1mCNIKKh2vgGXKEK9lMY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ricardo Sandoval Torres , Tony Luck , Omar Avelar , "Rafael J. Wysocki" , Mark Gross , Dan Williams Subject: [PATCH 5.19 199/207] devdax: Fix soft-reservation memory description Date: Mon, 26 Sep 2022 12:13:08 +0200 Message-Id: <20220926100815.500660745@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Williams commit 67feaba413ec68daf4124e9870878899b4ed9a0e upstream. The "hmem" platform-devices that are created to represent the platform-advertised "Soft Reserved" memory ranges end up inserting a resource that causes the iomem_resource tree to look like this: 340000000-43fffffff : hmem.0 340000000-43fffffff : Soft Reserved 340000000-43fffffff : dax0.0 This is because insert_resource() reparents ranges when they completely intersect an existing range. This matters because code that uses region_intersects() to scan for a given IORES_DESC will only check that top-level 'hmem.0' resource and not the 'Soft Reserved' descendant. So, to support EINJ (via einj_error_inject()) to inject errors into memory hosted by a dax-device, be sure to describe the memory as IORES_DESC_SOFT_RESERVED. This is a follow-on to: commit b13a3e5fd40b ("ACPI: APEI: Fix _EINJ vs EFI_MEMORY_SP") ...that fixed EINJ support for "Soft Reserved" ranges in the first instance. Fixes: 262b45ae3ab4 ("x86/efi: EFI soft reservation to E820 enumeration") Reported-by: Ricardo Sandoval Torres Tested-by: Ricardo Sandoval Torres Cc: Cc: Tony Luck Cc: Omar Avelar Cc: Rafael J. Wysocki Cc: Mark Gross Link: https://lore.kernel.org/r/166397075670.389916.7435722208896316387.stg= it@dwillia2-xfh.jf.intel.com Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/dax/hmem/device.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/dax/hmem/device.c +++ b/drivers/dax/hmem/device.c @@ -15,6 +15,7 @@ void hmem_register_device(int target_nid .start =3D r->start, .end =3D r->end, .flags =3D IORESOURCE_MEM, + .desc =3D IORES_DESC_SOFT_RESERVED, }; struct platform_device *pdev; struct memregion_info info; From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49A6BC32771 for ; Mon, 26 Sep 2022 12:02:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239154AbiIZMCl (ORCPT ); Mon, 26 Sep 2022 08:02:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239468AbiIZL7D (ORCPT ); Mon, 26 Sep 2022 07:59:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0641C7C30F; Mon, 26 Sep 2022 03:52:57 -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 84E6060AD6; Mon, 26 Sep 2022 10:51:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7724EC433C1; Mon, 26 Sep 2022 10:51:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189494; bh=o1qr3piNBM7e3/1cDDu9nSnER9d/RqQc6r3ob5QHqps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DfrI1KKP7ZfaUuNes78SydbltPdOnA4GrYVIhTPaX056psR2i9U8A2mHrhec/78CJ kT2+nEuSd8x1KdJojDlo1TD8iwhUoTgyP6UrHnTb/IUrXlbMnZvr765b1g5hdnU51U zLVTGklF0Or2wvr/X33pvx2QL2zfKtyDFhaPLFGY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baokun Li , stable@kernel.org, =?UTF-8?q?Lu=C3=ADs=20Henriques?= , Jan Kara , Theodore Tso Subject: [PATCH 5.19 200/207] ext4: fix bug in extents parsing when eh_entries == 0 and eh_depth > 0 Date: Mon, 26 Sep 2022 12:13:09 +0200 Message-Id: <20220926100815.542682709@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lu=C3=ADs Henriques commit 29a5b8a137ac8eb410cc823653a29ac0e7b7e1b0 upstream. When walking through an inode extents, the ext4_ext_binsearch_idx() function assumes that the extent header has been previously validated. However, the= re are no checks that verify that the number of entries (eh->eh_entries) is non-zero when depth is > 0. And this will lead to problems because the EXT_FIRST_INDEX() and EXT_LAST_INDEX() will return garbage and result in th= is: [ 135.245946] ------------[ cut here ]------------ [ 135.247579] kernel BUG at fs/ext4/extents.c:2258! [ 135.249045] invalid opcode: 0000 [#1] PREEMPT SMP [ 135.250320] CPU: 2 PID: 238 Comm: tmp118 Not tainted 5.19.0-rc8+ #4 [ 135.252067] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS = rel-1.15.0-0-g2dd4b9b-rebuilt.opensuse.org 04/01/2014 [ 135.255065] RIP: 0010:ext4_ext_map_blocks+0xc20/0xcb0 [ 135.256475] Code: [ 135.261433] RSP: 0018:ffffc900005939f8 EFLAGS: 00010246 [ 135.262847] RAX: 0000000000000024 RBX: ffffc90000593b70 RCX: 00000000000= 00023 [ 135.264765] RDX: ffff8880038e5f10 RSI: 0000000000000003 RDI: ffff8880046= e922c [ 135.266670] RBP: ffff8880046e9348 R08: 0000000000000001 R09: ffff888002c= a580c [ 135.268576] R10: 0000000000002602 R11: 0000000000000000 R12: 00000000000= 00024 [ 135.270477] R13: 0000000000000000 R14: 0000000000000024 R15: 00000000000= 00000 [ 135.272394] FS: 00007fdabdc56740(0000) GS:ffff88807dd00000(0000) knlGS:= 0000000000000000 [ 135.274510] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 135.276075] CR2: 00007ffc26bd4f00 CR3: 0000000006261004 CR4: 00000000001= 70ea0 [ 135.277952] Call Trace: [ 135.278635] [ 135.279247] ? preempt_count_add+0x6d/0xa0 [ 135.280358] ? percpu_counter_add_batch+0x55/0xb0 [ 135.281612] ? _raw_read_unlock+0x18/0x30 [ 135.282704] ext4_map_blocks+0x294/0x5a0 [ 135.283745] ? xa_load+0x6f/0xa0 [ 135.284562] ext4_mpage_readpages+0x3d6/0x770 [ 135.285646] read_pages+0x67/0x1d0 [ 135.286492] ? folio_add_lru+0x51/0x80 [ 135.287441] page_cache_ra_unbounded+0x124/0x170 [ 135.288510] filemap_get_pages+0x23d/0x5a0 [ 135.289457] ? path_openat+0xa72/0xdd0 [ 135.290332] filemap_read+0xbf/0x300 [ 135.291158] ? _raw_spin_lock_irqsave+0x17/0x40 [ 135.292192] new_sync_read+0x103/0x170 [ 135.293014] vfs_read+0x15d/0x180 [ 135.293745] ksys_read+0xa1/0xe0 [ 135.294461] do_syscall_64+0x3c/0x80 [ 135.295284] entry_SYSCALL_64_after_hwframe+0x46/0xb0 This patch simply adds an extra check in __ext4_ext_check(), verifying that eh_entries is not 0 when eh_depth is > 0. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D215941 Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D216283 Cc: Baokun Li Cc: stable@kernel.org Signed-off-by: Lu=C3=ADs Henriques Reviewed-by: Jan Kara Reviewed-by: Baokun Li Link: https://lore.kernel.org/r/20220822094235.2690-1-lhenriques@suse.de Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/ext4/extents.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -460,6 +460,10 @@ static int __ext4_ext_check(const char * error_msg =3D "invalid eh_entries"; goto corrupted; } + if (unlikely((eh->eh_entries =3D=3D 0) && (depth > 0))) { + error_msg =3D "eh_entries is 0 but eh_depth is > 0"; + goto corrupted; + } if (!ext4_valid_extent_entries(inode, eh, lblk, &pblk, depth)) { error_msg =3D "invalid extent entries"; goto corrupted; From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7563BC32771 for ; Mon, 26 Sep 2022 12:01:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239152AbiIZMBL (ORCPT ); Mon, 26 Sep 2022 08:01:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239041AbiIZL5d (ORCPT ); Mon, 26 Sep 2022 07:57:33 -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 D944979EEF; Mon, 26 Sep 2022 03:51: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 1F1B8B801BF; Mon, 26 Sep 2022 10:51:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70B14C433C1; Mon, 26 Sep 2022 10:51:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189497; bh=FEaqRg9Jhad8dousdLr43+y0GRbqIml1vQ3WMfgS53k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PT6odn8ekMiAN1SMmtIMwDTISJ6+jooxATvuQIv3YuAcYw3SJdiDnVDHiMXTt2OLm K5lwpzfa5zk3eJL2K0eOS88FKgDOrhL44xG3VxMT1D8qjywVNTKyyr9zefS/PxOUed q0lZSW3F6NUsfWedNPPpaPbQ7IvumsBtGlvOzv/w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso , stable@kernel.org Subject: [PATCH 5.19 201/207] ext4: limit the number of retries after discarding preallocations blocks Date: Mon, 26 Sep 2022 12:13:10 +0200 Message-Id: <20220926100815.592698774@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Theodore Ts'o commit 80fa46d6b9e7b1527bfd2197d75431fd9c382161 upstream. This patch avoids threads live-locking for hours when a large number threads are competing over the last few free extents as they blocks getting added and removed from preallocation pools. From our bug reporter: A reliable way for triggering this has multiple writers continuously write() to files when the filesystem is full, while small amounts of space are freed (e.g. by truncating a large file -1MiB at a time). In the local filesystem, this can be done by simply not checking the return code of write (0) and/or the error (ENOSPACE) that is set. Over NFS with an async mount, even clients with proper error checking will behave this way since the linux NFS client implementation will not propagate the server errors [the write syscalls immediately return success] until the file handle is closed. This leads to a situation where NFS clients send a continuous stream of WRITE rpcs which result in ERRNOSPACE -- but since the client isn't seeing this, the stream of writes continues at maximum network speed. When some space does appear, multiple writers will all attempt to claim it for their current write. For NFS, we may see dozens to hundreds of threads that do this. The real-world scenario of this is database backup tooling (in particular, github.com/mdkent/percona-xtrabackup) which may write large files (>1TiB) to NFS for safe keeping. Some temporary files are written, rewound, and read back -- all before closing the file handle (the temp file is actually unlinked, to trigger automatic deletion on close/crash.) An application like this operating on an async NFS mount will not see an error code until TiB have been written/read. The lockup was observed when running this database backup on large filesystems (64 TiB in this case) with a high number of block groups and no free space. Fragmentation is generally not a factor in this filesystem (~thousands of large files, mostly contiguous except for the parts written while the filesystem is at capacity.) Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/ext4/mballoc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -5559,6 +5559,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t ext4_fsblk_t block =3D 0; unsigned int inquota =3D 0; unsigned int reserv_clstrs =3D 0; + int retries =3D 0; u64 seq; =20 might_sleep(); @@ -5661,7 +5662,8 @@ repeat: ar->len =3D ac->ac_b_ex.fe_len; } } else { - if (ext4_mb_discard_preallocations_should_retry(sb, ac, &seq)) + if (++retries < 3 && + ext4_mb_discard_preallocations_should_retry(sb, ac, &seq)) goto repeat; /* * If block allocation fails then the pa allocated above From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CA92C6FA83 for ; Mon, 26 Sep 2022 12:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238832AbiIZMG0 (ORCPT ); Mon, 26 Sep 2022 08:06:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239078AbiIZMB4 (ORCPT ); Mon, 26 Sep 2022 08:01:56 -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 B5AA17CAA5; Mon, 26 Sep 2022 03:53:40 -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 7B57460A4D; Mon, 26 Sep 2022 10:51:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80F0EC433D6; Mon, 26 Sep 2022 10:51:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189500; bh=I2iJTGmrjfeXtL80IU2V9HUQGt2jL1+AcdRt0kpwcE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IeAzB5mspSrFPJZepyv3tLtswtxBGkzF0ohmOSdFtnXsQCs0+KGwYDWuXfbb478t6 Wb4p8Iv1W6nNxTd1xE82o4Hkuk/QWmcHbiIoDXNA35K3de/w/2tiRAgx3XAtUnMlMU +MsNItF0Fsjaxolrq1GJT34WNYNovLtjvy8Xp5jM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ojaswin Mujoo , "Ritesh Harjani (IBM)" , Jan Kara , Theodore Tso , Stefan Wahren Subject: [PATCH 5.19 202/207] ext4: make mballoc try target group first even with mb_optimize_scan Date: Mon, 26 Sep 2022 12:13:11 +0200 Message-Id: <20220926100815.642837527@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara commit 4fca50d440cc5d4dc570ad5484cc0b70b381bc2a upstream. One of the side-effects of mb_optimize_scan was that the optimized functions to select next group to try were called even before we tried the goal group. As a result we no longer allocate files close to corresponding inodes as well as we don't try to expand currently allocated extent in the same group. This results in reaim regression with workfile.disk workload of upto 8% with many clients on my test machine: baseline mb_optimize_scan Hmean disk-1 2114.16 ( 0.00%) 2099.37 ( -0.70%) Hmean disk-41 87794.43 ( 0.00%) 83787.47 * -4.56%* Hmean disk-81 148170.73 ( 0.00%) 135527.05 * -8.53%* Hmean disk-121 177506.11 ( 0.00%) 166284.93 * -6.32%* Hmean disk-161 220951.51 ( 0.00%) 207563.39 * -6.06%* Hmean disk-201 208722.74 ( 0.00%) 203235.59 ( -2.63%) Hmean disk-241 222051.60 ( 0.00%) 217705.51 ( -1.96%) Hmean disk-281 252244.17 ( 0.00%) 241132.72 * -4.41%* Hmean disk-321 255844.84 ( 0.00%) 245412.84 * -4.08%* Also this is causing huge regression (time increased by a factor of 5 or so) when untarring archive with lots of small files on some eMMC storage cards. Fix the problem by making sure we try goal group first. Fixes: 196e402adf2e ("ext4: improve cr 0 / cr 1 group scanning") CC: stable@kernel.org Reported-and-tested-by: Stefan Wahren Tested-by: Ojaswin Mujoo Reviewed-by: Ritesh Harjani (IBM) Link: https://lore.kernel.org/all/20220727105123.ckwrhbilzrxqpt24@quack3/ Link: https://lore.kernel.org/all/0d81a7c2-46b7-6010-62a4-3e6cfc1628d6@i2se= .com/ Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20220908092136.11770-1-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/ext4/mballoc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -1049,8 +1049,10 @@ static void ext4_mb_choose_next_group(st { *new_cr =3D ac->ac_criteria; =20 - if (!should_optimize_scan(ac) || ac->ac_groups_linear_remaining) + if (!should_optimize_scan(ac) || ac->ac_groups_linear_remaining) { + *group =3D next_linear_group(ac, *group, ngroups); return; + } =20 if (*new_cr =3D=3D 0) { ext4_mb_choose_next_group_cr0(ac, new_cr, group, ngroups); @@ -2630,7 +2632,7 @@ static noinline_for_stack int ext4_mb_regular_allocator(struct ext4_allocation_context *ac) { ext4_group_t prefetch_grp =3D 0, ngroups, group, i; - int cr =3D -1; + int cr =3D -1, new_cr; int err =3D 0, first_err =3D 0; unsigned int nr =3D 0, prefetch_ios =3D 0; struct ext4_sb_info *sbi; @@ -2705,13 +2707,11 @@ repeat: ac->ac_groups_linear_remaining =3D sbi->s_mb_max_linear_groups; prefetch_grp =3D group; =20 - for (i =3D 0; i < ngroups; group =3D next_linear_group(ac, group, ngroup= s), - i++) { - int ret =3D 0, new_cr; + for (i =3D 0, new_cr =3D cr; i < ngroups; i++, + ext4_mb_choose_next_group(ac, &new_cr, &group, ngroups)) { + int ret =3D 0; =20 cond_resched(); - - ext4_mb_choose_next_group(ac, &new_cr, &group, ngroups); if (new_cr !=3D cr) { cr =3D new_cr; goto repeat; From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DDF9C32771 for ; Mon, 26 Sep 2022 12:01:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239091AbiIZMA7 (ORCPT ); Mon, 26 Sep 2022 08:00:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238995AbiIZL5N (ORCPT ); Mon, 26 Sep 2022 07:57:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C6EA7A76A; Mon, 26 Sep 2022 03:51:44 -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 5206960C09; Mon, 26 Sep 2022 10:51:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 560EFC433C1; Mon, 26 Sep 2022 10:51:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189503; bh=sHvIIc/WdPsfHk+hAlPh7SHkb11QWX6X4FwEN42rrUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ht6g//m7bQSipsLmYBdqD2zc8YcYenjJ+cOuTzElsamRdvOa3V9F0wda/JKEXkkQZ zGwKVmHFUYIixv0JBr6MhWkgnjW0Z0DOTrQmDhSFLp/NIn0FN0+NOGBN90c0qRwMBe Vd2qnvYooA3rbjDuhSfZKG7SzaUfL64RSXJ9iHdw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ojaswin Mujoo , "Ritesh Harjani (IBM)" , Jan Kara , Theodore Tso , Stefan Wahren Subject: [PATCH 5.19 203/207] ext4: avoid unnecessary spreading of allocations among groups Date: Mon, 26 Sep 2022 12:13:12 +0200 Message-Id: <20220926100815.691863297@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara commit 1940265ede6683f6317cba0d428ce6505eaca944 upstream. mb_set_largest_free_order() updates lists containing groups with largest chunk of free space of given order. The way it updates it leads to always moving the group to the tail of the list. Thus allocations looking for free space of given order effectively end up cycling through all groups (and due to initialization in last to first order). This spreads allocations among block groups which reduces performance for rotating disks or low-end flash media. Change mb_set_largest_free_order() to only update lists if the order of the largest free chunk in the group changed. Fixes: 196e402adf2e ("ext4: improve cr 0 / cr 1 group scanning") CC: stable@kernel.org Reported-and-tested-by: Stefan Wahren Tested-by: Ojaswin Mujoo Reviewed-by: Ritesh Harjani (IBM) Signed-off-by: Jan Kara Link: https://lore.kernel.org/all/0d81a7c2-46b7-6010-62a4-3e6cfc1628d6@i2se= .com/ Link: https://lore.kernel.org/r/20220908092136.11770-2-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/ext4/mballoc.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -1077,23 +1077,25 @@ mb_set_largest_free_order(struct super_b struct ext4_sb_info *sbi =3D EXT4_SB(sb); int i; =20 - if (test_opt2(sb, MB_OPTIMIZE_SCAN) && grp->bb_largest_free_order >=3D 0)= { + for (i =3D MB_NUM_ORDERS(sb) - 1; i >=3D 0; i--) + if (grp->bb_counters[i] > 0) + break; + /* No need to move between order lists? */ + if (!test_opt2(sb, MB_OPTIMIZE_SCAN) || + i =3D=3D grp->bb_largest_free_order) { + grp->bb_largest_free_order =3D i; + return; + } + + if (grp->bb_largest_free_order >=3D 0) { write_lock(&sbi->s_mb_largest_free_orders_locks[ grp->bb_largest_free_order]); list_del_init(&grp->bb_largest_free_order_node); write_unlock(&sbi->s_mb_largest_free_orders_locks[ grp->bb_largest_free_order]); } - grp->bb_largest_free_order =3D -1; /* uninit */ - - for (i =3D MB_NUM_ORDERS(sb) - 1; i >=3D 0; i--) { - if (grp->bb_counters[i] > 0) { - grp->bb_largest_free_order =3D i; - break; - } - } - if (test_opt2(sb, MB_OPTIMIZE_SCAN) && - grp->bb_largest_free_order >=3D 0 && grp->bb_free) { + grp->bb_largest_free_order =3D i; + if (grp->bb_largest_free_order >=3D 0 && grp->bb_free) { write_lock(&sbi->s_mb_largest_free_orders_locks[ grp->bb_largest_free_order]); list_add_tail(&grp->bb_largest_free_order_node, From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65910C07E9D for ; Mon, 26 Sep 2022 12:02:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239273AbiIZMCw (ORCPT ); Mon, 26 Sep 2022 08:02:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239521AbiIZL7H (ORCPT ); Mon, 26 Sep 2022 07:59:07 -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 D64CE58DED; Mon, 26 Sep 2022 03:53: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 1C56460C41; Mon, 26 Sep 2022 10:51:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27AC9C433C1; Mon, 26 Sep 2022 10:51:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189506; bh=4mYWBhP/Z3ougimx06u882IxvUodzoAatzPIsgpPIIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sC41mBgrC7Kqg/hZoJopDpIb3AJjaiRp0aJYOzKXqTZtcMOoSIHwKRYf3dptqkdeW JgblJdhi99e3UtJDPi8BowoYtD02/8+Ef6rphNuM+AO2ciBQFBLRAuQY7tji63cOce hhJKgFzf+2Zv0hHIl4uPQPdx96HCFl8D8t/SQSIw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Wahren , Ojaswin Mujoo , stable@kernel.org, Jan Kara , Theodore Tso Subject: [PATCH 5.19 204/207] ext4: make directory inode spreading reflect flexbg size Date: Mon, 26 Sep 2022 12:13:13 +0200 Message-Id: <20220926100815.741129917@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara commit 613c5a85898d1cd44e68f28d65eccf64a8ace9cf upstream. Currently the Orlov inode allocator searches for free inodes for a directory only in flex block groups with at most inodes_per_group/16 more directory inodes than average per flex block group. However with growing size of flex block group this becomes unnecessarily strict. Scale allowed difference from average directory count per flex block group with flex block group size as we do with other metrics. Tested-by: Stefan Wahren Tested-by: Ojaswin Mujoo Cc: stable@kernel.org Link: https://lore.kernel.org/all/0d81a7c2-46b7-6010-62a4-3e6cfc1628d6@i2se= .com/ Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20220908092136.11770-3-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/ext4/ialloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c @@ -510,7 +510,7 @@ static int find_group_orlov(struct super goto fallback; } =20 - max_dirs =3D ndirs / ngroups + inodes_per_group / 16; + max_dirs =3D ndirs / ngroups + inodes_per_group*flex_size / 16; min_inodes =3D avefreei - inodes_per_group*flex_size / 4; if (min_inodes < 1) min_inodes =3D 1; From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21660C32771 for ; Mon, 26 Sep 2022 12:02:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235315AbiIZMCy (ORCPT ); Mon, 26 Sep 2022 08:02:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239129AbiIZMAG (ORCPT ); Mon, 26 Sep 2022 08:00:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54A827C32D; Mon, 26 Sep 2022 03:53:09 -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 F202C60C94; Mon, 26 Sep 2022 10:51:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB653C433C1; Mon, 26 Sep 2022 10:51:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189509; bh=wKQ2OWT+iKaWQAMG/hdsCIYwXywAu5qK/bsiXG5dHtM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MCOz3hd19eOMl2lTfU+SVmbz9fXa/W/6lpWvSWMWcnchpTjkIoYznEUxoe8NT7izu FbgwM5DYl/oP55/za3pSe7vZZz/u73bczykpWCXs0LDAWEG/CGEi4cCRB4rifGKI6j HNWD/jhPZRh0om+Bl7/PlzcL2cb56z5+Yi+gWhMQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ojaswin Mujoo , "Ritesh Harjani (IBM)" , Jan Kara , Theodore Tso , Stefan Wahren Subject: [PATCH 5.19 205/207] ext4: use locality group preallocation for small closed files Date: Mon, 26 Sep 2022 12:13:14 +0200 Message-Id: <20220926100815.787405954@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara commit a9f2a2931d0e197ab28c6007966053fdababd53f upstream. Curently we don't use any preallocation when a file is already closed when allocating blocks (from writeback code when converting delayed allocation). However for small files, using locality group preallocation is actually desirable as that is not specific to a particular file. Rather it is a method to pack small files together to reduce fragmentation and for that the fact the file is closed is actually even stronger hint the file would benefit from packing. So change the logic to allow locality group preallocation in this case. Fixes: 196e402adf2e ("ext4: improve cr 0 / cr 1 group scanning") CC: stable@kernel.org Reported-and-tested-by: Stefan Wahren Tested-by: Ojaswin Mujoo Reviewed-by: Ritesh Harjani (IBM) Signed-off-by: Jan Kara Link: https://lore.kernel.org/all/0d81a7c2-46b7-6010-62a4-3e6cfc1628d6@i2se= .com/ Link: https://lore.kernel.org/r/20220908092136.11770-4-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/ext4/mballoc.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -5189,6 +5189,7 @@ static void ext4_mb_group_or_file(struct struct ext4_sb_info *sbi =3D EXT4_SB(ac->ac_sb); int bsbits =3D ac->ac_sb->s_blocksize_bits; loff_t size, isize; + bool inode_pa_eligible, group_pa_eligible; =20 if (!(ac->ac_flags & EXT4_MB_HINT_DATA)) return; @@ -5196,25 +5197,27 @@ static void ext4_mb_group_or_file(struct if (unlikely(ac->ac_flags & EXT4_MB_HINT_GOAL_ONLY)) return; =20 + group_pa_eligible =3D sbi->s_mb_group_prealloc > 0; + inode_pa_eligible =3D true; size =3D ac->ac_o_ex.fe_logical + EXT4_C2B(sbi, ac->ac_o_ex.fe_len); isize =3D (i_size_read(ac->ac_inode) + ac->ac_sb->s_blocksize - 1) >> bsbits; =20 + /* No point in using inode preallocation for closed files */ if ((size =3D=3D isize) && !ext4_fs_is_busy(sbi) && - !inode_is_open_for_write(ac->ac_inode)) { - ac->ac_flags |=3D EXT4_MB_HINT_NOPREALLOC; - return; - } - - if (sbi->s_mb_group_prealloc <=3D 0) { - ac->ac_flags |=3D EXT4_MB_STREAM_ALLOC; - return; - } + !inode_is_open_for_write(ac->ac_inode)) + inode_pa_eligible =3D false; =20 - /* don't use group allocation for large files */ size =3D max(size, isize); - if (size > sbi->s_mb_stream_request) { - ac->ac_flags |=3D EXT4_MB_STREAM_ALLOC; + /* Don't use group allocation for large files */ + if (size > sbi->s_mb_stream_request) + group_pa_eligible =3D false; + + if (!group_pa_eligible) { + if (inode_pa_eligible) + ac->ac_flags |=3D EXT4_MB_STREAM_ALLOC; + else + ac->ac_flags |=3D EXT4_MB_HINT_NOPREALLOC; return; } From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A841AC07E9D for ; Mon, 26 Sep 2022 12:03:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239181AbiIZMDH (ORCPT ); Mon, 26 Sep 2022 08:03:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239187AbiIZMBC (ORCPT ); Mon, 26 Sep 2022 08:01:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0901258DCD; Mon, 26 Sep 2022 03:53: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 ams.source.kernel.org (Postfix) with ESMTPS id A268AB80782; Mon, 26 Sep 2022 10:51:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C38B7C433D6; Mon, 26 Sep 2022 10:51:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189512; bh=PCX5eJifo/kbMzTtn+lrRokHz7vuzE6dGq7WOSiqFpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ziRWYcAnxo3VaQKJRCF0d9AfbfBUkbEkk5J1Iy6R7QtKO/iXRPIk0kiWFcxePMjHL 6H4ZH9IwW9rEidzzBfYmSpwKhdGwHegr6mrxODqAF1LLo3lpNXiRjS2Rf9aczStd/Q Jb7Kv0u9ENTu3ioNCWE8YszIX6AxspKxZWEi6DKg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ojaswin Mujoo , Jan Kara , "Ritesh Harjani (IBM)" , Theodore Tso , Stefan Wahren Subject: [PATCH 5.19 206/207] ext4: use buckets for cr 1 block scan instead of rbtree Date: Mon, 26 Sep 2022 12:13:15 +0200 Message-Id: <20220926100815.839035039@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara commit 83e80a6e3543f37f74c8e48a5f305b054b65ce2a upstream. Using rbtree for sorting groups by average fragment size is relatively expensive (needs rbtree update on every block freeing or allocation) and leads to wide spreading of allocations because selection of block group is very sentitive both to changes in free space and amount of blocks allocated. Furthermore selecting group with the best matching average fragment size is not necessary anyway, even more so because the variability of fragment sizes within a group is likely large so average is not telling much. We just need a group with large enough average fragment size so that we have high probability of finding large enough free extent and we don't want average fragment size to be too big so that we are likely to find free extent only somewhat larger than what we need. So instead of maintaing rbtree of groups sorted by fragment size keep bins (lists) or groups where average fragment size is in the interval [2^i, 2^(i+1)). This structure requires less updates on block allocation / freeing, generally avoids chaotic spreading of allocations into block groups, and still is able to quickly (even faster that the rbtree) provide a block group which is likely to have a suitably sized free space extent. This patch reduces number of block groups used when untarring archive with medium sized files (size somewhat above 64k which is default mballoc limit for avoiding locality group preallocation) to about half and thus improves write speeds for eMMC flash significantly. Fixes: 196e402adf2e ("ext4: improve cr 0 / cr 1 group scanning") CC: stable@kernel.org Reported-and-tested-by: Stefan Wahren Tested-by: Ojaswin Mujoo Signed-off-by: Jan Kara Reviewed-by: Ritesh Harjani (IBM) Link: https://lore.kernel.org/all/0d81a7c2-46b7-6010-62a4-3e6cfc1628d6@i2se= .com/ Link: https://lore.kernel.org/r/20220908092136.11770-5-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/ext4/ext4.h | 10 +- fs/ext4/mballoc.c | 249 ++++++++++++++++++++++---------------------------= ----- fs/ext4/mballoc.h | 1=20 3 files changed, 111 insertions(+), 149 deletions(-) --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -167,8 +167,6 @@ enum SHIFT_DIRECTION { #define EXT4_MB_CR0_OPTIMIZED 0x8000 /* Avg fragment size rb tree lookup succeeded at least once for cr =3D 1 */ #define EXT4_MB_CR1_OPTIMIZED 0x00010000 -/* Perform linear traversal for one group */ -#define EXT4_MB_SEARCH_NEXT_LINEAR 0x00020000 struct ext4_allocation_request { /* target inode for block we're allocating */ struct inode *inode; @@ -1589,8 +1587,8 @@ struct ext4_sb_info { struct list_head s_discard_list; struct work_struct s_discard_work; atomic_t s_retry_alloc_pending; - struct rb_root s_mb_avg_fragment_size_root; - rwlock_t s_mb_rb_lock; + struct list_head *s_mb_avg_fragment_size; + rwlock_t *s_mb_avg_fragment_size_locks; struct list_head *s_mb_largest_free_orders; rwlock_t *s_mb_largest_free_orders_locks; =20 @@ -3402,6 +3400,8 @@ struct ext4_group_info { ext4_grpblk_t bb_first_free; /* first free block */ ext4_grpblk_t bb_free; /* total free blocks */ ext4_grpblk_t bb_fragments; /* nr of freespace fragments */ + int bb_avg_fragment_size_order; /* order of average + fragment in BG */ ext4_grpblk_t bb_largest_free_order;/* order of largest frag in BG */ ext4_group_t bb_group; /* Group number */ struct list_head bb_prealloc_list; @@ -3409,7 +3409,7 @@ struct ext4_group_info { void *bb_bitmap; #endif struct rw_semaphore alloc_sem; - struct rb_node bb_avg_fragment_size_rb; + struct list_head bb_avg_fragment_size_node; struct list_head bb_largest_free_order_node; ext4_grpblk_t bb_counters[]; /* Nr of free power-of-two-block * regions, index is order. --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -140,13 +140,15 @@ * number of buddy bitmap orders possible) number of lists. Group-infos= are * placed in appropriate lists. * - * 2) Average fragment size rb tree (sbi->s_mb_avg_fragment_size_root) + * 2) Average fragment size lists (sbi->s_mb_avg_fragment_size) * - * Locking: sbi->s_mb_rb_lock (rwlock) + * Locking: sbi->s_mb_avg_fragment_size_locks(array of rw locks) * - * This is a red black tree consisting of group infos and the tree is s= orted - * by average fragment sizes (which is calculated as ext4_group_info->b= b_free - * / ext4_group_info->bb_fragments). + * This is an array of lists where in the i-th list there are groups wi= th + * average fragment size >=3D 2^i and < 2^(i+1). The average fragment s= ize + * is computed as ext4_group_info->bb_free / ext4_group_info->bb_fragme= nts. + * Note that we don't bother with a special list for completely empty g= roups + * so we only have MB_NUM_ORDERS(sb) lists. * * When "mb_optimize_scan" mount option is set, mballoc consults the above= data * structures to decide the order in which groups are to be traversed for @@ -160,7 +162,8 @@ * * At CR =3D 1, we only consider groups where average fragment size > requ= est * size. So, we lookup a group which has average fragment size just above = or - * equal to request size using our rb tree (data structure 2) in O(log N) = time. + * equal to request size using our average fragment size group lists (data + * structure 2) in O(1) time. * * If "mb_optimize_scan" mount option is not set, mballoc traverses groups= in * linear order which requires O(N) search time for each CR 0 and CR 1 pha= se. @@ -802,65 +805,51 @@ static void ext4_mb_mark_free_simple(str } } =20 -static void ext4_mb_rb_insert(struct rb_root *root, struct rb_node *new, - int (*cmp)(struct rb_node *, struct rb_node *)) +static int mb_avg_fragment_size_order(struct super_block *sb, ext4_grpblk_= t len) { - struct rb_node **iter =3D &root->rb_node, *parent =3D NULL; + int order; =20 - while (*iter) { - parent =3D *iter; - if (cmp(new, *iter) > 0) - iter =3D &((*iter)->rb_left); - else - iter =3D &((*iter)->rb_right); - } - - rb_link_node(new, parent, iter); - rb_insert_color(new, root); -} - -static int -ext4_mb_avg_fragment_size_cmp(struct rb_node *rb1, struct rb_node *rb2) -{ - struct ext4_group_info *grp1 =3D rb_entry(rb1, - struct ext4_group_info, - bb_avg_fragment_size_rb); - struct ext4_group_info *grp2 =3D rb_entry(rb2, - struct ext4_group_info, - bb_avg_fragment_size_rb); - int num_frags_1, num_frags_2; - - num_frags_1 =3D grp1->bb_fragments ? - grp1->bb_free / grp1->bb_fragments : 0; - num_frags_2 =3D grp2->bb_fragments ? - grp2->bb_free / grp2->bb_fragments : 0; - - return (num_frags_2 - num_frags_1); + /* + * We don't bother with a special lists groups with only 1 block free + * extents and for completely empty groups. + */ + order =3D fls(len) - 2; + if (order < 0) + return 0; + if (order =3D=3D MB_NUM_ORDERS(sb)) + order--; + return order; } =20 -/* - * Reinsert grpinfo into the avg_fragment_size tree with new average - * fragment size. - */ +/* Move group to appropriate avg_fragment_size list */ static void mb_update_avg_fragment_size(struct super_block *sb, struct ext4_group_info= *grp) { struct ext4_sb_info *sbi =3D EXT4_SB(sb); + int new_order; =20 if (!test_opt2(sb, MB_OPTIMIZE_SCAN) || grp->bb_free =3D=3D 0) return; =20 - write_lock(&sbi->s_mb_rb_lock); - if (!RB_EMPTY_NODE(&grp->bb_avg_fragment_size_rb)) { - rb_erase(&grp->bb_avg_fragment_size_rb, - &sbi->s_mb_avg_fragment_size_root); - RB_CLEAR_NODE(&grp->bb_avg_fragment_size_rb); - } + new_order =3D mb_avg_fragment_size_order(sb, + grp->bb_free / grp->bb_fragments); + if (new_order =3D=3D grp->bb_avg_fragment_size_order) + return; =20 - ext4_mb_rb_insert(&sbi->s_mb_avg_fragment_size_root, - &grp->bb_avg_fragment_size_rb, - ext4_mb_avg_fragment_size_cmp); - write_unlock(&sbi->s_mb_rb_lock); + if (grp->bb_avg_fragment_size_order !=3D -1) { + write_lock(&sbi->s_mb_avg_fragment_size_locks[ + grp->bb_avg_fragment_size_order]); + list_del(&grp->bb_avg_fragment_size_node); + write_unlock(&sbi->s_mb_avg_fragment_size_locks[ + grp->bb_avg_fragment_size_order]); + } + grp->bb_avg_fragment_size_order =3D new_order; + write_lock(&sbi->s_mb_avg_fragment_size_locks[ + grp->bb_avg_fragment_size_order]); + list_add_tail(&grp->bb_avg_fragment_size_node, + &sbi->s_mb_avg_fragment_size[grp->bb_avg_fragment_size_order]); + write_unlock(&sbi->s_mb_avg_fragment_size_locks[ + grp->bb_avg_fragment_size_order]); } =20 /* @@ -909,86 +898,56 @@ static void ext4_mb_choose_next_group_cr *new_cr =3D 1; } else { *group =3D grp->bb_group; - ac->ac_last_optimal_group =3D *group; ac->ac_flags |=3D EXT4_MB_CR0_OPTIMIZED; } } =20 /* - * Choose next group by traversing average fragment size tree. Updates *ne= w_cr - * if cr lvel needs an update. Sets EXT4_MB_SEARCH_NEXT_LINEAR to indicate= that - * the linear search should continue for one iteration since there's lock - * contention on the rb tree lock. + * Choose next group by traversing average fragment size list of suitable + * order. Updates *new_cr if cr level needs an update. */ static void ext4_mb_choose_next_group_cr1(struct ext4_allocation_context *= ac, int *new_cr, ext4_group_t *group, ext4_group_t ngroups) { struct ext4_sb_info *sbi =3D EXT4_SB(ac->ac_sb); - int avg_fragment_size, best_so_far; - struct rb_node *node, *found; - struct ext4_group_info *grp; - - /* - * If there is contention on the lock, instead of waiting for the lock - * to become available, just continue searching lineraly. We'll resume - * our rb tree search later starting at ac->ac_last_optimal_group. - */ - if (!read_trylock(&sbi->s_mb_rb_lock)) { - ac->ac_flags |=3D EXT4_MB_SEARCH_NEXT_LINEAR; - return; - } + struct ext4_group_info *grp, *iter; + int i; =20 if (unlikely(ac->ac_flags & EXT4_MB_CR1_OPTIMIZED)) { if (sbi->s_mb_stats) atomic_inc(&sbi->s_bal_cr1_bad_suggestions); - /* We have found something at CR 1 in the past */ - grp =3D ext4_get_group_info(ac->ac_sb, ac->ac_last_optimal_group); - for (found =3D rb_next(&grp->bb_avg_fragment_size_rb); found !=3D NULL; - found =3D rb_next(found)) { - grp =3D rb_entry(found, struct ext4_group_info, - bb_avg_fragment_size_rb); + } + + for (i =3D mb_avg_fragment_size_order(ac->ac_sb, ac->ac_g_ex.fe_len); + i < MB_NUM_ORDERS(ac->ac_sb); i++) { + if (list_empty(&sbi->s_mb_avg_fragment_size[i])) + continue; + read_lock(&sbi->s_mb_avg_fragment_size_locks[i]); + if (list_empty(&sbi->s_mb_avg_fragment_size[i])) { + read_unlock(&sbi->s_mb_avg_fragment_size_locks[i]); + continue; + } + grp =3D NULL; + list_for_each_entry(iter, &sbi->s_mb_avg_fragment_size[i], + bb_avg_fragment_size_node) { if (sbi->s_mb_stats) atomic64_inc(&sbi->s_bal_cX_groups_considered[1]); - if (likely(ext4_mb_good_group(ac, grp->bb_group, 1))) + if (likely(ext4_mb_good_group(ac, iter->bb_group, 1))) { + grp =3D iter; break; - } - goto done; - } - - node =3D sbi->s_mb_avg_fragment_size_root.rb_node; - best_so_far =3D 0; - found =3D NULL; - - while (node) { - grp =3D rb_entry(node, struct ext4_group_info, - bb_avg_fragment_size_rb); - avg_fragment_size =3D 0; - if (ext4_mb_good_group(ac, grp->bb_group, 1)) { - avg_fragment_size =3D grp->bb_fragments ? - grp->bb_free / grp->bb_fragments : 0; - if (!best_so_far || avg_fragment_size < best_so_far) { - best_so_far =3D avg_fragment_size; - found =3D node; } } - if (avg_fragment_size > ac->ac_g_ex.fe_len) - node =3D node->rb_right; - else - node =3D node->rb_left; + read_unlock(&sbi->s_mb_avg_fragment_size_locks[i]); + if (grp) + break; } =20 -done: - if (found) { - grp =3D rb_entry(found, struct ext4_group_info, - bb_avg_fragment_size_rb); + if (grp) { *group =3D grp->bb_group; ac->ac_flags |=3D EXT4_MB_CR1_OPTIMIZED; } else { *new_cr =3D 2; } - - read_unlock(&sbi->s_mb_rb_lock); - ac->ac_last_optimal_group =3D *group; } =20 static inline int should_optimize_scan(struct ext4_allocation_context *ac) @@ -1017,11 +976,6 @@ next_linear_group(struct ext4_allocation goto inc_and_return; } =20 - if (ac->ac_flags & EXT4_MB_SEARCH_NEXT_LINEAR) { - ac->ac_flags &=3D ~EXT4_MB_SEARCH_NEXT_LINEAR; - goto inc_and_return; - } - return group; inc_and_return: /* @@ -1152,13 +1106,13 @@ void ext4_mb_generate_buddy(struct super EXT4_GROUP_INFO_BBITMAP_CORRUPT); } mb_set_largest_free_order(sb, grp); + mb_update_avg_fragment_size(sb, grp); =20 clear_bit(EXT4_GROUP_INFO_NEED_INIT_BIT, &(grp->bb_state)); =20 period =3D get_cycles() - period; atomic_inc(&sbi->s_mb_buddies_generated); atomic64_add(period, &sbi->s_mb_generation_time); - mb_update_avg_fragment_size(sb, grp); } =20 /* The buddy information is attached the buddy cache inode @@ -2705,7 +2659,6 @@ repeat: * from the goal value specified */ group =3D ac->ac_g_ex.fe_group; - ac->ac_last_optimal_group =3D group; ac->ac_groups_linear_remaining =3D sbi->s_mb_max_linear_groups; prefetch_grp =3D group; =20 @@ -2987,9 +2940,7 @@ __acquires(&EXT4_SB(sb)->s_mb_rb_lock) struct super_block *sb =3D pde_data(file_inode(seq->file)); unsigned long position; =20 - read_lock(&EXT4_SB(sb)->s_mb_rb_lock); - - if (*pos < 0 || *pos >=3D MB_NUM_ORDERS(sb) + 1) + if (*pos < 0 || *pos >=3D 2*MB_NUM_ORDERS(sb)) return NULL; position =3D *pos + 1; return (void *) ((unsigned long) position); @@ -3001,7 +2952,7 @@ static void *ext4_mb_seq_structs_summary unsigned long position; =20 ++*pos; - if (*pos < 0 || *pos >=3D MB_NUM_ORDERS(sb) + 1) + if (*pos < 0 || *pos >=3D 2*MB_NUM_ORDERS(sb)) return NULL; position =3D *pos + 1; return (void *) ((unsigned long) position); @@ -3013,29 +2964,22 @@ static int ext4_mb_seq_structs_summary_s struct ext4_sb_info *sbi =3D EXT4_SB(sb); unsigned long position =3D ((unsigned long) v); struct ext4_group_info *grp; - struct rb_node *n; - unsigned int count, min, max; + unsigned int count; =20 position--; if (position >=3D MB_NUM_ORDERS(sb)) { - seq_puts(seq, "fragment_size_tree:\n"); - n =3D rb_first(&sbi->s_mb_avg_fragment_size_root); - if (!n) { - seq_puts(seq, "\ttree_min: 0\n\ttree_max: 0\n\ttree_nodes: 0\n"); - return 0; - } - grp =3D rb_entry(n, struct ext4_group_info, bb_avg_fragment_size_rb); - min =3D grp->bb_fragments ? grp->bb_free / grp->bb_fragments : 0; - count =3D 1; - while (rb_next(n)) { - count++; - n =3D rb_next(n); - } - grp =3D rb_entry(n, struct ext4_group_info, bb_avg_fragment_size_rb); - max =3D grp->bb_fragments ? grp->bb_free / grp->bb_fragments : 0; + position -=3D MB_NUM_ORDERS(sb); + if (position =3D=3D 0) + seq_puts(seq, "avg_fragment_size_lists:\n"); =20 - seq_printf(seq, "\ttree_min: %u\n\ttree_max: %u\n\ttree_nodes: %u\n", - min, max, count); + count =3D 0; + read_lock(&sbi->s_mb_avg_fragment_size_locks[position]); + list_for_each_entry(grp, &sbi->s_mb_avg_fragment_size[position], + bb_avg_fragment_size_node) + count++; + read_unlock(&sbi->s_mb_avg_fragment_size_locks[position]); + seq_printf(seq, "\tlist_order_%u_groups: %u\n", + (unsigned int)position, count); return 0; } =20 @@ -3045,9 +2989,11 @@ static int ext4_mb_seq_structs_summary_s seq_puts(seq, "max_free_order_lists:\n"); } count =3D 0; + read_lock(&sbi->s_mb_largest_free_orders_locks[position]); list_for_each_entry(grp, &sbi->s_mb_largest_free_orders[position], bb_largest_free_order_node) count++; + read_unlock(&sbi->s_mb_largest_free_orders_locks[position]); seq_printf(seq, "\tlist_order_%u_groups: %u\n", (unsigned int)position, count); =20 @@ -3055,11 +3001,7 @@ static int ext4_mb_seq_structs_summary_s } =20 static void ext4_mb_seq_structs_summary_stop(struct seq_file *seq, void *v) -__releases(&EXT4_SB(sb)->s_mb_rb_lock) { - struct super_block *sb =3D pde_data(file_inode(seq->file)); - - read_unlock(&EXT4_SB(sb)->s_mb_rb_lock); } =20 const struct seq_operations ext4_mb_seq_structs_summary_ops =3D { @@ -3172,8 +3114,9 @@ int ext4_mb_add_groupinfo(struct super_b init_rwsem(&meta_group_info[i]->alloc_sem); meta_group_info[i]->bb_free_root =3D RB_ROOT; INIT_LIST_HEAD(&meta_group_info[i]->bb_largest_free_order_node); - RB_CLEAR_NODE(&meta_group_info[i]->bb_avg_fragment_size_rb); + INIT_LIST_HEAD(&meta_group_info[i]->bb_avg_fragment_size_node); meta_group_info[i]->bb_largest_free_order =3D -1; /* uninit */ + meta_group_info[i]->bb_avg_fragment_size_order =3D -1; /* uninit */ meta_group_info[i]->bb_group =3D group; =20 mb_group_bb_bitmap_alloc(sb, meta_group_info[i], group); @@ -3422,7 +3365,24 @@ int ext4_mb_init(struct super_block *sb) i++; } while (i < MB_NUM_ORDERS(sb)); =20 - sbi->s_mb_avg_fragment_size_root =3D RB_ROOT; + sbi->s_mb_avg_fragment_size =3D + kmalloc_array(MB_NUM_ORDERS(sb), sizeof(struct list_head), + GFP_KERNEL); + if (!sbi->s_mb_avg_fragment_size) { + ret =3D -ENOMEM; + goto out; + } + sbi->s_mb_avg_fragment_size_locks =3D + kmalloc_array(MB_NUM_ORDERS(sb), sizeof(rwlock_t), + GFP_KERNEL); + if (!sbi->s_mb_avg_fragment_size_locks) { + ret =3D -ENOMEM; + goto out; + } + for (i =3D 0; i < MB_NUM_ORDERS(sb); i++) { + INIT_LIST_HEAD(&sbi->s_mb_avg_fragment_size[i]); + rwlock_init(&sbi->s_mb_avg_fragment_size_locks[i]); + } sbi->s_mb_largest_free_orders =3D kmalloc_array(MB_NUM_ORDERS(sb), sizeof(struct list_head), GFP_KERNEL); @@ -3441,7 +3401,6 @@ int ext4_mb_init(struct super_block *sb) INIT_LIST_HEAD(&sbi->s_mb_largest_free_orders[i]); rwlock_init(&sbi->s_mb_largest_free_orders_locks[i]); } - rwlock_init(&sbi->s_mb_rb_lock); =20 spin_lock_init(&sbi->s_md_lock); sbi->s_mb_free_pending =3D 0; @@ -3512,6 +3471,8 @@ out_free_locality_groups: free_percpu(sbi->s_locality_groups); sbi->s_locality_groups =3D NULL; out: + kfree(sbi->s_mb_avg_fragment_size); + kfree(sbi->s_mb_avg_fragment_size_locks); kfree(sbi->s_mb_largest_free_orders); kfree(sbi->s_mb_largest_free_orders_locks); kfree(sbi->s_mb_offsets); @@ -3578,6 +3539,8 @@ int ext4_mb_release(struct super_block * kvfree(group_info); rcu_read_unlock(); } + kfree(sbi->s_mb_avg_fragment_size); + kfree(sbi->s_mb_avg_fragment_size_locks); kfree(sbi->s_mb_largest_free_orders); kfree(sbi->s_mb_largest_free_orders_locks); kfree(sbi->s_mb_offsets); --- a/fs/ext4/mballoc.h +++ b/fs/ext4/mballoc.h @@ -178,7 +178,6 @@ struct ext4_allocation_context { /* copy of the best found extent taken before preallocation efforts */ struct ext4_free_extent ac_f_ex; =20 - ext4_group_t ac_last_optimal_group; __u32 ac_groups_considered; __u32 ac_flags; /* allocation hints */ __u16 ac_groups_scanned; From nobody Tue Dec 16 04:06:23 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E103AC32771 for ; Mon, 26 Sep 2022 12:06:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239270AbiIZMGm (ORCPT ); Mon, 26 Sep 2022 08:06:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238995AbiIZMDC (ORCPT ); Mon, 26 Sep 2022 08:03:02 -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 6FCD87D79E; Mon, 26 Sep 2022 03:53:57 -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 B6C9CB80906; Mon, 26 Sep 2022 10:51:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AE6BC433C1; Mon, 26 Sep 2022 10:51:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189515; bh=ozJJzteAivKTxCNtCjbQSEkkc2fO/BrN+rWsBuy/hbE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sHG/+NXw/4rfiXlOSVKjQcy3YaDJM/k/TceNUG7vtWcRFyuI+u9ihn6DkMwlVl2zC wAL0iPfS/FCB1sKR+wS8/rtIvZgkqQ65rnoVI96Ax5nxrs2nXv/U2gMuKifUGECMR5 Qve/uL4ZSnADtYL3KwMe70q6C52jPqzZ8JamHswQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Jens Axboe Subject: [PATCH 5.19 207/207] Revert "block: freeze the queue earlier in del_gendisk" Date: Mon, 26 Sep 2022 12:13:16 +0200 Message-Id: <20220926100815.885168198@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christoph Hellwig commit 4c66a326b5ab784cddd72de07ac5b6210e9e1b06 upstream. This reverts commit a09b314005f3a0956ebf56e01b3b80339df577cc. Dusty Mabe reported consistent hang during CoreOS shutdown with a MD RAID1 setup. Although apparently similar hangs happened before, and this patch most likely is not the root cause it made it much more severe. Revert it until we can figure out what is going on with the md driver. Signed-off-by: Christoph Hellwig Link: https://lore.kernel.org/r/20220919144049.978907-1-hch@lst.de Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Fenil Jain Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Holger Hoffst=C3=A4tte Tested-by: Jiri Slaby Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- block/genhd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/block/genhd.c +++ b/block/genhd.c @@ -625,7 +625,6 @@ void del_gendisk(struct gendisk *disk) * Prevent new I/O from crossing bio_queue_enter(). */ blk_queue_start_drain(q); - blk_mq_freeze_queue_wait(q); =20 if (!(disk->flags & GENHD_FL_HIDDEN)) { sysfs_remove_link(&disk_to_dev(disk)->kobj, "bdi"); @@ -649,6 +648,8 @@ void del_gendisk(struct gendisk *disk) pm_runtime_set_memalloc_noio(disk_to_dev(disk), false); device_del(disk_to_dev(disk)); =20 + blk_mq_freeze_queue_wait(q); + blk_throtl_cancel_bios(disk->queue); =20 blk_sync_queue(q);