Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3852337rdh; Fri, 29 Sep 2023 04:33:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH2+g2oR/YtplH8cI+mvP7Prb70IgNfxDwggYIALJc6qNEn9GJxX5YCKSyqkXlXmOfecnhH X-Received: by 2002:a17:90b:2397:b0:279:1141:398b with SMTP id mr23-20020a17090b239700b002791141398bmr3599946pjb.26.1695987216338; Fri, 29 Sep 2023 04:33:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695987216; cv=none; d=google.com; s=arc-20160816; b=sUpWyC3F+BPxQl+gYqK6T1P8HYJfxYIkoo/4/VLuJa7cQr2AiwhTckvkfmrOAS+5xl y2iHKzvIoM/C+H+HsL9URodaY0Ogu4JWLPzXheV9QxUDSB5yovfr6AVB9rztPt+0S1k1 Zgn/srTcHHLBFdjOrJ6d7nB5J/f2LxJfrFdX2x+pfmSXFEvQPVs55epgkJfZ0aDq66z6 Xa/M1lj+YzLWXqw3+4IeaTjvZu6rody03AR9HkQOlnoXdyNERuoh33h0RTGI59QGYCpK BmU6oSY6nB2Z6M6d0GRG5e0TJ7H8ZSz1dkRW3D1wyNyiFeBmU5mPPVMODTau2bBltNJS W/CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:to:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=zGtdaO/YAmlW3z8quauxQlXf0fKn8jo81WvE2rNC+EE=; fh=zY1Iea6cLNxqfV67K/RVo9Wmo1DAtsMPXqPZgDALLyY=; b=l3Zp9dAh2u/g7rOiRGtROU+khcrWM9Ofr8i8zPxuKvIrzYezaj3roWPizAaZdGive2 n+RK6q9BWjvCIIMHWxZXPdNo4POFo2sic9Uzg9+Dh9xwDBzPzn95fJETATbexPRJ14Er Q7U5TnkCXXryt381upNDeppT7XhkvbwNAHhZdXi8pTft0hUvNnVdM+OLkhNyPwgeRSCS kE0XEQA7J6hO6SQDYaz1brDESxR4gguKf4+yR9i638LvkhJ/hjsG/pVib3/HU+I/Ct2+ rZli82PznumnoXnO8lozPV7UJDQTMbGukNpkMnWAAdxpKp9JdNK/gV8nYybO4zAnkpRQ PanQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Zv2TUz9I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id z14-20020a17090acb0e00b0027474b117f7si1377426pjt.21.2023.09.29.04.33.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 04:33:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Zv2TUz9I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 4569F826F7CE; Fri, 29 Sep 2023 01:48:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232757AbjI2IsT (ORCPT + 99 others); Fri, 29 Sep 2023 04:48:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231429AbjI2IsS (ORCPT ); Fri, 29 Sep 2023 04:48:18 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67DD3AC; Fri, 29 Sep 2023 01:48:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695977296; x=1727513296; h=message-id:date:mime-version:subject:to:references:from: in-reply-to:content-transfer-encoding; bh=3M7aFFgj+OG/B4ua2iQPHy8g+N3GH2j+D8XnoTVg0ek=; b=Zv2TUz9IjnJ0nLmVdkHDEt2VUyzYgHliYu+IjSjGSW0OtZPG6RLznTHh gsBKdiaHJPFNIBf9ZBv12BjuFZjhWI4VbGQi2yRUO/ZvyVcHd8qiA0UJ6 E4+vTKDDtMDlOxa6CuGhfMLJXwebNVQUM5/N6QNuJQF0Y4/H8YSWbUVT5 Zn69Jj/NzQPb9auLG8SR26d0PbAkph62ImK4Po/2N42OuwrgqRuFVwL6+ xct5AtO/+C/jHxvvEziTGhJjA6FSkZnn3AmhgMw9XaK7SwVWkkQpusqjX 5VX54tiYZhyzzusp1vy/ESjJJ4md+VY+gaJm8LVT6+305LjU7oA2BL5Ml Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="448753071" X-IronPort-AV: E=Sophos;i="6.03,186,1694761200"; d="scan'208";a="448753071" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2023 01:48:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="1080861194" X-IronPort-AV: E=Sophos;i="6.03,186,1694761200"; d="scan'208";a="1080861194" Received: from mylly.fi.intel.com (HELO [10.237.72.66]) ([10.237.72.66]) by fmsmga005.fm.intel.com with ESMTP; 29 Sep 2023 01:48:11 -0700 Message-ID: <1d56ceef-6573-43b9-a050-124c341a0698@linux.intel.com> Date: Fri, 29 Sep 2023 11:48:10 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] i2c: designware: Fix corrupted memory seen in the ISR To: Wolfram Sang , Jan Bottorff , Serge Semin , Yann Sionneau , Catalin Marinas , Yann Sionneau , Will Deacon , Andy Shevchenko , Mika Westerberg , Jan Dabros , Andi Shyti , Philipp Zabel , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org References: <9219ad29-b9a3-4f07-81b5-43b4b6d9d178@os.amperecomputing.com> <3a305e74-2235-47ab-8564-0c594f24dc0a@os.amperecomputing.com> Content-Language: en-US From: Jarkko Nikula In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 29 Sep 2023 01:48:27 -0700 (PDT) On 9/27/23 22:38, Wolfram Sang wrote: > >> So my next question, is the change to dw_reg_write something that I should >> write and submit, or should someone else submit something more generalized, >> like option 2 above? I don't own the i2c driver, I'm just trying to fix one >> issue on one processor with minimal risk of breaking something. I don't have >> the broader view of what's optimal for the whole DesignWare i2c driver. I >> also don't have any way to test changes on other models of processors. > > Well, I guess this is a question for the designware maintainers: do we > want this one conversion from *_relaxed to non-relaxed. Or are we > playing safe by using non-relaxed all the time. I would suggest the > latter because the drivers I look after hardly write registers in a hot > path (and not many of them at a time). But you guys know your driver > better... > Well I don't have any preference (read enough knowledge) either here and I hardly think performance becomes issue in any configuration. Not a showstopper to this fix nor necessarily need to cover either but one another memory barrier case might be in i2c-slave flows: 1. I2C bus read/write from another host 2. Interrupt to i2c-designware IP i2c-designware-slave.c: i2c_dw_isr_slave() i2c-core-slave.c: i2c_slave_event() -> irq handler goes to slave backend like i2c-slave-eeprom i2c-slave-eeprom.c: i2c_slave_eeprom_slave_cb() 3. Shared data between irq handler and process context struct eeprom_data is accessed both from irq handler via i2c_slave_eeprom_slave_cb() and process context via sysfs node handlers i2c_slave_eeprom_bin_read() and i2c_slave_eeprom_bin_write()