From patchwork Thu Dec 17 00:55:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sostalle X-Patchwork-Id: 7867871 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3A387BEEE5 for ; Thu, 17 Dec 2015 00:59:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6AD4E20260 for ; Thu, 17 Dec 2015 00:59:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DEFD5203E6 for ; Thu, 17 Dec 2015 00:59:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932086AbbLQA72 (ORCPT ); Wed, 16 Dec 2015 19:59:28 -0500 Received: from mga04.intel.com ([192.55.52.120]:23905 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755589AbbLQA6l (ORCPT ); Wed, 16 Dec 2015 19:58:41 -0500 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP; 16 Dec 2015 16:58:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,438,1444719600"; d="scan'208,223";a="842841928" Received: from dev.jf.intel.com (HELO sean.stalley.intel.com) ([134.134.147.19]) by orsmga001.jf.intel.com with ESMTP; 16 Dec 2015 16:58:34 -0800 Date: Wed, 16 Dec 2015 16:55:18 -0800 From: "Sean O. Stalley" To: David Daney Cc: Martin Mares , Bjorn Helgaas , linux-pci@vger.kernel.org, David Daney Subject: Re: [PATCH v3] Add lspci support for Enhanced Allocation Capability. Message-ID: <20151217005517.GA3765@sean.stalley.intel.com> References: <1450217759-22063-1-git-send-email-ddaney.cavm@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1450217759-22063-1-git-send-email-ddaney.cavm@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From 484344fef7e5c96c54576586ce81e6209a48b92c Mon Sep 17 00:00:00 2001 From: "Sean O. Stalley" Date: Wed, 16 Dec 2015 10:31:51 -0800 Subject: [PATCH 1/1] Support region sizes that are not power-of-2 Enhanced Allocation allows PCI devices to reserve regions with DWORD granularity. Make sure lspci doesn't tuncate least significant bits of the region size. ex: a 2000 byte region should display [size=2000] instead of [size=1K] Signed-off-by: Sean O. Stalley --- Hi David, Here are some additional changes I think we should make to lspci in order to support EA. The truncation problem was a simple fix. Regions described by EA are being mislabeled as [virtual]. I spent some time today trying to write a patch that fixes this issue. I couldn't come up with a clean solution, so I just added a comment. Let me know if you have any questions. Thanks, Sean lspci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lspci.c b/lspci.c index fe7b7fe..d483f3a 100644 --- a/lspci.c +++ b/lspci.c @@ -336,7 +336,7 @@ show_size(pciaddr_t x) if (!x) return; for (i = 0; i < (sizeof(suffix) / sizeof(*suffix) - 1); i++) { - if (x < 1024) + if (x % 1024) break; x /= 1024; } @@ -366,7 +366,7 @@ show_bases(struct device *d, int cnt) putchar('\t'); if (pos && !flg) /* Reported by the OS, but not by the device */ { - printf("[virtual] "); + printf("[virtual] "); /* could also be enhanced */ flg = pos; virtual = 1; }