Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2145338pxb; Fri, 25 Mar 2022 11:54:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZKnEuyP7We2jKn/1zce2aUK4CmuVxmVu4OeUTl+rIQcgDT52GgjXbMABoVItoJIxpyXzR X-Received: by 2002:a17:902:f605:b0:14d:bd53:e2cd with SMTP id n5-20020a170902f60500b0014dbd53e2cdmr13045383plg.164.1648234459641; Fri, 25 Mar 2022 11:54:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648234459; cv=none; d=google.com; s=arc-20160816; b=nkBlRyck4qmYWqD4u1NM3+8B9dsGfU4PhPkvSkwuaJRzbY+SAtdq9gp8PyW5oJJgol OUmSfnuXso0e7leHAmcj+nDGhtCBjuUtuxNh+741zAgn5bMY3ZNYSz6zuxkAWwLCPnQo tl6xBL8IC30J36bNh7jOCT+E5f8lZjg+Tn+MtN3e8GQokEJELcNV7HyZQWWTFkEfPDoC 6DyphRZQsPAPyhnLxmAUaq+vu3slnyc5PtXUttL9kowQ2wUcmW0I27u094luzPTU7Xqc wLCT1Pm5++JeYbD99PlX8Z4xvJl1KexhXPkF4wx4vg1T+MFFhcOgrvg7yDUhQpGx5d5y XBCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=5/sNFPyS9X1MSKqG7BG5Oj5rNtaT+XpntkLUmeKZ2sg=; b=UECqcOl95UQNuLNmUHn25yTyVqz1xOSgzIsfZIxx/FP4dT7ZzpzSVmXhyOIlv6Jms0 Vsx4yDqVZ6rp4B/GdkDGnR2qHECNs2lVnkWY9t2cRFqmzyaGwrKA1x1yLyTRqDFnatci COYPep1QeUJCO8YGkMr4dcWZ4et9YZe8S5nploJ4/lS3dISW7JY+4ACBaXITaEMrL7w5 kHlpusCHR4SYSKcSBVe9RwjAwy6XmP+22936jXO2nC9/tHKKwZAdmF40zT8mR1THH63z /Ij12hwhUhlh5osafjNpfvTg83Rk8uHJdKAi+dv7ly0ogQQXfi4vwY9QwtYbbbA8X130 U8nQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j1-20020a632301000000b003816cefccacsi3162237pgj.22.2022.03.25.11.54.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 11:54:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BBDD01C9472; Fri, 25 Mar 2022 11:06:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245616AbiCXLbH (ORCPT + 99 others); Thu, 24 Mar 2022 07:31:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235263AbiCXLbD (ORCPT ); Thu, 24 Mar 2022 07:31:03 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19D7B1F60D; Thu, 24 Mar 2022 04:29:32 -0700 (PDT) X-IronPort-AV: E=McAfee;i="6200,9189,10295"; a="240509841" X-IronPort-AV: E=Sophos;i="5.90,207,1643702400"; d="scan'208";a="240509841" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2022 04:29:31 -0700 X-IronPort-AV: E=Sophos;i="5.90,207,1643702400"; d="scan'208";a="717783370" Received: from smile.fi.intel.com ([10.237.72.59]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2022 04:29:29 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nXLe9-005mjT-Ua; Thu, 24 Mar 2022 13:28:53 +0200 Date: Thu, 24 Mar 2022 13:28:53 +0200 From: Andy Shevchenko To: "Maciej W. Rozycki" Cc: Mauro Carvalho Chehab , Andy Shevchenko , Greg Kroah-Hartman , Jiri Slaby , "open list:SERIAL DRIVERS" , Linux Kernel Mailing List Subject: Re: [PATCH v2 1/2] serial: 8250: Add proper clock handling for OxSemi PCIe devices Message-ID: References: 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 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,SPOOFED_FREEMAIL_NO_RDNS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 23, 2022 at 09:59:28PM +0000, Maciej W. Rozycki wrote: > On Fri, 18 Mar 2022, Andy Shevchenko wrote: > > > > It does allow one to program the full clock divider range of the OxSemi > > > devices. I find it appropriate according to my engineer's code of good > > > practices. And it doesn't cause any burden for non-OxSemi code. > > > > How BOTHER does prevent you doing the same? > > It does not allow you to set arbitrary serial port clock rates. You can > only set integer baud rates, Why do you need fractional baud rates? What is the practical use of that, please? > and then only those that do not exceed the [1;65535] clock divisor > range. Can you be more specific as I can't see how it's possible in practice? In several 8250 drivers we are able to set whatever we want to the limits of the hardware. > > > So I have had a look at how it has been done for other drivers and I have > > > now convinced myself against such a split. The primary reason for this > > > conclusion is that there is no basic infrastructure for such a split and > > > the ultimate result is code duplication with no clear benefit to justify > > > it. > > > > Justification for split is to keep certain quirks out of the scope of the > > generic driver. I'm not sure what duplication you are talking about if the > > LOC statistics shows otherwise. > > All the init/remove code is almost the same across all the devices. Each of the platform has its own constraints and what you see as a repetition is just a similarity. If you have an idea of the common probe function, please share. Also, don't forget the memory footprint case at run time. In embedded world we do not need 8250 code that is not supported by the platform in question. The split allows to disable / remove the code that is not needed. > And suspend/resume and PCI error handling code has been removed from the > split off devices, This is managed by PCI core. Any specifics, please? > and for the functional regression to be fixed: > > 1. this code would have to be replicated, or > > 2. handlers from the generic 8250_pci.c driver exported and referred to, > or > > 3. some kind of a helper library (or a core module) created providing this > stuff to 8250_*.c drivers as required. Which functional regression? You mean if it will be found then it needs to be fixed in several places? > I guess the latter is the minimum that could convince me this driver > framework is usable for implementing device-specific drivers (as I find > the other variants rather miserable hacks). > > Plus there would have to be clear information provided to the users as > otherwise people will be rather confused as to why 3 out of their 4 16x50 > PCI/e serial cards work with 8250_pci.c while the remaining one does not > (probably broken, or is it?). The default configuration after the split assumes that the driver is enabled by the very same kernel configuration. Otherwise distributions will choose what they consider better for their users and customers. > > You may not want to get the idea, it's fine. The rationale is simple: > > isolate quirks for certain platform(s) in one place. Each platform > > in a separate module. > > What is a platform in your terminology? A PCI/e option card you can > install in about any modern computer? I usually think of platforms as > specific families of computers rather than option cards. Variants of > otherwise the same device are usually handled with a single driver in > Linux. It might be PCIe card, it might be soldered on the motherboard, it can be part of the SoC. By platform I assume the certain SoC + certain discrete components wired in a certain way (PCB level). In your case it's a motherboard with PCIe serial port card. -- With Best Regards, Andy Shevchenko