From patchwork Sun May 8 13:09:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asias He X-Patchwork-Id: 765752 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p48DBFxd011594 for ; Sun, 8 May 2011 13:11:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753098Ab1EHNLQ (ORCPT ); Sun, 8 May 2011 09:11:16 -0400 Received: from mail-px0-f173.google.com ([209.85.212.173]:32996 "EHLO mail-px0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753084Ab1EHNLP (ORCPT ); Sun, 8 May 2011 09:11:15 -0400 Received: by pxi16 with SMTP id 16so3105032pxi.4 for ; Sun, 08 May 2011 06:11:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=0EEqfswQV55Syz6D46+BvFlTOrZrYOQ8WGnXowdgJtI=; b=T2PqqcMgzw1oXG5deiMFrTqH/6BUq0B83k3HCeSbCREjRyFYXTQd9PrgL+kA149YHJ l8LdYE1XoiB6IU/gArAAl1JYwRe7DHuzwNiKHuHyh+x8ifyF4oP87hn465Vu9c2BDiLs YypVXZTgFnqJ/tooey8fNPSGJ2FkPrgaCf1jc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=bXW7tSy6jM0578QKSGbo5nW14sJa+fB9dvwhsTdRFP8XQzqvX4gPQM9VEQgtBWAZOn +33rDC0TJLm4lmjPSSTXgg6ZJ2Fd/gRLPaJy6xh9qcH0bP6KhQFjoM8mkE6yYhMULf/P t7l6RoVlyONiykP3OBgABDrVirXFE1s+d8OTU= Received: by 10.68.0.227 with SMTP id 3mr7982778pbh.284.1304860274665; Sun, 08 May 2011 06:11:14 -0700 (PDT) Received: from localhost.localdomain ([202.112.128.133]) by mx.google.com with ESMTPS id y7sm3442117pbk.30.2011.05.08.06.11.05 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 08 May 2011 06:11:13 -0700 (PDT) From: Asias He To: Pekka Enberg , Cyrill Gorcunov , Ingo Molnar , Sasha Levin , Prasad Joshi Cc: kvm@vger.kernel.org, Asias He 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 Message-Id: <1304860165-28810-3-git-send-email-asias.hejun@gmail.com> X-Mailer: git-send-email 1.7.5.1 In-Reply-To: <1304860165-28810-1-git-send-email-asias.hejun@gmail.com> References: <1304860165-28810-1-git-send-email-asias.hejun@gmail.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 08 May 2011 13:11:20 +0000 (UTC) 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 --- 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)