From mboxrd@z Thu Jan 1 00:00:00 1970 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 9E7C5C433EF for ; Wed, 23 Feb 2022 11:09:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239758AbiBWLJe (ORCPT ); Wed, 23 Feb 2022 06:09:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231288AbiBWLJc (ORCPT ); Wed, 23 Feb 2022 06:09:32 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C47D51E67; Wed, 23 Feb 2022 03:09:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645614545; x=1677150545; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=bEi1L6SwVM/6CJVdlUOVjo6ZwWjlnoYanZAzOTomTqU=; b=OR+FWQGY01xMPHwuWYMZ+/Gyq8NrmE2PSPIH4+StWiQXmpoYU6TJvdct zeOkfKNmUVJAOI+v76L5M5wwDQDjwPQRjjYUuXQu8QhivLM4LMT//Jl15 ECaXKRi41vWwLbeRwfCdpP1o23kT3jA5zEYNe2kO5d/85UdDDdo4iU6QM LK2dYu8AJQECuswVXCqxTGfYMrV1L9LBQ05aaS1KJvkbc6Ac7eRzNpSDC mCW75KdrGQi4xHaDUlbFgN4StNd0vDZwOrmCIjHKYi+RzNwiOIqzAhTfY GjTvE+Xqx63jSFvjICy8K9RAGwLh27QrtMIXy0a2DBWDKATj2fi7guF53 Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10266"; a="252131954" X-IronPort-AV: E=Sophos;i="5.88,390,1635231600"; d="scan'208";a="252131954" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2022 03:09:04 -0800 X-IronPort-AV: E=Sophos;i="5.88,390,1635231600"; d="scan'208";a="639268315" Received: from smile.fi.intel.com ([10.237.72.59]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2022 03:09:02 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nMpVD-007O3U-JA; Wed, 23 Feb 2022 13:08:11 +0200 Date: Wed, 23 Feb 2022 13:08:07 +0200 From: Andy Shevchenko To: Christoph Hellwig Cc: Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: Re: [PATCH v2 2/2] serial: 8250_lpss: Switch to pcim_iomap() instead of pci_ioremap_bar() Message-ID: References: <20220215134359.78169-1-andriy.shevchenko@linux.intel.com> <20220215134359.78169-2-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 22, 2022 at 08:02:10AM -0800, Christoph Hellwig wrote: > On Tue, Feb 22, 2022 at 10:14:16AM +0100, Jiri Slaby wrote: > > On 16. 02. 22, 9:53, Christoph Hellwig wrote: > > > On Tue, Feb 15, 2022 at 03:43:59PM +0200, Andy Shevchenko wrote: > > > > The pci_iounmap() doesn't cover all the cases where resource should > > > > be unmapped. Instead of spreading it more, replace the pci_ioremap_bar() > > > > with pcim_iomap() which uses managed resource approach. > > > > > > pcim_iomap requires the use of ioreadX/iowriteX and thus runtime > > > overhead. So in doubt please add a pcim_ioremap_bar instead of forcing > > > the legacy iomap/ioread/iowrite API onto modern drivers tht can't > > > support legacy port I/O. > > > > Hmm, the driver combines pci_ioremap_bar with pci_iounmap. pci_iounmap does > > the right thing after all, but is that correct? And this driver is not > > alone, this shows more: > > git grep -E 'pci_iounmap|pci_ioremap_bar' `git grep -l pci_iounmap \`git > > grep -l pci_ioremap_bar\`` > > I think it is wrong. It is not actively harmful unlike the the > combination of pci_iomap and then later use of accessors from the > ioremap family, but still not exactly a good idea. > > In a perfect world we'd have some different annotation from __iomem > for the whole iomap family of functions. So, what would be your suggestion for a) backportable change b) cleanup for the current and future drivers? -- With Best Regards, Andy Shevchenko