From: "Michael S. Tsirkin" <mst@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH 4/9] msix: move definitions from msix.c to msix.h
Date: Mon, 20 Sep 2010 18:56:24 +0200 [thread overview]
Message-ID: <20100920165624.GC29862@redhat.com> (raw)
In-Reply-To: <1284995210-32432-5-git-send-email-avi@redhat.com>
On Mon, Sep 20, 2010 at 05:06:45PM +0200, Avi Kivity wrote:
> This allows us to reuse them from the kvm support code.
>
> Signed-off-by: Avi Kivity <avi@redhat.com>
I would rather all dealings with MSI-X table stayed in one place. All we
need is just the entry, so let's add APIs to retrieve MSIX address and
data:
uint64_t msix_get_address(dev, vector)
uint32_t msix_get_data(dev, vector)
and that will be enough for KVM.
> ---
> hw/msix.c | 27 ---------------------------
> hw/msix.h | 26 ++++++++++++++++++++++++++
> 2 files changed, 26 insertions(+), 27 deletions(-)
>
> diff --git a/hw/msix.c b/hw/msix.c
> index d762870..dda1a24 100644
> --- a/hw/msix.c
> +++ b/hw/msix.c
> @@ -16,33 +16,6 @@
> #include "pci.h"
> #include "kvm.h"
>
> -/* MSI-X capability structure */
> -#define MSIX_TABLE_OFFSET 4
> -#define MSIX_PBA_OFFSET 8
> -#define MSIX_CAP_LENGTH 12
> -
> -/* MSI enable bit and maskall bit are in byte 1 in FLAGS register */
> -#define MSIX_CONTROL_OFFSET (PCI_MSIX_FLAGS + 1)
> -#define MSIX_ENABLE_MASK (PCI_MSIX_FLAGS_ENABLE >> 8)
> -#define MSIX_MASKALL_MASK (PCI_MSIX_FLAGS_MASKALL >> 8)
> -
> -/* MSI-X table format */
> -#define MSIX_MSG_ADDR 0
> -#define MSIX_MSG_UPPER_ADDR 4
> -#define MSIX_MSG_DATA 8
> -#define MSIX_VECTOR_CTRL 12
> -#define MSIX_ENTRY_SIZE 16
> -#define MSIX_VECTOR_MASK 0x1
> -
> -/* How much space does an MSIX table need. */
> -/* The spec requires giving the table structure
> - * a 4K aligned region all by itself. */
> -#define MSIX_PAGE_SIZE 0x1000
> -/* Reserve second half of the page for pending bits */
> -#define MSIX_PAGE_PENDING (MSIX_PAGE_SIZE / 2)
> -#define MSIX_MAX_ENTRIES 32
> -
> -
> /* Flag for interrupt controller to declare MSI-X support */
> int msix_supported;
>
> diff --git a/hw/msix.h b/hw/msix.h
> index 6b21ffb..5c84b3e 100644
> --- a/hw/msix.h
> +++ b/hw/msix.h
> @@ -4,6 +4,32 @@
> #include "qemu-common.h"
> #include "pci.h"
>
> +/* MSI-X capability structure */
> +#define MSIX_TABLE_OFFSET 4
> +#define MSIX_PBA_OFFSET 8
> +#define MSIX_CAP_LENGTH 12
> +
> +/* MSI enable bit and maskall bit are in byte 1 in FLAGS register */
> +#define MSIX_CONTROL_OFFSET (PCI_MSIX_FLAGS + 1)
> +#define MSIX_ENABLE_MASK (PCI_MSIX_FLAGS_ENABLE >> 8)
> +#define MSIX_MASKALL_MASK (PCI_MSIX_FLAGS_MASKALL >> 8)
> +
> +/* MSI-X table format */
> +#define MSIX_MSG_ADDR 0
> +#define MSIX_MSG_UPPER_ADDR 4
> +#define MSIX_MSG_DATA 8
> +#define MSIX_VECTOR_CTRL 12
> +#define MSIX_ENTRY_SIZE 16
> +#define MSIX_VECTOR_MASK 0x1
> +
> +/* How much space does an MSIX table need. */
> +/* The spec requires giving the table structure
> + * a 4K aligned region all by itself. */
> +#define MSIX_PAGE_SIZE 0x1000
> +/* Reserve second half of the page for pending bits */
> +#define MSIX_PAGE_PENDING (MSIX_PAGE_SIZE / 2)
> +#define MSIX_MAX_ENTRIES 32
> +
> int msix_init(PCIDevice *pdev, unsigned short nentries,
> unsigned bar_nr, unsigned bar_size);
>
> --
> 1.7.2.3
next prev parent reply other threads:[~2010-09-20 17:02 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-20 15:06 [PATCH 0/9] msix/kvm integration cleanups Avi Kivity
2010-09-20 15:06 ` [PATCH 1/9] msix: avoid leaking kvm data on init failure Avi Kivity
2010-09-20 15:06 ` [PATCH 2/9] msix: make kvm specific initialization a function Avi Kivity
2010-09-20 15:06 ` [PATCH 3/9] msix: move kvm specific msix notify into " Avi Kivity
2010-09-20 15:06 ` [PATCH 4/9] msix: move definitions from msix.c to msix.h Avi Kivity
2010-09-20 16:56 ` Michael S. Tsirkin [this message]
2010-09-21 16:03 ` Avi Kivity
2010-09-20 15:06 ` [PATCH 5/9] Add missing #include to hw/irq.h Avi Kivity
2010-09-20 15:06 ` [PATCH 6/9] msix: move kvm support functions to kvm-all.c and kvm-stub.c Avi Kivity
2010-09-20 15:06 ` [PATCH 7/9] msix: Move kvm_enabled() guards to kvm-all.c functions Avi Kivity
2010-09-20 15:06 ` [PATCH 8/9] Protect qemu-kvm.h declarations with NEED_CPU_H Avi Kivity
2010-09-20 17:05 ` Michael S. Tsirkin
2010-09-21 16:03 ` Avi Kivity
2010-09-20 15:06 ` [PATCH 9/9] Move msix.o build back to Makefile.objs Avi Kivity
2010-09-20 17:02 ` [PATCH 0/9] msix/kvm integration cleanups Michael S. Tsirkin
2010-09-21 16:05 ` Avi Kivity
2010-09-21 16:14 ` Michael S. Tsirkin
2010-10-06 9:39 ` Michael S. Tsirkin
2010-10-06 9:50 ` Avi Kivity
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=20100920165624.GC29862@redhat.com \
--to=mst@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.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: 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