Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp551831rdh; Tue, 19 Dec 2023 06:57:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IESqSivkboW7haVq2t62pkaxmQUgmh6eL0kYi7uDGaDLKMsc6ndfFPxHlf8cnqZPKDE08cX X-Received: by 2002:a17:907:78d1:b0:a26:8825:f74c with SMTP id kv17-20020a17090778d100b00a268825f74cmr127017ejc.30.1702997847538; Tue, 19 Dec 2023 06:57:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702997847; cv=none; d=google.com; s=arc-20160816; b=021WTrmDAt/ZyRbkMFJHlJ2tJTp+pwJahpQUjNhqvGHlL77rR2xaUZ9AuDSJYWnlUl S7vyFdkZcVAN6vyOY7EiI9zgIcfiQ+7c6fMs4jyISy/g6YdX+W8fMtbA/eZFe9hOpECp UwMkVDAKOD3Vsi/B2MKnXVbUg6a/uWxvU4NC5l89b1nkgykZYzy1ZEvvCtcyiEUOV2aJ K72+1rO4lrBcYCOaXmi0l6BZr+M9HoIx4nzy5JLhS0hAp0AE5w0Eqg5xzU7bXnB2yGx7 z7mX/T26coF8b5fise6PXio+bAGaanau2/ByvRCY3SGXSFe5NORXl2+TIXuyvqFmbdiE md4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=organization:in-reply-to:content-transfer-encoding :content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:references:message-id:subject:cc:to:from:date; bh=ilhh/lU2rmIznEn6Q/onXOFMLFTaaRQUjg0FBX9T4ks=; fh=IAan2q73USk3b3qchze0otV7KkguFi8vp3SVNa2z3os=; b=Z0xUM8tQpkqxHtAfe2JCStRSdD2+NCmTUh5vivFs/3/R6Co7HnqdwNiR7c+IA8AM68 b47jHcgvdUqsjUhwm+KpO/YeDgEm3YIDc5hYZ4ZTEYe6wwgdkiy/JqaBHwrOUXLVHwkp zk0rt+Rhk+NzqXR5vZr3lDM2F2O1odkqsiO2B8RoqVgTKn2iNac404+tesoGgCjhYhoF kIgGP/Z9i1FHj6SqKoLTz22rWWRgQk9d0WbHTm7PtjsNcLONbLUz3qC0IYY/Uzqkw+vJ QGzxMFCDPXSUhEUSI0O7x1HhnYeGqRIsq+0n7TLKzko95I2y9hvsg8svckXeVi/WSdcO Oe0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-5413-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5413-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id t9-20020a1709063e4900b00a2367f711b4si1266196eji.844.2023.12.19.06.57.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 06:57:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5413-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-5413-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5413-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6C1771F2DD19 for ; Tue, 19 Dec 2023 14:49:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3003B1BDF4; Tue, 19 Dec 2023 14:49:26 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B62D1C284; Tue, 19 Dec 2023 14:49:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=kernel.org X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="460009654" X-IronPort-AV: E=Sophos;i="6.04,288,1695711600"; d="scan'208";a="460009654" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2023 06:49:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="866655630" X-IronPort-AV: E=Sophos;i="6.04,288,1695711600"; d="scan'208";a="866655630" Received: from smile.fi.intel.com ([10.237.72.54]) by FMSMGA003.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2023 06:49:21 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rFbPK-00000007Hww-3Wxb; Tue, 19 Dec 2023 16:49:18 +0200 Date: Tue, 19 Dec 2023 16:49:18 +0200 From: Andy Shevchenko To: xiongxin Cc: fancer.lancer@gmail.com, hoan@os.amperecomputing.com, linus.walleij@linaro.org, brgl@bgdev.pl, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, stable@kernel.org, Riwen Lu Subject: Re: [PATCH v4] gpio: dwapb: mask/unmask IRQ when disable/enale it Message-ID: References: <20231219101620.4617-1-xiongxin@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231219101620.4617-1-xiongxin@kylinos.cn> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Tue, Dec 19, 2023 at 06:16:20PM +0800, xiongxin wrote: Code wise it's fine, but while answering to Serge's email I realized that the Subject has a typo and additionally you or Bart (if he is fine with that) can amend: > In the hardware implementation of the i2c hid driver based on dwapb gpio I?C HID (alternatively: I2C HID) here and everywhere else in the commit message unless it's the file or function name. > irq, DesignWare GPIO IRQ chip > when the user continues to use the i2c hid device in the suspend > process, the i2c hid interrupt will be masked after the resume process > is finished. > > This is because the disable_irq()/enable_irq() of the dwapb gpio driver DesignWare GPIO > does not synchronize the irq mask register state. In normal use of the IRQ > i2c hid procedure, the gpio irq irq_mask()/irq_unmask() functions are > called in pairs. In case of an exception, i2c_hid_core_suspend() calls > disable_irq() to disable the gpio irq. With low probability, this causes GPIO IRQ > irq_unmask() to not be called, which causes the gpio irq to be masked GPIO IRQ > and not unmasked in enable_irq(), raising an exception. > > Add synchronization to the masked register state in the > dwapb_irq_enable()/dwapb_irq_disable() function. mask the gpio irq GPIO IRQ > before disabling it. After enabling the gpio irq, unmask the irq. GPIO IRQ IRQ -- With Best Regards, Andy Shevchenko