Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1868521pxb; Mon, 11 Oct 2021 15:08:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVIf4b0kvo4zPzvCHMLXuTlv/j2zG2uv+EuQDle3MVkZLRjr3elV74yg/xneU3HmKE4AbB X-Received: by 2002:a63:b204:: with SMTP id x4mr19489897pge.212.1633990130833; Mon, 11 Oct 2021 15:08:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633990130; cv=none; d=google.com; s=arc-20160816; b=WKEdJ45EDqwu5WEEG8wIh6mgYLtV0D1LOJZVFbYhxUEMZ0/AJAhB9DvPsrTW8Om/+e RA8IMbnNyXU9YZh3ZmifYYkun2MiJ1c4Pj/AmlGMHgdgOqzwUwgX02JdWY8CD7qeG3VJ tfJacfMiuGf7jE9+1riViWVWYuaog8jpu1j1pEXI/MzGYoxV6HS5XyBNgzsTdHoAt2r/ afuHb+NCfDdGAQmNVVIk/WdxL9VnZh94PJGCriTY30eWPm+//XpDLWUeOojcH5XiDdpB 02pHset3ur7vOTTPMF4y9k6mBDbTfKFAbjIe2tU1OvITuOeUfT87lYfLCYlbyoUCsUIo AVcQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=oINn+ngnlK0guwerLyEgPMWYZbLevit1wsPrwjvEJcs=; b=f2kskJasXT3hvB+8Bwb5bPxZP/QajOAU6/WIQipBjpZX3HA7WzeqF+MPLurUZq1jn9 pizcd9KXFmQ2iIjjqxnpawIhFXrOh+TPkwK1z0MDX9/dhGV8A5GJUHj7+dkGWgz8wqrk 8KpM25zckCQjhkkslzv4Itqu1cieBcm77pKUHFL9ZPuzlrWQM3NksP5vgj+5vJOWN9R9 na9OEOD4vpJbJ3PSlLzgjzSqbF845NmJi/vIokCDV6+tbqFT0ldJzeJfXR+paEzEbn4m Xi1L4U7iY/s9iFwnr9XkGsRT/jjKYa73TSIlqlBkUviorzWUDXwCI7p1eX8ztonQuPb/ LdnQ== ARC-Authentication-Results: i=1; mx.google.com; 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 d14si12516670pls.399.2021.10.11.15.08.38; Mon, 11 Oct 2021 15:08:50 -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; 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 S235490AbhJKWIC (ORCPT + 99 others); Mon, 11 Oct 2021 18:08:02 -0400 Received: from mail-oi1-f177.google.com ([209.85.167.177]:39678 "EHLO mail-oi1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235500AbhJKWH5 (ORCPT ); Mon, 11 Oct 2021 18:07:57 -0400 Received: by mail-oi1-f177.google.com with SMTP id m67so421352oif.6; Mon, 11 Oct 2021 15:05:56 -0700 (PDT) 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:in-reply-to; bh=oINn+ngnlK0guwerLyEgPMWYZbLevit1wsPrwjvEJcs=; b=dA5O1vCmuQ0EIJ3iZnZytsA8iEXfCNiC4heD7O99Km1XthjiYQJIwKma/TyZFJXD3P FpIZPuaKdVDXYdrSKkG0pmNVH3VS8o3axfbnMNkh6CiRiOUN103ZbDiAIKIbPUUfixBd 4XRFIuXmaWMFQMnxtyYNELP7MGAci83PY26Qc8Ibx7K6jDa/EazFpwf5s1SFfRFuna+s FDyPqIpC1LSQ2tmpzpZp7sC7z1pqi8qvjmmjOTkOywjDmL1qaRK6BTRPsm8nHB4DgKEW d57kG9KyR/7FW19m1DYnuQbJ59ub4eZUaLbaHaD/vj2a4l6QygHes+O5Jf+p2C8KdpgG YmYw== X-Gm-Message-State: AOAM530qqqWgBIuoWwzgikglFFQFTsMvmJqWOCDt1wDv3P0oajjmG0bM xak/g5LY2dfcd8+03AXTBe8JzLw9MA== X-Received: by 2002:aca:3606:: with SMTP id d6mr1092094oia.35.1633989956086; Mon, 11 Oct 2021 15:05:56 -0700 (PDT) Received: from robh.at.kernel.org (66-90-148-213.dyn.grandenetworks.net. [66.90.148.213]) by smtp.gmail.com with ESMTPSA id e2sm1733601ooh.40.2021.10.11.15.05.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Oct 2021 15:05:55 -0700 (PDT) Received: (nullmailer pid 1251528 invoked by uid 1000); Mon, 11 Oct 2021 22:05:54 -0000 Date: Mon, 11 Oct 2021 17:05:54 -0500 From: Rob Herring To: Naveen Naidu Cc: bhelgaas@google.com, linux-kernel-mentees@lists.linuxfoundation.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 02/22] PCI: Unify PCI error response checking Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 11, 2021 at 11:08:32PM +0530, 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 and > RESPONSE_IS_PCI_ERROR() to check the error response during hardware > read. > > These definitions make error checks consistent and easier to find. > > Signed-off-by: Naveen Naidu > --- > drivers/pci/access.c | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) > > diff --git a/drivers/pci/access.c b/drivers/pci/access.c > index 46935695cfb9..e1954bbbd137 100644 > --- a/drivers/pci/access.c > +++ b/drivers/pci/access.c > @@ -81,7 +81,7 @@ int pci_generic_config_read(struct pci_bus *bus, unsigned int devfn, > > addr = bus->ops->map_bus(bus, devfn, where); > if (!addr) { > - *val = ~0; > + SET_PCI_ERROR_RESPONSE(val); This to me doesn't look like kernel style. I'd rather see a define replace just '~0', but I defer to Bjorn. > 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. 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. Rob