Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2889077pxb; Tue, 12 Oct 2021 15:55:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIYCYKPpK7Z18x3yv/6PpS6zuXi5+zulAw6+yjA3OXlYzHCQmNdXL+WFh+qtfTSqkRPf3X X-Received: by 2002:a17:902:b095:b029:12c:de88:7d3b with SMTP id p21-20020a170902b095b029012cde887d3bmr32983844plr.15.1634079334466; Tue, 12 Oct 2021 15:55:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634079334; cv=none; d=google.com; s=arc-20160816; b=jeKfUSQ3HjYb8AVZwwI0/bU1nW+JMk4niwVn3CchfOj/I4TUXOM8Uune0mdxMYqvMr cpw96ied0eSDUh5kZXhh8cy5YpBajeD/03fWEgGJ/k8TRKud+THe+2sRRP9Lwr1CSdEj b4OVKKFTBBAyMzYus5uP09sYKPjenNqgZ8KTNDwXopfZwOV7WN9oxYp6DUSZcLrML1YP mrbjSR2o4DH8NjQaidVlWkLKWM0GhMmz6HWivVDDUOtdnDhnsJSM/1nEDFxyKzOCDAl0 9YtHQ0QkPutjeoBXrxFZJkv3q02l6JJDEm2Kj6HM8LyfzPCNQ7ilw79WWsi9RkLAiAg4 WBag== 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 :dkim-signature; bh=pDtRnXMMZ/auEfA3zeCgIqTmPHTioryFWgyKFnuR8Ro=; b=UM3YfX/JvdtGH0uH1PXc6YE5wKvh2hRz1w7TVnCK1kQq9z9lBwbRv7yL6XrW3VjvfA thkmtHzDgSbT5mEbB12DLskIweK07PA2FtlffC4qo2ygNoamqPG071c93ANVB0Nf1DkN 5bOeXHAINcS0Gtl4tcz3rm35mosBV+j3Tu4VAysk7BWjfgJO+5E4MHDG2bUuJN32HLcm pGl1x5IySrURTWljLwlpMSZXZbuis9THmMsUe1TdK5evXR6XWL2Ssle1LrQiwF5p65hH m5UOMqZOdKl4GVq8/tBGIQiq2qFXZU2b1pdfjtE/recXe5w4zebFDkB1TFhXe2yR34B6 VN+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tUPaJIq+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i4si14457629plb.86.2021.10.12.15.55.18; Tue, 12 Oct 2021 15:55:34 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tUPaJIq+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234280AbhJLWyv (ORCPT + 99 others); Tue, 12 Oct 2021 18:54:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:37236 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234607AbhJLWyu (ORCPT ); Tue, 12 Oct 2021 18:54:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4D21E604DA; Tue, 12 Oct 2021 22:52:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634079167; bh=6avHt35fxd5kfvbX66gcBjXd91rrPnS5ZdttP+UskTM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tUPaJIq+NbqOD928tKX1BaHll+Clbo11OlaJjS4L7fMEi3Wxh/KWrAvByhm27g5uI jHufW02Yvz1zwBCVPjT1Y/91WiqSaK4VXq419ncpNJKGlkB+Co8bjghoeZnZghTjy7 oWO7Ymrq2Z/HgxNplbaJCMFxu52HBXferNerq53AFNa0ZEZ5dvUb+TQ9Nxw1ris26r dBXS0CwwWl/xjHh8KKj91DETVIts+SXYLIGcB7Phu2VN9UzhbUS/hTcfnIcHwL924U tQFqx3LtPP6pUc3CDOd8v4r4ZBx6coeyaGD1YkX3x7pFxgIydvCfKGhTu3zZdMiaA1 yYZ8pclq0gZJQ== Received: by pali.im (Postfix) id A11267B4; Wed, 13 Oct 2021 00:52:44 +0200 (CEST) Date: Wed, 13 Oct 2021 00:52:44 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Naveen Naidu Cc: Rob Herring , bhelgaas@google.com, linux-kernel-mentees@lists.linuxfoundation.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, andrew.murray@arm.com Subject: Re: [PATCH 02/22] PCI: Unify PCI error response checking Message-ID: <20211012225244.y75fsd7777ubvljl@pali> References: <20211012162054.rxx7aubwdvhl2eqj@theprophet> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211012162054.rxx7aubwdvhl2eqj@theprophet> User-Agent: NeoMutt/20180716 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 12 October 2021 21:51:08 Naveen Naidu wrote: > On 11/10, Rob Herring wrote: > > On Mon, Oct 11, 2021 at 11:08:32PM +0530, Naveen Naidu wrote: > > > return PCIBIOS_DEVICE_NOT_FOUND; > > > > Neither does this using custom error codes rather than standard Linux > > errno. I point this out as I that's were I'd start with the config > > accessors. Though there are lots of occurrences so we'd need a way to do > > this in manageable steps. > > > > I am sorry, but I do not have any answer for this. I really do not know > why we return custom error codes instead of standard Linux errno. Maybe > someone else can pitch in on this. More people are asking same question and Bjorn recently wrote answer: https://lore.kernel.org/linux-pci/20211011205851.GA1690395@bhelgaas/ It looks like some relict from past when PCI was implemented only for x86. Anyway, I was looking at PCI firmware spec (where are these PCBIOS_* codes defined) and config read function can return only PCIBIOS_SUCCESSFUL value. So if kernel PCI API is following this PCBIOS API it means that controller drivers are implementing it improperly if they returns also non-success value for read method in some cases. And for me it looks like very "stupid" API for read as it has basically same meaning as function with void return value. > > Can't we make PCI_OP_READ and PCI_USER_READ_CONFIG set the data value > > and delete the drivers all doing this? Then we have 2 copies (in source) > > rather than the many this series modifies. Though I'm not sure if there > > are other cases of calling pci_bus.ops.read() which expect to get ~0. > > > > This seems like a really good idea :) But again, I am not entirely sure > if doing so would give us any unexpected behaviour. I'll wait for some > one to reply to this and if people agree to it, I would be glad to make > the changes to PCI_OP_READ and PCI_USER_READ_CONFIG and send a new > patch. If you are going to discuss and change API of config read / write functions, please CC me. For example pci-aardvark controller reports not only "unknown error" happened (via 0xffffffff) but can report exact PCIe error (CRS, UR, CA) which can be mapped to some linux errnos. I can imagine that it can be useful for some callers.