[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v6 3/8] x86/PCI: read maximum MSI vector count early



On Thu, Sep 19, 2019 at 03:22:54PM +0200, Jan Beulich wrote:
> Rather than doing this every time we set up interrupts for a device
> anew (and then in several places) fill this invariant field right after
> allocating struct pci_dev.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

LGTM:

Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Just one nit below.

> ---
> v6: New.
> 
> ---
>  xen/arch/x86/msi.c            |   13 +++++--------
>  xen/drivers/passthrough/pci.c |   10 ++++++++++
>  xen/drivers/vpci/msi.c        |    9 ++++-----
>  xen/include/xen/pci.h         |    3 ++-
>  xen/include/xen/vpci.h        |    6 ++----
>  5 files changed, 23 insertions(+), 18 deletions(-)
> 
> --- a/xen/arch/x86/msi.c
> +++ b/xen/arch/x86/msi.c
> @@ -664,7 +664,7 @@ static int msi_capability_init(struct pc
>  {
>      struct msi_desc *entry;
>      int pos;
> -    unsigned int i, maxvec, mpos;
> +    unsigned int i, mpos;
>      u16 control, seg = dev->seg;
>      u8 bus = dev->bus;
>      u8 slot = PCI_SLOT(dev->devfn);
> @@ -675,9 +675,8 @@ static int msi_capability_init(struct pc
>      if ( !pos )
>          return -ENODEV;
>      control = pci_conf_read16(dev->sbdf, msi_control_reg(pos));
> -    maxvec = multi_msi_capable(control);
> -    if ( nvec > maxvec )
> -        return maxvec;
> +    if ( nvec > dev->msi_maxvec )
> +        return dev->msi_maxvec;
>      control &= ~PCI_MSI_FLAGS_QSIZE;
>      multi_msi_enable(control, nvec);
>  
> @@ -711,7 +710,7 @@ static int msi_capability_init(struct pc
>  
>          /* All MSIs are unmasked by default, Mask them all */
>          maskbits = pci_conf_read32(dev->sbdf, mpos);
> -        maskbits |= ~(u32)0 >> (32 - maxvec);
> +        maskbits |= ~(u32)0 >> (32 - dev->msi_maxvec);

GENMASK would be slightly easier to parse IMO (here and below).

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.