Linux-HyperV List
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Naveen Naidu <naveennaidu479@gmail.com>
Cc: bhelgaas@google.com,
	linux-kernel-mentees@lists.linuxfoundation.org,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-hyperv@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linuxppc-dev@lists.ozlabs.org, linux-renesas-soc@vger.kernel.org,
	linux-rockchip@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org,
	"Rob Herring" <robh@kernel.org>,
	skhan@linuxfoundation.org, "Robert Richter" <rric@kernel.org>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Ray Jui" <rjui@broadcom.com>,
	"Scott Branden" <sbranden@broadcom.com>,
	"maintainer:BROADCOM IPROC ARM ARCHITECTURE"
	<bcm-kernel-feedback-list@broadcom.com>,
	"Ryder Lee" <ryder.lee@mediatek.com>,
	"Jianjun Wang" <jianjun.wang@mediatek.com>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Jingoo Han" <jingoohan1@gmail.com>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski@canonical.com>,
	"Shawn Guo" <shawn.guo@linaro.org>,
	"Xiaowei Song" <songxiaowei@hisilicon.com>,
	"Binghui Wang" <wangbinghui@hisilicon.com>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	"Joyce Ooi" <joyce.ooi@intel.com>,
	"Marek Vasut" <marek.vasut+renesas@gmail.com>,
	"Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>,
	"Shawn Lin" <shawn.lin@rock-chips.com>,
	"Heiko Stuebner" <heiko@sntech.de>,
	"Nirmal Patel" <nirmal.patel@linux.intel.com>,
	"Jonathan Derrick" <jonathan.derrick@linux.dev>,
	"Kuppuswamy Sathyanarayanan"
	<sathyanarayanan.kuppuswamy@linux.intel.com>,
	"Lukas Wunner" <lukas@wunner.de>,
	"Amey Narkhede" <ameynarkhede03@gmail.com>,
	"Russell Currey" <ruscur@russell.cc>,
	"Oliver O'Halloran" <oohall@gmail.com>,
	"Sean V Kelley" <sean.v.kelley@intel.com>,
	"Qiuxu Zhuo" <qiuxu.zhuo@intel.com>,
	"Marc Zyngier" <maz@kernel.org>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	"Haiyang Zhang" <haiyangz@microsoft.com>,
	"Stephen Hemminger" <sthemmin@microsoft.com>,
	"Wei Liu" <wei.liu@kernel.org>,
	"Dexuan Cui" <decui@microsoft.com>,
	"Toan Le" <toan@os.amperecomputing.com>
Subject: Re: [PATCH v3 02/25] PCI: Set error response in config access defines when ops->read() fails
Date: Thu, 21 Oct 2021 17:59:18 +0200	[thread overview]
Message-ID: <20211021155918.kigwwylvdmsuyd3z@pali> (raw)
In-Reply-To: <56642edd0d6bf8a8e3d20b5fcc088fd6389b827f.1634825082.git.naveennaidu479@gmail.com>

On Thursday 21 October 2021 20:37:27 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 <robh@kernel.org>
> Reviewed-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Naveen Naidu <naveennaidu479@gmail.com>

Reviewed-by: Pali Rohár <pali@kernel.org>

> ---
>  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..0f732ba2f71a 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;					\
>  	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
> 

  reply	other threads:[~2021-10-21 15:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21 15:07 [PATCH v3 00/25] Unify PCI error response checking Naveen Naidu
2021-10-21 15:07 ` [PATCH v3 01/25] PCI: Add PCI_ERROR_RESPONSE and it's related definitions Naveen Naidu
2021-10-21 16:08   ` Pali Rohár
2021-11-17 23:58   ` Bjorn Helgaas
2021-11-18 13:30     ` Naveen Naidu
2021-10-21 15:07 ` [PATCH v3 02/25] PCI: Set error response in config access defines when ops->read() fails Naveen Naidu
2021-10-21 15:59   ` Pali Rohár [this message]
2021-10-21 15:07 ` [PATCH v3 24/25] PCI: hv: Use PCI_ERROR_RESPONSE to specify hardware read error Naveen Naidu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211021155918.kigwwylvdmsuyd3z@pali \
    --to=pali@kernel.org \
    --cc=ameynarkhede03@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bhelgaas@google.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=heiko@sntech.de \
    --cc=jianjun.wang@mediatek.com \
    --cc=jingoohan1@gmail.com \
    --cc=jonathan.derrick@linux.dev \
    --cc=joyce.ooi@intel.com \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=kw@linux.com \
    --cc=kys@microsoft.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=lukas@wunner.de \
    --cc=marek.vasut+renesas@gmail.com \
    --cc=matthias.bgg@gmail.com \
    --cc=maz@kernel.org \
    --cc=naveennaidu479@gmail.com \
    --cc=nirmal.patel@linux.intel.com \
    --cc=oohall@gmail.com \
    --cc=qiuxu.zhuo@intel.com \
    --cc=rjui@broadcom.com \
    --cc=robh@kernel.org \
    --cc=rric@kernel.org \
    --cc=ruscur@russell.cc \
    --cc=ryder.lee@mediatek.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=sbranden@broadcom.com \
    --cc=sean.v.kelley@intel.com \
    --cc=shawn.guo@linaro.org \
    --cc=shawn.lin@rock-chips.com \
    --cc=skhan@linuxfoundation.org \
    --cc=songxiaowei@hisilicon.com \
    --cc=sthemmin@microsoft.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=toan@os.amperecomputing.com \
    --cc=wangbinghui@hisilicon.com \
    --cc=wei.liu@kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox