Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp919302imm; Fri, 1 Jun 2018 11:53:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK483nRF/b9VAMxgYQVzx896ene6Qj7/HSwfemTOF7MNH4R3wY50aexVHwQqMxWpSc4DUFl X-Received: by 2002:a17:902:a616:: with SMTP id u22-v6mr12475840plq.186.1527879238685; Fri, 01 Jun 2018 11:53:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527879238; cv=none; d=google.com; s=arc-20160816; b=xIW5nfqy1Dv0EAfhxHx+GrxGHBOBLXzl/n2GGQ8ruDBAiB/oqFUnq3/jlzA/gLu7Gi Nl4TJP8z46vBtnteLKmKRa0+bgmXwChs2+T4W6gppD1jTNQE3DxRZJHMPU7R4MFEjXvn U82CgH4+0WTTdOMJ6RWE/kTaN6saFawYlqa+0KKdl3UmoxTrqPRJgV6P4MzDZqfgU6a1 r2cod5aNSzop45qGnKjlmGfJoIlJtoKr40lyMdS/HNqajmEYM/T6FSs8YxO+Ce7qZ+Hf bmYuD/B21JZ9jJFRsGIBUVSkN3FSPBHSwvo0BmQjdYIplfHsWNC/irxWn/nbMBsnGTUk U5SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=A9p1vpg0S5yWl7thaKgrBt8rygaLR1PRqzOd5kEX3OQ=; b=q1tJYuijNP3s88ju0R2jojKm+4/5CteVol21JVrC5tzPpH6NILqRvofHO/cMwPsuTp 3SUq7AkzYfOt/zIpSGOtI5xisi+YHeriSt90iGCHhjKxdyE4kwOBH9I3sUz+KPZ2THv7 1VXfO42whMqxdOMFOKZYyOj2OZ1XkxUC8Il3dXJgTpkv3BLXjiHrB5JfOp9AeIT/QbJj pSwDMgkWRzCWbR0Tpx1QyqJ0Y5O+f6AFPVDbKMFjualZgGId/cA+9UcTwn7unaZABqrJ cxLl2XA51ooClGqv0cCe+WuxpjPNEI7LWbph+pHQpwl3/S57SHodiso3ALeqEQKj7qPt 3kCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=i1PL+Nhm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id j131-v6si26203279pgc.606.2018.06.01.11.53.43; Fri, 01 Jun 2018 11:53:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=i1PL+Nhm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1753185AbeFASxO (ORCPT + 99 others); Fri, 1 Jun 2018 14:53:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:60106 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751835AbeFASxL (ORCPT ); Fri, 1 Jun 2018 14:53:11 -0400 Received: from localhost (unknown [104.133.8.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0FA7520880; Fri, 1 Jun 2018 18:53:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527879191; bh=EFfd+zF0BYm6KTWnLKmMJiIlaxM2HxQcFhzAtgQyFDE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=i1PL+NhmHVv2ANhR7KEgJrQoFANikejc9Uq+b18jzKLOaHD47oXT2RuuAdJfcNIMF /yWVOiEmgWNtvroSUDpbb9s98ESGuc2eQyf+36sZo9QzLzyR7A+og+uveTmzGT4n8C wvXGXDcnFkYFi3m76BBF9erJPFjgqQUDKlkJo3a4= Date: Fri, 1 Jun 2018 13:53:10 -0500 From: Bjorn Helgaas To: Sinan Kaya Cc: linux-pci@vger.kernel.org, timur@codeaurora.org, Kate Stewart , "open list:DOCUMENTATION" , Petr Tesarik , Ram Pai , Kai-Heng Feng , "H. Peter Anvin" , Boris Ostrovsky , Christoffer Dall , Jonathan Corbet , "maintainer:X86 ARCHITECTURE 32-BIT AND 64-BIT" , Ingo Molnar , David Rientjes , Thymo van Beers , Borislav Petkov , Tom Lendacky , Marc Zyngier , linux-arm-msm@vger.kernel.org, Frederic Weisbecker , Mikulas Patocka , Andy Lutomirski , Bjorn Helgaas , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Juergen Gross , Dou Liyang , "Paul E. McKenney" , Greg Kroah-Hartman , open list , Philippe Ombredanne Subject: Re: [PATCH V2] PCI: move early dump functionality from x86 arch into the common code Message-ID: <20180601185310.GA175802@bhelgaas-glaptop.roam.corp.google.com> References: <1527878854-21419-1-git-send-email-okaya@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1527878854-21419-1-git-send-email-okaya@codeaurora.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 01, 2018 at 02:47:28PM -0400, Sinan Kaya wrote: > Move early dump functionality into common code so that it is available for > all archtiectures. No need to carry arch specific reads around as the read > hooks are already initialized by the time pci_setup_device() is getting > called during scan. > +static void early_dump_pci_device(struct pci_dev *pdev) > +{ > + u32 value[256 / 4]; > + int i; > + > + if (!pci_early_dump) > + return; > + > + pci_info(pdev, "pci 0000:%02x:%02x.%d config space:\n", > + pdev->bus->number, PCI_SLOT(pdev->devfn), > + PCI_FUNC(pdev->devfn)); I'm still missing something -- why go to the trouble of pdev->bus->number, PCI_SLOT(), etc? Isn't the output going to look like this? pci 0000:00:00.0: pci 0000:00:00.0 config space: In other words, wouldn't the following be enough? pci_info(pdev, "config space:\n"); > + > + for (i = 0; i < 256; i += 4) > + pci_read_config_dword(pdev, i, &value[i / 4]); > + > + print_hex_dump(KERN_INFO, "", DUMP_PREFIX_OFFSET, 16, 1, value, > + 256, false); > +}