Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2921940pxj; Mon, 10 May 2021 13:58:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhAVF7UBZwkmBhivyj8YAMDdpi6KpWyF5bhb6/e5cGm9HIcesYlkrGifMskUeJ5CDdLFI/ X-Received: by 2002:aa7:d702:: with SMTP id t2mr31482034edq.367.1620680292944; Mon, 10 May 2021 13:58:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620680292; cv=none; d=google.com; s=arc-20160816; b=WvqokXjIzbC5RCgvReH6peBPve1hfNxZA2Az3h21fENXQKT+c2/YQQwO9rX1w5UvqK IqsmZrzEcvwuH/oxHpdXiWy9op2Ytf6y+KHCY6GB7y/a3vsizHX6xL1xG2zuH9GiSxSd KakX//Yp+RQJuOIVsHUcHNEPRV+Ranc+H8J/QJOeVrIKmghhD4tM7BQD/1kXasbI+TYi j9OkuCQv+MU6EkBcyOb2/SDPPF9LNhiEz656cqt2dYQws3vGrHwlddgN1hGMQfcb7FvZ m2bC7bQFuNbQlRQo2JUnb/5Lax1cnkmEYSJvFVDA1ssGwo5hIoLrfUBqsDneLrSr2Hs1 BYqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=bhuRUxRiyfEsLJyYJB5x2DXDbovRncwZgRDrZRMaBJY=; b=fPdo8fz2EKw+QJaOItF18F06PgrHivrpM+As/rdJASS8C4y6BjsJpRo/y68RX3x94N K6cwJjYUdzgMq01mauQVy63IhrmBE3CEBbPZ51JyXy13ceUMY8nQ256aXBHIn6/nDbGl Xv/VeLF2wKaLzoX2paC5WsePCL8vfdsJOFwarQD7mlXLHDarZsoPDW6i5cBt+sI+IFa2 TjU/1mSwj2HMPfc63UtuiVg/GYec6rP+cc51V+tMU/da1hXlf4Cjb0ZHIRSTipanamu1 jsAukQHB/ZdOrNHgGDRSFwGQyIOWrM7Ktc+gMPTsas0TPl8GJitHFxkdja45C8NlHbhr QAWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id go43si14083151ejc.620.2021.05.10.13.57.49; Mon, 10 May 2021 13:58:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232755AbhEJU56 (ORCPT + 99 others); Mon, 10 May 2021 16:57:58 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:58198 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232082AbhEJU55 (ORCPT ); Mon, 10 May 2021 16:57:57 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 0BC601C0B76; Mon, 10 May 2021 22:56:51 +0200 (CEST) Date: Mon, 10 May 2021 22:56:50 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Bhaumik Bhatt , Hemant Kumar , Manivannan Sadhasivam Subject: Re: [PATCH 5.10 002/299] bus: mhi: core: Clear configuration from channel context during reset Message-ID: <20210510205650.GA17966@amd> References: <20210510102004.821838356@linuxfoundation.org> <20210510102004.900838842@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="TB36FDmn/VVEgNH/" Content-Disposition: inline In-Reply-To: <20210510102004.900838842@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --TB36FDmn/VVEgNH/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Bhaumik Bhatt >=20 > commit 47705c08465931923e2f2b506986ca0bdf80380d upstream. >=20 > When clearing up the channel context after client drivers are > done using channels, the configuration is currently not being > reset entirely. Ensure this is done to appropriately handle > issues where clients unaware of the context state end up calling > functions which expect a context. > +++ b/drivers/bus/mhi/core/init.c > @@ -544,6 +544,7 @@ void mhi_deinit_chan_ctxt(struct mhi_con > + u32 tmp; > @@ -554,7 +555,19 @@ void mhi_deinit_chan_ctxt(struct mhi_con =2E.. > + tmp =3D chan_ctxt->chcfg; > + tmp &=3D ~CHAN_CTX_CHSTATE_MASK; > + tmp |=3D (MHI_CH_STATE_DISABLED << CHAN_CTX_CHSTATE_SHIFT); > + chan_ctxt->chcfg =3D tmp; > + > + /* Update to all cores */ > + smp_wmb(); > } This is really interesting code; author was careful to make sure chcfg is updated atomically, but C compiler is free to undo that. Plus, this will make all kinds of checkers angry. Does the file need to use READ_ONCE and WRITE_ONCE? Best regards, Pavel --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --TB36FDmn/VVEgNH/ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAmCZnhIACgkQMOfwapXb+vLm+QCgrjtqO/fk9hdWsOqd82lCs93/ OkAAoJT5b/Oi5j5XtOKXCYwDFMuvzCYA =NHPs -----END PGP SIGNATURE----- --TB36FDmn/VVEgNH/--