kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Sheng Yang <sheng@linux.intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH 01/10] KVM: Add a route layer to convert MSI message to GSI
Date: Tue, 30 Dec 2008 12:39:47 +0200	[thread overview]
Message-ID: <4959FA73.1090303@redhat.com> (raw)
In-Reply-To: <1230616562-18113-2-git-send-email-sheng@linux.intel.com>

Sheng Yang wrote:
> Avi's purpose, to use single kvm_set_irq() to deal with all interrupt, including
> MSI. So here is it.
>
> struct gsi_msg is a mapping from a special gsi(with KVM_GSI_MSG_MASK) to
> MSI/MSI-X message address/data.
>
> Now we support up to 256 gsi_msg mapping, and gsi_msg is allocated by kernel and
> provide two ioctls to userspace, which is more flexiable.
>
>   

> +#define KVM_REQUEST_GSI_MSG _IOWR(KVMIO, 0x71, struct kvm_assigned_gsi_msg)
> +#define KVM_FREE_GSI_MSG _IOR(KVMIO, 0x72, struct kvm_assigned_gsi_msg)
>   

We will also need a pair for PIC and a pair for IOAPIC routing.

How about a single ioctl to set the entire routing table?  It would take 
an array of structures:

struct {
    __u32 gsi;
    __u32 type;
    __u32 flags;
    __u32 reserved;
    union {
         struct {
             __u32 irq;
         } pic;
         struct {
            __u32 ioapic; // can have >1 ioapic
            __u32 inti;
         } ioapic;
         struct {
            ...
         } msi;
         __u32 reserved[8];
    };
};

This way we can solve the HPET irq0/inti2 mess, and also have a simpler 
way of setting MSI.  All the mess in one ioctl.

> +
> +/* Call with kvm->gsi_msg_lock hold */
> +struct kvm_gsi_msg *kvm_find_gsi_msg(struct kvm *kvm, u32 gsi)
> +{
> +	struct kvm_gsi_msg *gsi_msg;
> +	struct hlist_node *n;
> +
> +	if (!(gsi & KVM_GSI_MSG_MASK))
> +		return NULL;
> +	hlist_for_each_entry(gsi_msg, n, &kvm->gsi_msg_list, link)
> +		if (gsi_msg->gsi == gsi)
> +			goto out;
> +	gsi_msg = NULL;
> +out:
> +	return gsi_msg;
> +}
>   

Linear search is a bit sad but fine for now.  Later we can add an array 
indexed by gsi.


-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2008-12-30 10:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-30  5:55 [PATCH 0/10][v3] GSI->MSG route layer for MSI/MSI-X Sheng Yang
2008-12-30  5:55 ` [PATCH 01/10] KVM: Add a route layer to convert MSI message to GSI Sheng Yang
2008-12-30 10:39   ` Avi Kivity [this message]
2008-12-30  5:55 ` [PATCH 02/10] KVM: Using gsi_msg mapping for MSI device assignment Sheng Yang
2008-12-30  5:55 ` [PATCH 03/10] KVM: Improve MSI dispatch function Sheng Yang
2008-12-30  5:55 ` [PATCH 04/10] KVM: Using ioapic_irqchip() macro for kvm_set_irq Sheng Yang
2008-12-30  5:55 ` [PATCH 05/10] KVM: Merge MSI handling to kvm_set_irq Sheng Yang
2008-12-30 10:48   ` Avi Kivity
2008-12-30 11:00     ` Sheng Yang
2008-12-30 11:07       ` Avi Kivity
2008-12-30 11:26         ` Sheng Yang
2008-12-30  5:55 ` [PATCH 06/10] KVM: Split IOAPIC structure Sheng Yang
2008-12-30  5:55 ` [PATCH 07/10] KVM: Unified the delivery of IOAPIC and MSI Sheng Yang
2008-12-30  5:56 ` [PATCH 08/10] KVM: Change API of kvm_ioapic_get_delivery_bitmask Sheng Yang
2008-12-30  5:56 ` [PATCH 09/10] KVM: Update intr delivery func to accept unsigned long* bitmap Sheng Yang
2008-12-30  5:56 ` [PATCH 10/10] KVM: bit ops for deliver_bitmap Sheng Yang
2008-12-30  6:01 ` [PATCH 0/10][v3] GSI->MSG route layer for MSI/MSI-X Sheng Yang
  -- strict thread matches above, loose matches on Subject: below --
2009-01-07 10:42 [PATCH 0/10][v4]GSI " Sheng Yang
2009-01-07 10:42 ` [PATCH 01/10] KVM: Add a route layer to convert MSI message to GSI Sheng Yang
2009-01-07 16:18   ` Marcelo Tosatti
2009-01-08  7:30     ` Sheng Yang

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=4959FA73.1090303@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=sheng@linux.intel.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;
as well as URLs for NNTP newsgroup(s).