From: Asias He <asias.hejun@gmail.com>
To: Pekka Enberg <penberg@kernel.org>,
Cyrill Gorcunov <gorcunov@gmail.com>, Ingo Molnar <mingo@elte.hu>,
Sasha Levin <levinsasha928@gmail.com>,
Prasad Joshi <prasadjoshi124@gmail.com>
Cc: kvm@vger.kernel.org, Asias He <asias.hejun@gmail.com>
Subject: [PATCH v2 2/4] kvm tools: Use virt_queue__trigger_irq() to trigger IRQ for virtio blk
Date: Sun, 8 May 2011 21:09:23 +0800 [thread overview]
Message-ID: <1304860165-28810-3-git-send-email-asias.hejun@gmail.com> (raw)
In-Reply-To: <1304860165-28810-1-git-send-email-asias.hejun@gmail.com>
This patch uses IRQ injection mechanism introduced by
virt_queue__trigger_irq() which respect virtio IRQ status
and VRING_AVAIL_F_NO_INTERRUPT.
Signed-off-by: Asias He <asias.hejun@gmail.com>
---
tools/kvm/virtio/blk.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/kvm/virtio/blk.c b/tools/kvm/virtio/blk.c
index cc3dc78..12c7029 100644
--- a/tools/kvm/virtio/blk.c
+++ b/tools/kvm/virtio/blk.c
@@ -38,6 +38,7 @@ struct blk_dev {
u32 guest_features;
u16 config_vector;
u8 status;
+ u8 isr;
u8 idx;
/* virtio queue */
@@ -102,8 +103,9 @@ static bool virtio_blk_pci_io_in(struct kvm *self, u16 port, void *data, int siz
ioport__write8(data, bdev->status);
break;
case VIRTIO_PCI_ISR:
- ioport__write8(data, 0x1);
- kvm__irq_line(self, bdev->pci_hdr.irq_line, 0);
+ ioport__write8(data, bdev->isr);
+ kvm__irq_line(self, bdev->pci_hdr.irq_line, VIRTIO_IRQ_LOW);
+ bdev->isr = VIRTIO_IRQ_LOW;
break;
case VIRTIO_MSI_CONFIG_VECTOR:
ioport__write16(data, bdev->config_vector);
@@ -167,7 +169,7 @@ static void virtio_blk_do_io(struct kvm *kvm, void *param)
while (virt_queue__available(vq))
virtio_blk_do_io_request(kvm, bdev, vq);
- kvm__irq_line(kvm, bdev->pci_hdr.irq_line, 1);
+ virt_queue__trigger_irq(vq, bdev->pci_hdr.irq_line, &bdev->isr, kvm);
}
static bool virtio_blk_pci_io_out(struct kvm *self, u16 port, void *data, int size, u32 count)
--
1.7.5.1
next prev parent reply other threads:[~2011-05-08 13:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-08 13:09 [PATCH v2 0/4] Resend this patch series Asias He
2011-05-08 13:09 ` [PATCH v2 1/4] kvm tools: Use virt_queue__trigger_irq() to trigger IRQ for virtio console Asias He
2011-05-08 13:09 ` Asias He [this message]
2011-05-08 13:09 ` [PATCH v2 3/4] kvm tools: Use virt_queue__trigger_irq() to trigger IRQ for virtio rng Asias He
2011-05-08 13:09 ` [PATCH v2 4/4] kvm tools: Fix virtio console hangs by removing IRQ injection for tx path Asias He
2011-05-08 17:05 ` Pekka Enberg
2011-05-08 17:21 ` Sasha Levin
2011-05-08 17:28 ` Pekka Enberg
2011-05-08 17:29 ` Sasha Levin
2011-05-08 17:34 ` Pekka Enberg
2011-05-08 17:35 ` Sasha Levin
2011-05-08 17:41 ` Pekka Enberg
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=1304860165-28810-3-git-send-email-asias.hejun@gmail.com \
--to=asias.hejun@gmail.com \
--cc=gorcunov@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=levinsasha928@gmail.com \
--cc=mingo@elte.hu \
--cc=penberg@kernel.org \
--cc=prasadjoshi124@gmail.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).