Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp726433pxb; Thu, 21 Oct 2021 08:20:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrpGj+o+nV6TPFq5bUDSXWkKzjHXkZA0SYaY28Sjljnm01KfoujLGnXsDbf+y6+thS+uk9 X-Received: by 2002:a63:3819:: with SMTP id f25mr4842149pga.344.1634829652575; Thu, 21 Oct 2021 08:20:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634829652; cv=none; d=google.com; s=arc-20160816; b=ohTgh31VtLKZew8551SVpUcIN0nJGn4S/HDHG+VMGsL27nTQcBlkRwi/CQUgr4Ybj5 f7JLNO6wJ7pSsVEnrYvUUAA7l1pNhbHuKYPbO5ta9gkTHpCe+RmYcFWobyzbEBgZzN6i sQ/uD1flpbcHW2z/cgqTtJ6HBqa9sulgsHUlsDtFoUtbrRwLmdPeaE9RLuzxLYk3QO4I A2azDb/6hM0FiNc6tP8UjfzmOaBrY8XXdq1VQnk8hhHgKZTJyB0oV5CRFuLfWq3z/pU/ UfSE99ZwclQveKSJbjvXkryPZT5SAjaEWL45XRyQAr0HBjR/sT+ae8sq75gd2kWvOwx+ n65Q== 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:dkim-signature; bh=qqnDqCjJmkwkqd0tn31z39TZlTbK4LZW1iNa62QCR2Q=; b=lOfBOpwsI/IhAl/4K7lPA4NRdlUxoDVXkQB5P3uVJjzz+s4QN2Gkyl/XRwd4dDt9db 7FZxXUl96z/hilweu2DargaC92amCDp9q5cF1L5dWo0MEGYGGW8LptCTepfdqeK6DMjr YPbr51MNHF+adJMcaUqjMIgoDZj6uecbfs5TI7XShN49hF2VRMpz3w9qiFYzHELwXlab khCL7f07kl0NXfV02A7t3k03GNiEkMx3haE2eynSBEMLxfMdXNaSKsrFZbu4iMH6zXVi R+0TyPisAUmQNXDgR7z22b7yfbkFO2TSFKqsvIqziHKdrV3hNFB02YPPqhrJkdtZyUrG TYiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="M/8LCnv1"; 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 m18si9367743pgu.392.2021.10.21.08.20.39; Thu, 21 Oct 2021 08:20:52 -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="M/8LCnv1"; 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 S231524AbhJUPVo (ORCPT + 99 others); Thu, 21 Oct 2021 11:21:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230072AbhJUPVm (ORCPT ); Thu, 21 Oct 2021 11:21:42 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE09EC061764; Thu, 21 Oct 2021 08:19:26 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id w17so632607plg.9; Thu, 21 Oct 2021 08:19:26 -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:in-reply-to; bh=qqnDqCjJmkwkqd0tn31z39TZlTbK4LZW1iNa62QCR2Q=; b=M/8LCnv10ewNtUivz51HXcBWK6M0VB9kFf5a+WtqK7XOSKxrr1pryerPOEyB413IAZ ExogKFflc0njjFMjEJusTcTGvZg44eISwwxw/J8CSPjR8pI7EOUnPsFNyh6ldXKoVu16 XH5N6LecXdiYNcMXCTsBc0jHEX8c/O1TvDdthlJhPM5HQk0Xad6fjCrINfY4Ilfy4HgB 2zeFrHw2ZE+m/QeyDjGF6lW8jx50xlYyyvY1zzjJ1T01JmbUgskTJa8o+OZZvcWQsuZF MCvNps4TW4ejZHSBpqsWl2YJvLCpZAjh4lrZVclpLCkCYM+8rHXDL3YshzYFw4wg+hVM /9xg== 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=qqnDqCjJmkwkqd0tn31z39TZlTbK4LZW1iNa62QCR2Q=; b=4I/vGw1M624G8uo+DKO2R8Xv7McE795ZKcNB6byzNGO6ZkFB0Xl7/VeM3Lw+A3DJJt eKIh8JkXFn0K7ifU/AlzLzARourB5cORfW/nL4tu5heN2HqNoKT2/+Uqf4A7m09GQ18+ c7ai8D38dCKb7c3pLbN1W8V1xW2e/gSDFfxLfOjFKa797Ikd0ZNXTDV36U+XMlzQJrPd S95FD0RL2cEfUbo6yV9PDlRaxHXyLePuNZ6nOCCl3wOj7inlWarJ+1g9S7CANvZGQvY7 adRvSGzwgUCYZ8B9iB5x6ecjZhFPqV/5vJvp8c+5TDcp1WN9lRhj8ebeD8SoUk+XNRjq MZPA== X-Gm-Message-State: AOAM531Icx738DpiMHs6GS/R25NzBSvH7J9aWBEyUlg3K+7Dol1f6MDq aO8XWF7weqAEZKf6GP5FxK0= X-Received: by 2002:a17:90a:2acf:: with SMTP id i15mr3194179pjg.91.1634829566382; Thu, 21 Oct 2021 08:19:26 -0700 (PDT) Received: from theprophet ([2406:7400:63:29a4:d874:a949:6890:f95f]) by smtp.gmail.com with ESMTPSA id a27sm6466171pfl.20.2021.10.21.08.19.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 08:19:25 -0700 (PDT) Date: Thu, 21 Oct 2021 20:49:13 +0530 From: Naveen Naidu To: bhelgaas@google.com Cc: linux-kernel-mentees@lists.linuxfoundation.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, skhan@linuxfoundation.org, Nirmal Patel , Jonathan Derrick , Lorenzo Pieralisi , Rob Herring , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= Subject: Re: [PATCH v3 17/25] PCI: vmd: Use RESPONSE_IS_PCI_ERROR() to check read from hardware Message-ID: <20211021151913.nmnvfhqnyepnfok2@theprophet> References: <5be1fdfdcf4b4a453117ef4dea0f71c9555fac24.1634825082.git.naveennaidu479@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5be1fdfdcf4b4a453117ef4dea0f71c9555fac24.1634825082.git.naveennaidu479@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/10, 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..bfe6b002ffec 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)) { > -- > 2.25.1 > Jonathan, I haven't added your Reviewed-by tag to this patch which you gave in v1 of the series [1] , because the macro definition of the RESPONSE_IS_PCI_ERROR changed slightly, and I was not sure if you would be okay with it. I hope it was right thing to do, if not I apologize for that. [1]: https://lore.kernel.org/linux-pci/f3aca934-7dee-b294-ad3c-264e773eddda@linux.dev/T/#u Thanks, Naveen