From patchwork Sun May 8 02:14:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asias He X-Patchwork-Id: 764982 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 p482FoZm002889 for ; Sun, 8 May 2011 02:15:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751484Ab1EHCPo (ORCPT ); Sat, 7 May 2011 22:15:44 -0400 Received: from mail-px0-f173.google.com ([209.85.212.173]:55458 "EHLO mail-px0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751155Ab1EHCPf (ORCPT ); Sat, 7 May 2011 22:15:35 -0400 Received: by pxi16 with SMTP id 16so2967742pxi.4 for ; Sat, 07 May 2011 19:15:34 -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=YyZRijhWjihWCbBq2wUap9SqVugfop4fcc3DSImbjiuXPTqeR1lXAw33wLfta/v7nn Efmo7wtMuRI4Ydf5zr7MnPWRKRrTaMvRU/DZtaSURJHZnEC5vLqjq/LKY6EYIxy0TDDz hwBY5ywxbkPyoBHQKq7qPEVhxbcCGkfMx33lo= 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=teAlWTwKKTxql2LzLPuOEbUpqcPxwpL5yE+Zc1vH+j1Fkim1RoDJJ4dsVjbLNxLVQn JaHKvqitaLn16q31C77nnMH3RaFbPqSM54MxdzIgi73ncQTGVh7MYzhmBmHxqKd0khou R6UrxCcfEMU/VeW7mW67l5q5TXAh1XAeoahqU= Received: by 10.143.21.32 with SMTP id y32mr2792670wfi.263.1304820934636; Sat, 07 May 2011 19:15:34 -0700 (PDT) Received: from localhost.localdomain ([202.112.128.133]) by mx.google.com with ESMTPS id z10sm6192308wfj.15.2011.05.07.19.15.30 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 07 May 2011 19:15:34 -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 2/3] kvm tools: Use virt_queue__trigger_irq() to trigger IRQ for virtio blk Date: Sun, 8 May 2011 10:14:06 +0800 Message-Id: <1304820847-13125-2-git-send-email-asias.hejun@gmail.com> X-Mailer: git-send-email 1.7.5.1 In-Reply-To: <1304820847-13125-1-git-send-email-asias.hejun@gmail.com> References: <1304820847-13125-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 02:15:50 +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)