From: "Michael S. Tsirkin" <mst@redhat.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: yamahata@valinux.co.jp, qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 1/3] msi: Allow pre-existing MSI capabilities
Date: Tue, 2 Nov 2010 14:02:02 +0200 [thread overview]
Message-ID: <20101102120202.GA29492@redhat.com> (raw)
In-Reply-To: <20101102053727.10424.32902.stgit@s20.home>
On Mon, Nov 01, 2010 at 11:37:32PM -0600, Alex Williamson wrote:
> For use with device assignment, allow calling msi_init() on devices
> with MSI capability already configured.
>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Looks like the same find/add trick is repeated all over:
you put it in msix and now in msi. How about
we teach pci_add_capability about this functionality?
Then if offset is != 0 and capability is found, we can assert.
> ---
>
> hw/msi.c | 12 +++++++++---
> 1 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/hw/msi.c b/hw/msi.c
> index f03f519..0ad4e38 100644
> --- a/hw/msi.c
> +++ b/hw/msi.c
> @@ -135,10 +135,16 @@ int msi_init(struct PCIDevice *dev, uint8_t offset,
> flags |= PCI_MSI_FLAGS_MASKBIT;
> }
>
> + config_offset = pci_find_capability(dev, PCI_CAP_ID_MSI);
> +
> cap_size = msi_cap_sizeof(flags);
> - config_offset = pci_add_capability(dev, PCI_CAP_ID_MSI, offset, cap_size);
> - if (config_offset < 0) {
> - return config_offset;
> +
> + if (!config_offset) {
> + config_offset = pci_add_capability(dev, PCI_CAP_ID_MSI,
> + offset, cap_size);
> + if (config_offset < 0) {
> + return config_offset;
> + }
> }
>
> dev->msi_cap = config_offset;
next prev parent reply other threads:[~2010-11-02 13:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-02 5:37 [Qemu-devel] [PATCH 0/3] msi: Small fixes and enhancements Alex Williamson
2010-11-02 5:37 ` [Qemu-devel] [PATCH 1/3] msi: Allow pre-existing MSI capabilities Alex Williamson
2010-11-02 12:02 ` Michael S. Tsirkin [this message]
2010-11-02 5:37 ` [Qemu-devel] [PATCH 2/3] msi: Cleanup uninit Alex Williamson
2010-11-02 5:37 ` [Qemu-devel] [PATCH 3/3] msi: Store the capability size in PCIDevice Alex Williamson
2010-11-02 9:25 ` [Qemu-devel] " Michael S. Tsirkin
2010-11-02 14:00 ` Alex Williamson
2010-11-02 14:07 ` Michael S. Tsirkin
2010-11-02 14:23 ` Alex Williamson
2010-11-02 15:39 ` Michael S. Tsirkin
2010-11-02 16:08 ` Alex Williamson
2010-11-02 19:26 ` Michael S. Tsirkin
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=20101102120202.GA29492@redhat.com \
--to=mst@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yamahata@valinux.co.jp \
/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 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.