Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4808065pxb; Thu, 14 Oct 2021 12:21:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJL3BFx5F6RlmlQ2z58ecx20SMZzmE1km2aE+ioua+3emMdX56LJwog9MC13PEkJ3ZLJiC X-Received: by 2002:a17:90b:4c86:: with SMTP id my6mr8264252pjb.203.1634239310697; Thu, 14 Oct 2021 12:21:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634239310; cv=none; d=google.com; s=arc-20160816; b=fOd8OwYojkuI7IlYkY1CfBrQK1CWW3LERxAClSfJP3CgWfD6iabvrbwpYKKgVad5hw CobLqBk6jeq7Qdrq/Zx4zvj07QqmtKoVgY1jEzVUZY1jzaEtEayJBwa5RmvgovEpijc5 mJ0xpd9J36LRsK24OPUoNYnRZcUsebaIdQL9VVikEvcwg/o83V/Qz4vZqyxv2KjZM96I PdBq1ZcJOSonuno5d5khh5moIr6rQ9oj/uB+8Uooh4dKYGcQBgPMzuFcyiWB+FwrKNhS WKbE0yXnMJY6tJX3RZ2T4Bt11PxwaJHSRY7KgAeINeFVUK9bxU9sSTbfRFYWlg5NOc5+ KkzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=fMFrwBpcfsevaiNMFqiTtdegTwfr5orDNb22AMJucOs=; b=Cz5pgBbMYEg4V7e/fChy9MD0wPqf1WWWC3n+AZ58UK9NdFlIEb5rTgKyUhDYNYD1QD kSbSe6qdunXTgZMJJBHxWRtTnTtf0kaUthKMgu4iYgO9cp7WOjv7JEU1A1+2cAs9HZ4Y 8GHbTf7F4qQJJhhdgBh3rjKdt24pkGPhBCuyAMvK8dmSfP0lQwF5H+Bmp2jqrfFVEi7c y2ua0oYzTQFlqdBUiBy39cQ9FPpehTiYeOVFoPNV1bKD4H+voxIHO7EqyM1Y1A+vAQMi WbT7LdR/27ai58B926FKILE09lVPrd7bRRqaOphdGyBNoE0iNPgoDt9aUwMJSvFcmecY tqlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="n0gs8a/Z"; 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=linux.dev Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l5si5595327plg.78.2021.10.14.12.21.37; Thu, 14 Oct 2021 12:21: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; dkim=pass header.i=@linux.dev header.s=key1 header.b="n0gs8a/Z"; 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=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233304AbhJNSGh (ORCPT + 99 others); Thu, 14 Oct 2021 14:06:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230386AbhJNSGg (ORCPT ); Thu, 14 Oct 2021 14:06:36 -0400 Received: from out1.migadu.com (out1.migadu.com [IPv6:2001:41d0:2:863f::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1194C061570; Thu, 14 Oct 2021 11:04:31 -0700 (PDT) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1634234667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fMFrwBpcfsevaiNMFqiTtdegTwfr5orDNb22AMJucOs=; b=n0gs8a/Zf9lENJoaoMmsmyrrYTaOSxPSqQ5/TvyXccikEz8hQ07tVKqSE2ljB5HJ/OxYXm MdFHBGmIm0jvTnQgC74mrXXiASM6NIRGKalb5ZpVCpQV/WMDTs9TiEkbjForHivEHPMhkl BsrAsbo5XhzMclQdsgFxaEEmeXRBqjM= Date: Thu, 14 Oct 2021 12:04:23 -0600 MIME-Version: 1.0 Subject: Re: [PATCH 15/22] PCI: vmd: Use RESPONSE_IS_PCI_ERROR() to check read from hardware Content-Language: en-US To: Naveen Naidu , bhelgaas@google.com Cc: linux-kernel-mentees@lists.linuxfoundation.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Nirmal Patel , Lorenzo Pieralisi , Rob Herring , =?UTF-8?Q?Krzysztof_Wilczy=c5=84ski?= References: <84ab7a23647e0673d99a8cf59e9c89af9b862354.1633972263.git.naveennaidu479@gmail.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Jonathan Derrick In-Reply-To: <84ab7a23647e0673d99a8cf59e9c89af9b862354.1633972263.git.naveennaidu479@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: jonathan.derrick@linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/11/2021 12:06 PM, 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 RESPONSE_IS_PCI_ERROR() to check the response we get when we read > data from hardware. > > This helps unify PCI error response checking and make error checks > consistent and easier to find. > > Signed-off-by: Naveen Naidu > --- > drivers/pci/controller/vmd.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c > index a5987e52700e..db81bc4cfe8c 100644 > --- a/drivers/pci/controller/vmd.c > +++ b/drivers/pci/controller/vmd.c > @@ -538,7 +538,7 @@ static int vmd_get_phys_offsets(struct vmd_dev *vmd, bool native_hint, > int ret; > > ret = pci_read_config_dword(dev, PCI_REG_VMLOCK, &vmlock); > - if (ret || vmlock == ~0) > + if (ret || RESPONSE_IS_PCI_ERROR(&vmlock)) > return -ENODEV; > > if (MB2_SHADOW_EN(vmlock)) { > Reviewed-by: Jonathan Derrick