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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC6B5C433F5 for ; Wed, 13 Oct 2021 02:15:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6E51760E0C for ; Wed, 13 Oct 2021 02:15:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6E51760E0C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Owner; bh=TY0BauVeBCMUsTt8FGRSwONpVbR5u2ciPXt9FX6qlPA=; b=T6Dp+0hMvuztUY 7PP4/4rMDkR4e+1hvcNzq/i9MSDnVmItkVwgSFdscvdtSxSZZPyC+ozwtq7NHbAKqNlKlomHobxGi t5Z0wjXZ8HSO+EssTmq5pjp0ygunMkos7v9cFAZVCcf/BrMyahSVJ/VIEr6h4q6KJ8VLwhzoO6Skh H3K2Jq+8koocRoWK9XkQEd38T8c9C6Isx5LOmjvBT5rT0BhCuZu85bN3C+CoLVNMAtz2y7pAbdOh+ mjR9h8LtEitTGosW2nyltE3xCzsWOfp2MPy/0Ljjm6TxUF4EEGD+xZAW+UETE/iwU5qoa9j5Lu+Ep Ee9m5WXNLRSjNG80tmyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1maTld-00EdAo-Q2; Wed, 13 Oct 2021 02:13:17 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1maTlZ-00EdAP-DU for linux-arm-kernel@lists.infradead.org; Wed, 13 Oct 2021 02:13:14 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 30DE560E0C; Wed, 13 Oct 2021 02:13:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634091192; bh=KiCOpXJtLtS5DgA89L5VHZVV6seYAK79kT/+26LXy+U=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=rbsD9cK4wZlyphGRjfr1ysvki7scvQqV5s3dfffPqIGaP/N/LkDsfLMB+d5CagphS 4M4P783zd6dkXrVo7WRLzDUp/GDS2oqlaABys/puDUZ1JQ45KFZ5KXbai237P1udeA fPugekLr4JfA5M5S/mMyCGYl6R8tVZrXA7SZXhZL6mMg3bwwGcWh40vCqGEHo14LI7 tJBBW68o+EI+RR10wK8fdNONA1j4Qp7GF2qZ6SPG3aJX4L7KiEjcgez7IKGkl6DiCw 2wjGw63KR530UJz0DU17dQu12Spzf/cU+dG+gA33w5ZmtyYyQcR+ClKZWwnYeIKLEo co8UKkygxVpqw== Date: Tue, 12 Oct 2021 21:13:10 -0500 From: Bjorn Helgaas To: Naveen Naidu Cc: Pali =?iso-8859-1?Q?Roh=E1r?= , Rob Herring , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Petazzoni , bhelgaas@google.com, linux-kernel-mentees@lists.linuxfoundation.org, "moderated list:PCI DRIVER FOR AARDVARK (Marvell Armada 3700)" Subject: Re: [PATCH 09/22] PCI: aardvark: Use SET_PCI_ERROR_RESPONSE() when device not found Message-ID: <20211013021310.GA1864069@bhelgaas> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211012155928.3nuyzgrgvyjm2v3r@theprophet> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211012_191313_518911_05471F8D X-CRM114-Status: GOOD ( 38.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Oct 12, 2021 at 09:29:28PM +0530, Naveen Naidu wrote: > On 11/10, Pali Roh=E1r wrote: > > On Monday 11 October 2021 23:55:35 Naveen Naidu wrote: > > > On 11/10, Pali Roh=E1r wrote: > > > > On Monday 11 October 2021 23:26:33 Naveen Naidu wrote: > > > > > An MMIO read from a PCI device that doesn't exist or doesn't resp= ond > > > > > causes a PCI error. There's no real data to return to satisfy the > > > > > CPU read, so most hardware fabricates ~0 data. > > > > > = > > > > > Use SET_PCI_ERROR_RESPONSE() to set the error response, when a fa= ulty > > > > > read occurs. > > > > > = > > > > > This helps unify PCI error response checking and make error check > > > > > consistent and easier to find. > > > > > = > > > > > Compile tested only. > > > > > = > > > > > Signed-off-by: Naveen Naidu > > > > > --- > > > > > drivers/pci/controller/pci-aardvark.c | 8 ++++---- > > > > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > > = > > > > > diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/= controller/pci-aardvark.c > > > > > index 596ebcfcc82d..dc2f820ef55f 100644 > > > > > --- a/drivers/pci/controller/pci-aardvark.c > > > > > +++ b/drivers/pci/controller/pci-aardvark.c > > > > > @@ -894,7 +894,7 @@ static int advk_pcie_rd_conf(struct pci_bus *= bus, u32 devfn, > > > > > int ret; > > > > > = > > > > > if (!advk_pcie_valid_device(pcie, bus, devfn)) { > > > > > - *val =3D 0xffffffff; > > > > > + SET_PCI_ERROR_RESPONSE(val); > > > > = > > > > Hello! Now I'm looking at this macro, and should not it depends on > > > > "size" argument? If doing 8-bit or 16-bit read operation then shoul= d not > > > > it rather sets only low 8 bits or low 16 bits to ones? > > Function itself is declared as: > > = > > static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,= int size, u32 *val); > > = > > And in "size" argument is stored number of bytes, kind of read operation > > (read byte, read word, read dword). In *val is then stored read value. > > For byte operation, just low 8 bits in *val variable are set. > > = > > Because *val is u32 it means that typeof(*val) is always 4 independently > > of the "size" argument. > > = > > For example other project U-Boot has also pci-aardvark.c driver and > > U-Boot has for (probably same) purpose pci_get_ff() macro, see: > > https://source.denx.de/u-boot/u-boot/-/blob/v2021.10/drivers/pci/pci-aa= rdvark.c#L367 > > = > > I'm not saying if current approach to always sets 0xffffffff > > (independently of "size" argument) is correct or not as I do not know > > it too! I'm just giving example that this PCI code has very similar > > implementation of other project (U-Boot) which sets number of ones based > > on the size argument. I don't think there's an issue here. advk_pcie_rd_conf() can set the whole u32 to 0xffffffff regardless of the "size" value because pci_bus_read_config_byte() and pci_bus_read_config_word() extract out the part they need: res =3D bus->ops->read(bus, devfn, pos, len, &data); \ *value =3D (type)data; \ where "type" is u8 or u16 (this is hard to grep for; it's in the PCI_OP_READ() macro in drivers/pci/access.c). > I am not sure too, if we would like to have something like pci_get_ff() > which sets the return mask based on the size. I'd like to see how pci_get_ff() works because this is potentially a widespread, invasive change and it's always better to copy a good existing design than to make up something new. > > Anyway, I very like this your idea to have a macro which purpose is to > > explicitly indicate error during config read operation! And to unify all > > drivers to use same style for signalling config read error. I definitely think there's a lot of value in making this consistent *somehow*, so thanks for working on this! Bjorn _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel