public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Yang, Sheng" <sheng.yang@intel.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	kvm@vger.kernel.org
Subject: Mask bit support's API
Date: Tue, 23 Nov 2010 14:09:52 +0800	[thread overview]
Message-ID: <201011231409.52666.sheng.yang@intel.com> (raw)

Hi Avi,

I've purposed the following API for mask bit support.

The main point is, QEmu can know which entries are enabled(by pci_enable_msix()). 
And for enabled entries, kernel own it, including MSI data/address and mask 
bit(routing table and mask bitmap). QEmu should use KVM_GET_MSIX_ENTRY ioctl to 
get them(and it can sync with them if it want to do so).

Before entries are enabled, QEmu can still use it's own MSI table(because we 
didn't contain these kind of information in kernel, and it's unnecessary for 
kernel). 

The KVM_MSIX_FLAG_ENTRY flag would be clear if QEmu want to query one entry didn't 
exist in kernel - or we can simply return -EINVAL for it.

I suppose it would be rare for QEmu to use this interface to get the context of 
entry(the only case I think is when MSI-X disable and QEmu need to sync the 
context), so performance should not be an issue.

What's your opinion?

> #define KVM_GET_MSIX_ENTRY        _IOWR(KVMIO,  0x7d, struct kvm_msix_entry) 
> #define KVM_UPDATE_MSIX_MMIO      _IOW(KVMIO,  0x7e, struct kvm_msix_mmio)   
>
> #define KVM_MSIX_TYPE_ASSIGNED_DEV      1                       
>                                                                 
> #define KVM_MSIX_FLAG_MASKBIT           (1 << 0)                
> #define KVM_MSIX_FLAG_QUERY_MASKBIT     (1 << 0)                
> #define KVM_MSIX_FLAG_ENTRY             (1 << 1)                
> #define KVM_MSIX_FLAG_QUERY_ENTRY       (1 << 1)                
>                                                                 
> struct kvm_msix_entry {                                         
>         __u32 id;                                               
>         __u32 type;                                             
>         __u32 entry; /* The index of entry in the MSI-X table */
>         __u32 flags;                                            
>         __u32 query_flags;                                      
>         union {                                                 
>                 struct {                                        
>                         __u32 addr_lo;                          
>                         __u32 addr_hi;                          
>                         __u32 data;                             
>                 } msi_entry;                                    
>                 __u32 reserved[12];                             
>         };                                                      
> };                                                              
>                                                                 
> #define KVM_MSIX_MMIO_FLAG_REGISTER     (1 << 0)                
> #define KVM_MSIX_MMIO_FLAG_UNREGISTER   (1 << 1)                
> #define KVM_MSIX_MMIO_FLAG_MASK         0x3                     
>                                                                 
> struct kvm_msix_mmio {                                          
>         __u32 id;                                               
>         __u32 type;                                             
>         __u64 base_addr;                                        
>         __u32 max_entries_nr;                                   
>         __u32 flags;                                            
>         __u32 reserved[6];                                      
> };                                                              

--
regards
Yang, Sheng                                         

             reply	other threads:[~2010-11-23  6:09 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-23  6:09 Yang, Sheng [this message]
2010-11-23  6:17 ` Mask bit support's API Avi Kivity
2010-11-23  6:35   ` Yang, Sheng
2010-11-23  7:54     ` Avi Kivity
2010-11-23  8:30       ` Yang, Sheng
2010-11-23 12:47         ` Avi Kivity
2010-11-23 12:56           ` Michael S. Tsirkin
2010-11-23 13:57           ` Yang, Sheng
2010-11-23 14:06             ` Avi Kivity
2010-11-23 15:11               ` Michael S. Tsirkin
2010-11-23 15:24                 ` Gleb Natapov
2010-11-23 16:10                   ` Michael S. Tsirkin
2010-11-24  1:59               ` Yang, Sheng
2010-11-26  2:35                 ` Yang, Sheng
2010-11-30 14:15                   ` Avi Kivity
2010-12-01  2:36                     ` Yang, Sheng
2010-12-02 13:09                       ` Avi Kivity
2010-12-02 13:47                         ` Michael S. Tsirkin
2010-12-02 13:56                           ` Avi Kivity
2010-12-02 14:26                             ` Michael S. Tsirkin
2010-12-02 14:54                               ` Sheng Yang
2010-12-02 16:55                                 ` Michael S. Tsirkin
2010-12-03  3:03                                   ` Yang, Sheng
2010-11-23 12:04 ` Michael S. Tsirkin
2010-11-23 14:02   ` Yang, Sheng

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=201011231409.52666.sheng.yang@intel.com \
    --to=sheng.yang@intel.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --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