Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1600940pxb; Wed, 20 Oct 2021 08:14:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzM+YxxidCZYodz6LGyx4t2i6O9JgQbhE5Gu+Q4fvJCPuQe2cHDO7/Cf+0djmQOJoIlI4zh X-Received: by 2002:a63:2361:: with SMTP id u33mr1497pgm.369.1634742889194; Wed, 20 Oct 2021 08:14:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634742889; cv=none; d=google.com; s=arc-20160816; b=rDKPaMTkVuwq4GbIzMQn+EpAKLbr2YmP616ta59F6Dt/GXxUm9nY9iHHySU9QaHNHR 8tDzZVrPlmf7r/yFs5WUWwVDjVytVGyhNP72SzELCssddVJQ7wDwOGxlkfjkTNtmwG3Q zhrHd/HR1wMX5HpEjsJH+7ud+eb94hlEh62Hxj4K5yURB0yA7yw3msXNhWRRY5IPOpcx q0OeCSoisJeC2Hfv6H3opIvkVh68lTHWM3XBM1NEsaZgFfWArU/4tkLPaJXEppIDGX6U jgXWD9iOZcIHpFgSGhzhS8TGW0REwtPFQZsjEEVon7AaKQEAtNvdzLmPYdXfQJDdeo/I DQAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=nMEsOmoLIE03X0FEz1y57WbkFMuY6Pnj05lXdP5SXsk=; b=rfDs444rW+nmnSF9BTWkpFYmeSJIqPAfCat5Gd4hC6uDJO+3Av4DlokQsUzgLWWmod Qoz6XiMqrlzYjELnihrY7hKImfFNKkqxUpSSRZsi/mn9qd5OaYto1wEXHPf5lleFlmQD IGsHJssKkMpzr9aQmaFZs9Y5ExNgc+wX3bJ1iMe1zfY75dfT9Sy6jPleUpxRIFdD1BMM fC6qrImGDHz6Y0KvxKy7z+CrxL5ktKOeXNL1DF2XwRjt3D/Lj8Ehhodpjb/h5uYrrzy9 OwE4xA6k7GlGmo7j6jaJ5cfak0G9PGvsDfziUjMhpNhJ77g8pUXCCO6/IKTjFYFW7o// I0jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kOp9YmMF; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z16si3197404pgj.197.2021.10.20.08.14.35; Wed, 20 Oct 2021 08:14:49 -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=@gmail.com header.s=20210112 header.b=kOp9YmMF; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230335AbhJTPPh (ORCPT + 99 others); Wed, 20 Oct 2021 11:15:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229702AbhJTPPg (ORCPT ); Wed, 20 Oct 2021 11:15:36 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 062EEC06161C; Wed, 20 Oct 2021 08:13:22 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id c4so15756269pgv.11; Wed, 20 Oct 2021 08:13:22 -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=nMEsOmoLIE03X0FEz1y57WbkFMuY6Pnj05lXdP5SXsk=; b=kOp9YmMFWMdxdBRR28gPoWRp1qUf1yXPEpvnyRze9W5hQeVyLVudcV4nW47Ob3EeWY 3CPMRo3WlOgu3WtGibMuSt6NxpctXgWAoo6HDKg/ifmKRC19+HZyvyeZw7RlBJzLHylX PWPxc+ckCH9veExv1O/A2AMC7s4c2Kr255TsRNfvHRx6VfwJthUlBIG5jHla6eGyTNj9 e3VyJVZvr1mEuvlfGcyIwwmuSuvc/hNgbYSZy7icesmFsCHu9U43CmQET35wlAcEryx7 MxGFXsyz/q2dZt7g2Sk4o7LH+OJ0/fR0ylcnwNA6QlWcGBi8uhAsc4kVfnoa4vx+eyu6 P7Ew== 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=nMEsOmoLIE03X0FEz1y57WbkFMuY6Pnj05lXdP5SXsk=; b=7RM2XVcYle288FpW4Q5xHhjo0jSuc6nNcXIaBgoX+qY4r2pGb/NnscqJ/BkvLnvSf9 15cFPrW/n5BruuMyMeBtMFh1ndd+/urD7MDBqA2wV7JciGVTSF4xOrEUytIOHsY8T2t0 eqUgQyn5Wq5cqck9j6qMneA+MfJX5rcgXKkVPoM2y6TTG/Ox43ei3hYZ+vtOEIqMTgbT 2YtQ0OfwNnqboy4KnP66fyvQQnfpIgD6MxVJE5n4zHUscRBqku6pHRcp1CNBJxKaG3Hg pF9Rcezfbhv+gdvkXv7k4xUumAlTXWZCJKPb5f9hvBDVqzLrCxlBjsRBSmRl5y4zQmqZ JeEA== X-Gm-Message-State: AOAM532Y/U5nc0b0xQyHBUbBCLSzbnXgm2qqnrJhXOUH/mowSBIcb951 Y0ENTub5P/P0VQiZyblZZVm7MWamEWaHvg== X-Received: by 2002:a63:f817:: with SMTP id n23mr40868pgh.250.1634742801348; Wed, 20 Oct 2021 08:13:21 -0700 (PDT) Received: from theprophet ([2406:7400:63:46e9:439a:b490:ed63:26a1]) by smtp.gmail.com with ESMTPSA id n9sm5097115pjk.3.2021.10.20.08.13.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 08:13:20 -0700 (PDT) Date: Wed, 20 Oct 2021 20:43:09 +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, Rob Herring Subject: Re: [PATCH v2 02/24] PCI: Set error response in config access defines when ops->read() fails Message-ID: <20211020151309.gklnsksd7ce6b3q6@theprophet> References: <20211020135208.zgm2gvhqd7ukb57m@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20211020135208.zgm2gvhqd7ukb57m@pali> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/10, Pali Roh?r wrote: > On Friday 15 October 2021 19:58:17 Naveen Naidu wrote: > > Make PCI_OP_READ and PCI_USER_READ_CONFIG set the data value with error > > response (~0), when the PCI device read by a host controller fails. > > > > This ensures that the controller drivers no longer need to fabricate > > (~0) value when they detect error. It also gurantees that the error > > response (~0) is always set when the controller drivers fails to read a > > config register from a device. > > > > This makes error response fabrication consistent and helps in removal of > > a lot of repeated code. > > > > Suggested-by: Rob Herring > > Signed-off-by: Naveen Naidu > > --- > > drivers/pci/access.c | 10 ++++++++-- > > 1 file changed, 8 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/pci/access.c b/drivers/pci/access.c > > index 46935695cfb9..b3b2006ed1d2 100644 > > --- a/drivers/pci/access.c > > +++ b/drivers/pci/access.c > > @@ -42,7 +42,10 @@ int noinline pci_bus_read_config_##size \ > > if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \ > > pci_lock_config(flags); \ > > res = bus->ops->read(bus, devfn, pos, len, &data); \ > > - *value = (type)data; \ > > + if (res) \ > > + SET_PCI_ERROR_RESPONSE(value); \ > > + else \ > > + *value = (type)data; \ > > Hello! Just one small comment. It looks like that in this patch is > broken alignment of backslashes on the end of lines. Prior this patch > backslashes on all lines were at the same column. With this patch they > are not. > Thank you for spotting this. I apologise for this. I did not configure my editor properlly so I couldn't recognize this error. But I'll fix this when I send the v3 > > pci_unlock_config(flags); \ > > return res; \ > > } > > @@ -228,7 +231,10 @@ int pci_user_read_config_##size \ > > ret = dev->bus->ops->read(dev->bus, dev->devfn, \ > > pos, sizeof(type), &data); \ > > raw_spin_unlock_irq(&pci_lock); \ > > - *val = (type)data; \ > > + if (ret) \ > > + SET_PCI_ERROR_RESPONSE(val); \ > > + else \ > > + *val = (type)data; \ > > return pcibios_err_to_errno(ret); \ > > } \ > > EXPORT_SYMBOL_GPL(pci_user_read_config_##size); > > -- > > 2.25.1 > >