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 B98A4C433F5 for ; Mon, 11 Oct 2021 18:30:39 +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 7B0B560E90 for ; Mon, 11 Oct 2021 18:30:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7B0B560E90 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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:References: 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: List-Owner; bh=B1ghlmtIFMz9Bt9cVXeV8ntPmfqBcyP4ZONc7KHaXPA=; b=P9gbiJt6l5ZQB8 +AKuU3F1CUncI5yf63yJRuuaRdfJzg8LuWsnXC2X7mV5FEYOsk91brbmOLfEO0ENjW2M2VX2Gz6aj NxbycrR1CiAx3ZHVDFY11dDg28G0TbB4yWIKfrlOwIlvRVXpwPy8ce6nK2BJ0S4x9GwOXm1h8ezIr XrTRbHmkhH3PhxWbN9cf4qYQOgNACkiS+A3T2m6C8P/7PwC+iAYxZameWQllTH843j5ElPHwtpB5N mAM0V2HIlkR8pGaHZD7h8DrmB3vQwfX2yOoeFW18H/viUiX+SMo3wRR/NJuAQSwNxOQQ3/ZtybJ5b jqlhWWY5aNeId/Qwsusw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ma02G-00ANgh-Qk; Mon, 11 Oct 2021 18:28:29 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ma02D-00ANgB-0K for linux-arm-kernel@lists.infradead.org; Mon, 11 Oct 2021 18:28:26 +0000 Received: by mail-pj1-x102a.google.com with SMTP id oa12-20020a17090b1bcc00b0019f715462a8so616731pjb.3 for ; Mon, 11 Oct 2021 11:28:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=CKQ88c9j3ESKQlxCKVCJzIzhEW8MF9O1pZyFGKOEDrA=; b=oTJLSzyQmCsA6lgeeHn3VxbHP/ZOM0tZi+M/YKcnDvCFUl77KdxyP1DHUHGfghJnEl CXzyW7Oh+NADAL/pD0I5kOjOFjcUMNfnINCOLUbM6NF42GHYCMRmzdyxNOR/fe8EXgh+ VUP3TfYmm/0k51dSuPgYLbN7BSgB+W2gaYslaEmh1LPGFF3PXoONvcwfSFYvr8uaiLVn U06MgH5wqjmgyKYO7svrg3Syld5W5Z1C9cTJbCuVC90S9NFSJvQnUL00t2nZIz42J0JP pN2IDRWx406mFVDwF4qdz7R7m50JVQE9XFVXtdf7ofMDZPDTyugGr0fJa4pYWELMwwtJ VcdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=CKQ88c9j3ESKQlxCKVCJzIzhEW8MF9O1pZyFGKOEDrA=; b=FLTCOF1o4GhxEjkP7ccOdFeTPFfk3N0nvKjOAjr3d89wyfYG7wkdDwNFfTnaX5OiUY qK5NFmlIdogLxge+V91pN/CU8Z0x1lEKckGnFqRAp/Ndxv+p9WylSmz4HeIp7fF/cOLW tAk8XYX510V5mh9UbVmsSUZHD6YPb8BLfAnoMB9R//frXoXLfbZ4m2TVDh5CxxKH9XkF PjIySZBrv6nUXg6uRzfAEZHO6CzYCfwe+t+Rg6LqJkbmrHd+MFpv7s+NyYskDz3rwemx A8nw8T9+sz/GYNk6PJcmDdIJz7vIDxmdbq0mOsmKL1xPrq14Wvg9OgLB7/g/wJPyuE8c 1bNA== X-Gm-Message-State: AOAM532/8qN3XWsClg20/7wIqw4WNETckOUyRlEV+OukCz62lWUY3oSV Ajewl1ga9Kys5km1DVD0/Sk= X-Google-Smtp-Source: ABdhPJxia+sjT3Qg+xTt/VNqtfY33guuOiShsseFdWJ387zSt1snrx1KhCUiVCrhs20k1oIksdC5Iw== X-Received: by 2002:a17:90a:708c:: with SMTP id g12mr634723pjk.13.1633976903685; Mon, 11 Oct 2021 11:28:23 -0700 (PDT) Received: from theprophet ([2406:7400:63:9f95:848b:7cc8:d852:ad42]) by smtp.gmail.com with ESMTPSA id y17sm5130041pfn.96.2021.10.11.11.28.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Oct 2021 11:28:23 -0700 (PDT) Date: Mon, 11 Oct 2021 23:58:13 +0530 From: Naveen Naidu To: Pali =?utf-8?B?Um9ow6Fy?= Cc: bhelgaas@google.com, linux-kernel-mentees@lists.linuxfoundation.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Petazzoni , Lorenzo Pieralisi , Rob Herring , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , "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: <20211011182813.duescywvlkkvddjp@theprophet> References: <20211011180850.hgp4ctykvus37fx7@pali> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211011180850.hgp4ctykvus37fx7@pali> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211011_112825_075744_E7BA0F0A X-CRM114-Status: GOOD ( 25.88 ) 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 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 respond > > 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 faulty > > 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/contro= ller/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, u= 32 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 should not > it rather sets only low 8 bits or low 16 bits to ones? > Hello o/, Thank you for the review. Yes! you are right that it should indeed depend on the "size" argument. And that is what the SET_PCI_ERROR_RESPONSE macro does. The macro is defined as: #define PCI_ERROR_RESPONSE (~0ULL) #define SET_PCI_ERROR_RESPONSE(val) (*val =3D ((typeof(*val))PCI_ERROR_R= ESPONSE)) The macro was part of "Patch 1/22" and is present here [1]. Apologies if I added the receipient incorrectly. [1]: https://lore.kernel.org/linux-pci/d8e423386aad3d78bca575a7521b138508638e3b.= 1633972263.git.naveennaidu479@gmail.com/T/#m37295a0dcfe0d7e0f67efce3633efd7= b891949c4 IIUC, the typeof(*val) helps in setting the value according to the size of the argument. Please let me know if my understanding is wrong. > > return PCIBIOS_DEVICE_NOT_FOUND; > > } > > = > > @@ -920,7 +920,7 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u= 32 devfn, > > *val =3D CFG_RD_CRS_VAL; > > return PCIBIOS_SUCCESSFUL; > > } > > - *val =3D 0xffffffff; > > + SET_PCI_ERROR_RESPONSE(val); > > return PCIBIOS_SET_FAILED; > > } > > = > > @@ -955,14 +955,14 @@ static int advk_pcie_rd_conf(struct pci_bus *bus,= u32 devfn, > > *val =3D CFG_RD_CRS_VAL; > > return PCIBIOS_SUCCESSFUL; > > } > > - *val =3D 0xffffffff; > > + SET_PCI_ERROR_RESPONSE(val); > > return PCIBIOS_SET_FAILED; > > } > > = > > /* Check PIO status and get the read result */ > > ret =3D advk_pcie_check_pio_status(pcie, allow_crs, val); > > if (ret < 0) { > > - *val =3D 0xffffffff; > > + SET_PCI_ERROR_RESPONSE(val); > > return PCIBIOS_SET_FAILED; > > } > > = > > -- = > > 2.25.1 > > = _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel