From: Boris Ostrovsky <boris.ostrovsky@oracle.com> To: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>, xen-devel@lists.xenproject.org Cc: "Roger Pau Monné" <roger.pau@citrix.com>, "Simon Gaiser" <simon@invisiblethingslab.com>, "Juergen Gross" <jgross@suse.com>, "Stefano Stabellini" <sstabellini@kernel.org>, YueHaibing <yuehaibing@huawei.com>, "open list" <linux-kernel@vger.kernel.org> Subject: Re: [PATCH v2] xen-pciback: optionally allow interrupt enable flag writes Date: Fri, 20 Dec 2019 14:11:03 -0500 [thread overview] Message-ID: <4ed998e1-c8e6-a2c3-031a-9104c912cb76@oracle.com> (raw) In-Reply-To: <20191219034941.19141-1-marmarek@invisiblethingslab.com> On 12/18/19 10:49 PM, Marek Marczykowski-Górecki wrote: > --- > drivers/xen/xen-pciback/conf_space.c | 35 ++++++++ > drivers/xen/xen-pciback/conf_space.h | 10 +++ > .../xen/xen-pciback/conf_space_capability.c | 88 +++++++++++++++++++ > drivers/xen/xen-pciback/conf_space_header.c | 19 ++++ > drivers/xen/xen-pciback/pci_stub.c | 66 ++++++++++++++ > drivers/xen/xen-pciback/pciback.h | 1 + > 6 files changed, 219 insertions(+) This also needs an update to Documentation/ABI/testing/sysfs-driver-pciback. > @@ -64,6 +64,7 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data) > int err; > u16 val; > struct pci_cmd_info *cmd = data; > + u16 cap_value; What is this for? > > dev_data = pci_get_drvdata(dev); > if (!pci_is_enabled(dev) && is_enable_cmd(value)) { > @@ -117,6 +118,24 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data) > pci_clear_mwi(dev); > } > > + if (dev_data && dev_data->allow_interrupt_control) { > + if (!(cmd->val & PCI_COMMAND_INTX_DISABLE) && > + (value & PCI_COMMAND_INTX_DISABLE)) { > + pci_intx(dev, 0); > + } else if ((cmd->val & PCI_COMMAND_INTX_DISABLE) && > + !(value & PCI_COMMAND_INTX_DISABLE)) { > + /* Do not allow enabling INTx together with MSI or MSI-X. */ > + switch (xen_pcibk_get_interrupt_type(dev)) { > + case INTERRUPT_TYPE_NONE: > + case INTERRUPT_TYPE_INTX: > + pci_intx(dev, 1); > + break; > + default: > + return PCIBIOS_SET_FAILED; > + } > + } Perhaps this is slightly easier to read: if (cmd->val ^ val) & PCI_COMMAND_INTX_DISABLE) { if (value & PCI_COMMAND_INTX_DISABLE) { pci_intx(dev, 0); } else { /* Do not allow enabling INTx together with MSI or MSI-X. */ switch (xen_pcibk_get_interrupt_type(dev)) { case INTERRUPT_TYPE_NONE: case INTERRUPT_TYPE_INTX: pci_intx(dev, 1); break; default: return PCIBIOS_SET_FAILED; } } } And also, if INTERRUPT_TYPE_INTX, aren't you already enabled? -boris
WARNING: multiple messages have this Message-ID (diff)
From: Boris Ostrovsky <boris.ostrovsky@oracle.com> To: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>, xen-devel@lists.xenproject.org Cc: "Juergen Gross" <jgross@suse.com>, "Stefano Stabellini" <sstabellini@kernel.org>, YueHaibing <yuehaibing@huawei.com>, "open list" <linux-kernel@vger.kernel.org>, "Simon Gaiser" <simon@invisiblethingslab.com>, "Roger Pau Monné" <roger.pau@citrix.com> Subject: Re: [Xen-devel] [PATCH v2] xen-pciback: optionally allow interrupt enable flag writes Date: Fri, 20 Dec 2019 14:11:03 -0500 [thread overview] Message-ID: <4ed998e1-c8e6-a2c3-031a-9104c912cb76@oracle.com> (raw) In-Reply-To: <20191219034941.19141-1-marmarek@invisiblethingslab.com> On 12/18/19 10:49 PM, Marek Marczykowski-Górecki wrote: > --- > drivers/xen/xen-pciback/conf_space.c | 35 ++++++++ > drivers/xen/xen-pciback/conf_space.h | 10 +++ > .../xen/xen-pciback/conf_space_capability.c | 88 +++++++++++++++++++ > drivers/xen/xen-pciback/conf_space_header.c | 19 ++++ > drivers/xen/xen-pciback/pci_stub.c | 66 ++++++++++++++ > drivers/xen/xen-pciback/pciback.h | 1 + > 6 files changed, 219 insertions(+) This also needs an update to Documentation/ABI/testing/sysfs-driver-pciback. > @@ -64,6 +64,7 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data) > int err; > u16 val; > struct pci_cmd_info *cmd = data; > + u16 cap_value; What is this for? > > dev_data = pci_get_drvdata(dev); > if (!pci_is_enabled(dev) && is_enable_cmd(value)) { > @@ -117,6 +118,24 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data) > pci_clear_mwi(dev); > } > > + if (dev_data && dev_data->allow_interrupt_control) { > + if (!(cmd->val & PCI_COMMAND_INTX_DISABLE) && > + (value & PCI_COMMAND_INTX_DISABLE)) { > + pci_intx(dev, 0); > + } else if ((cmd->val & PCI_COMMAND_INTX_DISABLE) && > + !(value & PCI_COMMAND_INTX_DISABLE)) { > + /* Do not allow enabling INTx together with MSI or MSI-X. */ > + switch (xen_pcibk_get_interrupt_type(dev)) { > + case INTERRUPT_TYPE_NONE: > + case INTERRUPT_TYPE_INTX: > + pci_intx(dev, 1); > + break; > + default: > + return PCIBIOS_SET_FAILED; > + } > + } Perhaps this is slightly easier to read: if (cmd->val ^ val) & PCI_COMMAND_INTX_DISABLE) { if (value & PCI_COMMAND_INTX_DISABLE) { pci_intx(dev, 0); } else { /* Do not allow enabling INTx together with MSI or MSI-X. */ switch (xen_pcibk_get_interrupt_type(dev)) { case INTERRUPT_TYPE_NONE: case INTERRUPT_TYPE_INTX: pci_intx(dev, 1); break; default: return PCIBIOS_SET_FAILED; } } } And also, if INTERRUPT_TYPE_INTX, aren't you already enabled? -boris _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-12-20 19:11 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-12-19 3:49 [PATCH v2] xen-pciback: optionally allow interrupt enable flag writes Marek Marczykowski-Górecki 2019-12-19 3:49 ` [Xen-devel] " Marek Marczykowski-Górecki 2019-12-19 11:20 ` Jan Beulich 2019-12-19 11:20 ` [Xen-devel] " Jan Beulich 2019-12-19 12:57 ` Marek Marczykowski-Górecki 2019-12-19 12:57 ` [Xen-devel] " Marek Marczykowski-Górecki 2019-12-20 19:11 ` Boris Ostrovsky [this message] 2019-12-20 19:11 ` Boris Ostrovsky
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=4ed998e1-c8e6-a2c3-031a-9104c912cb76@oracle.com \ --to=boris.ostrovsky@oracle.com \ --cc=jgross@suse.com \ --cc=linux-kernel@vger.kernel.org \ --cc=marmarek@invisiblethingslab.com \ --cc=roger.pau@citrix.com \ --cc=simon@invisiblethingslab.com \ --cc=sstabellini@kernel.org \ --cc=xen-devel@lists.xenproject.org \ --cc=yuehaibing@huawei.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.