Skip to contentSkip to conversation

xen-pciback: optionally allow interrupt enable flag writes

PATCH Nick Desaulniers 1 participant 1 message Jan 13, 2020 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 202001112351.gy4c3aUU%[email protected]

#1 lore raw

Hi Marek,
Below is a report from 0day bot build w/ Clang. The warning looks legit, can you please take a look? Apologies if this has already been reported.

Quoted 145 lines · kbuild test robot

CC: kbuild-all(a)lists.01.org
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: "Marek Marczykowski-Górecki" <[email protected]>
CC: xen-devel(a)lists.xenproject.org, "Marek Marczykowski-Górecki" <[email protected]>, Jan Beulich <[email protected]>, Simon Gaiser <[email protected]>, Boris Ostrovsky <[email protected]>, Juergen Gross <[email protected]>, Stefano Stabellini <[email protected]>, YueHaibing <[email protected]>, open list <[email protected]>, "Marek Marczykowski-Górecki" <marmarek(a)invisiblethingslab.com>, Jan Beulich <[email protected]>, Simon Gaiser <[email protected]>, Boris Ostrovsky <[email protected]>, Juergen Gross <[email protected]>, Stefano Stabellini <[email protected]>, YueHaibing <[email protected]>, open list <linux-kernel(a)vger.kernel.org>
CC: "Marek Marczykowski-Górecki" <[email protected]>, Jan Beulich <[email protected]>, Simon Gaiser <[email protected]>, Boris Ostrovsky <[email protected]>, Juergen Gross <[email protected]>, Stefano Stabellini <[email protected]>, YueHaibing <[email protected]>, open list <[email protected]>

Hi "Marek,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on xen-tip/linux-next]
[also build test WARNING on linux/master linus/master v5.5-rc5 next-20200110] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Marek-Marczykowski-G-recki/xen-pciback-optionally-allow-interrupt-enable-flag-writes/20200111-162243
base:   https://git.kernel.org/pub/scm/linux/kernel/git/xen/tip.git linux-next
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 10.0.0 (git://gitmirror/llvm_project 016bf03ef6fcd9dce43b0c17971f76323f07a684)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64

If you fix the issue, kindly add following tag

All warnings (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

drivers/xen/xen-pciback/conf_space_header.c:121:19: warning: variable 'val' is uninitialized when used here [-Wuninitialized]

                   if ((cmd->val ^ val) & PCI_COMMAND_INTX_DISABLE) {
                                   ^~~
   drivers/xen/xen-pciback/conf_space_header.c:65:9: note: initialize the variable 'val' to silence this warning
           u16 val;
                  ^
                   = 0

1 warning generated.

vim +/val +121 drivers/xen/xen-pciback/conf_space_header.c

    60
    61  static int command_write(struct pci_dev *dev, int offset, u16 value, void *data)
    62  {
    63          struct xen_pcibk_dev_data *dev_data;
    64          int err;
    65          u16 val;
    66          struct pci_cmd_info *cmd = data;
    67
    68          dev_data = pci_get_drvdata(dev);
    69          if (!pci_is_enabled(dev) && is_enable_cmd(value)) {
    70                  if (unlikely(verbose_request))
    71                          printk(KERN_DEBUG DRV_NAME ": %s: enable\n",
    72                                 pci_name(dev));
    73                  err = pci_enable_device(dev);
    74                  if (err)
    75                          return err;
    76                  if (dev_data)
    77                          dev_data->enable_intx = 1;
    78          } else if (pci_is_enabled(dev) && !is_enable_cmd(value)) {
    79                  if (unlikely(verbose_request))
    80                          printk(KERN_DEBUG DRV_NAME ": %s: disable\n",
    81                                 pci_name(dev));
    82                  pci_disable_device(dev);
    83                  if (dev_data)
    84                          dev_data->enable_intx = 0;
    85          }
    86
    87          if (!dev->is_busmaster && is_master_cmd(value)) {
    88                  if (unlikely(verbose_request))
    89                          printk(KERN_DEBUG DRV_NAME ": %s: set bus master\n",
    90                                 pci_name(dev));
    91                  pci_set_master(dev);
    92          } else if (dev->is_busmaster && !is_master_cmd(value)) {
    93                  if (unlikely(verbose_request))
    94                          printk(KERN_DEBUG DRV_NAME ": %s: clear bus master\n",
    95                                 pci_name(dev));
    96                  pci_clear_master(dev);
    97          }
    98
    99          if (!(cmd->val & PCI_COMMAND_INVALIDATE) &&
   100              (value & PCI_COMMAND_INVALIDATE)) {
   101                  if (unlikely(verbose_request))
   102                          printk(KERN_DEBUG
   103                                 DRV_NAME ": %s: enable memory-write-invalidate\n",
   104                                 pci_name(dev));
   105                  err = pci_set_mwi(dev);
   106                  if (err) {
   107                          pr_warn("%s: cannot enable memory-write-invalidate (%d)\n",
   108                                  pci_name(dev), err);
   109                          value &= ~PCI_COMMAND_INVALIDATE;
   110                  }
   111          } else if ((cmd->val & PCI_COMMAND_INVALIDATE) &&
   112                     !(value & PCI_COMMAND_INVALIDATE)) {
   113                  if (unlikely(verbose_request))
   114                          printk(KERN_DEBUG
   115                                 DRV_NAME ": %s: disable memory-write-invalidate\n",
   116                                 pci_name(dev));
   117                  pci_clear_mwi(dev);
   118          }
   119
   120          if (dev_data && dev_data->allow_interrupt_control) {
Quoted 1 line

121 if ((cmd->val ^ val) & PCI_COMMAND_INTX_DISABLE) {

   122                          if (value & PCI_COMMAND_INTX_DISABLE) {
   123                                  pci_intx(dev, 0);
   124                          } else {
   125                                  /* Do not allow enabling INTx together with MSI or MSI-X. */
   126                                  switch (xen_pcibk_get_interrupt_type(dev)) {
   127                                  case INTERRUPT_TYPE_NONE:
   128                                  case INTERRUPT_TYPE_INTX:
   129                                          pci_intx(dev, 1);
   130                                          break;
   131                                  default:
   132                                          return PCIBIOS_SET_FAILED;
   133                                  }
   134                          }
   135                  }
   136          }
   137
   138          cmd->val = value;
   139
   140          if (!xen_pcibk_permissive && (!dev_data || !dev_data->permissive))
   141                  return 0;
   142
   143          /* Only allow the guest to control certain bits. */
   144          err = pci_read_config_word(dev, offset, &val);
   145          if (err || val == value)
   146                  return err;
   147
   148          value &= PCI_COMMAND_GUEST;
   149          value |= val & ~PCI_COMMAND_GUEST;
   150
   151          return pci_write_config_word(dev, offset, value);
   152  }
   153

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

--
You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe(a)googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/202001112351.gy4c3aUU%25lkp%40intel.com.

Signature · 2 lines
Thanks,
~Nick Desaulniers