From patchwork Thu Mar 28 00:27:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 2353861 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id BC7ACDFE82 for ; Thu, 28 Mar 2013 00:38:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754356Ab3C1AiP (ORCPT ); Wed, 27 Mar 2013 20:38:15 -0400 Received: from mail.linux-iscsi.org ([67.23.28.174]:51819 "EHLO linux-iscsi.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751601Ab3C1AiO (ORCPT ); Wed, 27 Mar 2013 20:38:14 -0400 Received: from linux-iscsi.org (localhost [127.0.0.1]) by linux-iscsi.org (Postfix) with ESMTP id E16C622D9D0; Thu, 28 Mar 2013 00:27:11 +0000 (UTC) From: "Nicholas A. Bellinger" To: target-devel Cc: lf-virt , kvm-devel , "Michael S. Tsirkin" , Stefan Hajnoczi , Paolo Bonzini , Asias He , Anthony Liguori , Nicholas Bellinger Subject: [PATCH] tcm_vhost: Avoid VIRTIO_RING_F_EVENT_IDX feature bit Date: Thu, 28 Mar 2013 00:27:10 +0000 Message-Id: <1364430430-968-1-git-send-email-nab@linux-iscsi.org> X-Mailer: git-send-email 1.7.2.5 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nicholas Bellinger This patch adds a VHOST_TCM_FEATURES mask minus VIRTIO_RING_F_EVENT_IDX so that vhost-scsi-pci userspace will strip this feature bit once GET_FEATURES reports it as being unsupported on the host. This is to avoid a bug where ->handle_kicks() are missed when EVENT_IDX is enabled by default in userspace code. Cc: Michael S. Tsirkin Cc: Asias He Cc: Paolo Bonzini Signed-off-by: Nicholas Bellinger Acked-by: Michael S. Tsirkin --- drivers/vhost/tcm_vhost.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c index 0524267..b127edc 100644 --- a/drivers/vhost/tcm_vhost.c +++ b/drivers/vhost/tcm_vhost.c @@ -60,6 +60,12 @@ enum { VHOST_SCSI_VQ_IO = 2, }; +enum { + VHOST_TCM_FEATURES = (1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | + (1ULL << VIRTIO_RING_F_INDIRECT_DESC) | + (1ULL << VHOST_F_LOG_ALL) +}; + #define VHOST_SCSI_MAX_TARGET 256 #define VHOST_SCSI_MAX_VQ 128 @@ -981,7 +987,7 @@ static void vhost_scsi_flush(struct vhost_scsi *vs) static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) { - if (features & ~VHOST_FEATURES) + if (features & ~VHOST_TCM_FEATURES) return -EOPNOTSUPP; mutex_lock(&vs->dev.mutex); @@ -1027,7 +1033,7 @@ static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl, return -EFAULT; return 0; case VHOST_GET_FEATURES: - features = VHOST_FEATURES; + features = VHOST_TCM_FEATURES; if (copy_to_user(featurep, &features, sizeof features)) return -EFAULT; return 0;