linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
Cc: linux-pci@vger.kernel.org, mj@ucw.cz
Subject: Re: [PATCH] Fix Vector table and PBA addresses print output
Date: Tue, 30 Jan 2018 07:07:18 -0700	[thread overview]
Message-ID: <20180130070718.335deb52@w520.home> (raw)
In-Reply-To: <998ca55d1a2b9a7f6912dcff69bc57d31b690fb0.1517308416.git.gustavo.pimentel@synopsys.com>

On Tue, 30 Jan 2018 10:34:08 +0000
Gustavo Pimentel <gustavo.pimentel@synopsys.com> wrote:

> Lack of 3-bit rotation to the right was leading to erroneous display of the
> vector table and PBA.
> 
> Signed-off-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
> ---
>  ls-caps.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/ls-caps.c b/ls-caps.c
> index 507771a..cd13a37 100644
> --- a/ls-caps.c
> +++ b/ls-caps.c
> @@ -1104,10 +1104,10 @@ cap_msix(struct device *d, int where, int cap)
>  
>    off = get_conf_long(d, where + PCI_MSIX_TABLE);
>    printf("\t\tVector table: BAR=%d offset=%08x\n",
> -	 off & PCI_MSIX_BIR, off & ~PCI_MSIX_BIR);
> +	 off & PCI_MSIX_BIR, (off & ~PCI_MSIX_BIR) >> 3);
>    off = get_conf_long(d, where + PCI_MSIX_PBA);
>    printf("\t\tPBA: BAR=%d offset=%08x\n",
> -	 off & PCI_MSIX_BIR, off & ~PCI_MSIX_BIR);
> +	 off & PCI_MSIX_BIR, (off & ~PCI_MSIX_BIR) >> 3);
>  }
>  
>  static void


The code is correct as is, the register contains bits 31:3 of the
offset.  The spec states (PCI rev 3.0, 6.8.2.4, 6.8.2.5):

  The lower 3 Table BIR bits are masked off (set to zero) by software
  to form a 32-bit QWORD -aligned offset.

  The lower 3 PBA BIR bits are masked off (set to zero) by software to
  form a 32-bit QWORD-aligned offset.

Shifting is incorrect, the mask operation fills the lower 3 bits.
Thanks,

Alex

  reply	other threads:[~2018-01-30 14:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-30 10:34 [PATCH] Fix Vector table and PBA addresses print output Gustavo Pimentel
2018-01-30 14:07 ` Alex Williamson [this message]
2018-01-30 16:08   ` Gustavo Pimentel
2018-01-30 16:45     ` Alex Williamson
2018-01-31 12:41       ` Martin Mares

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180130070718.335deb52@w520.home \
    --to=alex.williamson@redhat.com \
    --cc=gustavo.pimentel@synopsys.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=mj@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).