From patchwork Mon Jul 16 14:25:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1201021 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 83910E007C for ; Mon, 16 Jul 2012 14:26:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753517Ab2GPO0U (ORCPT ); Mon, 16 Jul 2012 10:26:20 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:59203 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753487Ab2GPO0T (ORCPT ); Mon, 16 Jul 2012 10:26:19 -0400 Received: by mail-pb0-f46.google.com with SMTP id rp8so10129290pbb.19 for ; Mon, 16 Jul 2012 07:26:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=jdEV55/63iC1DrKxarBCmVzeebH0K4EcJfb5rQ7IanM=; b=lh+PHTu0DjKRZjtChcrgjtukPDJ86PqMOE8jmOmyUR3D2UgEALNimpmgkJevMl3FNY QFbmq1zwAldUn7yCyikvgkmNlpdw26PBSOftLqz/5kSPkgYyiyr9gzN36jQPoxbdCR2Y ZbN0eX+qtmVh4Qg3rUty+7BxDZrGFLXRwlsykhA4fR9vbEdTigQsZ/6ZapCAuu8URxt/ rM1Amr7jnRXUk+z87qTPTT6/EpjUcteidpJW7a6RK96s/C6KQr7QD7BBL1ltZTW4pg0w VGoMxwpVCJBFegN9odaXOxTMCpcsifOpqgno933HMcp3GBzGSNcrrJMGFFSZpeQcO64b MTLQ== Received: by 10.68.197.70 with SMTP id is6mr26820362pbc.64.1342448778806; Mon, 16 Jul 2012 07:26:18 -0700 (PDT) Received: from yakj.usersys.redhat.com (93-34-189-113.ip51.fastwebnet.it. [93.34.189.113]) by mx.google.com with ESMTPS id qa5sm11997476pbb.19.2012.07.16.07.26.16 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 Jul 2012 07:26:17 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org Subject: [PATCH 4/5] scsi: report parameter changes to HBA drivers Date: Mon, 16 Jul 2012 16:25:55 +0200 Message-Id: <1342448756-7582-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1342448756-7582-1-git-send-email-pbonzini@redhat.com> References: <1342448756-7582-1-git-send-email-pbonzini@redhat.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Signed-off-by: Paolo Bonzini --- hw/scsi-bus.c | 10 ++++++++++ hw/scsi-disk.c | 2 +- hw/scsi.h | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c index d5e1fb0..77aa946 100644 --- a/hw/scsi-bus.c +++ b/hw/scsi-bus.c @@ -1072,6 +1072,16 @@ int scsi_req_parse(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf) return 0; } +void scsi_device_report_change(SCSIDevice *dev, SCSISense sense) +{ + SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, dev->qdev.parent_bus); + + scsi_device_set_ua(dev, sense); + if (bus->info->change) { + bus->info->change(bus, dev, sense); + } +} + /* * Predefined sense codes */ diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index fabd0bf..8351de5 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -1867,7 +1867,7 @@ static void scsi_disk_resize_cb(void *opaque) { SCSIDiskState *s = opaque; - scsi_device_set_ua(&s->qdev, SENSE_CODE(CAPACITY_CHANGED)); + scsi_device_report_change(&s->qdev, SENSE_CODE(CAPACITY_CHANGED)); } static void scsi_cd_change_media_cb(void *opaque, bool load) diff --git a/hw/scsi.h b/hw/scsi.h index 4804be9..380bb89 100644 --- a/hw/scsi.h +++ b/hw/scsi.h @@ -132,6 +132,7 @@ struct SCSIBusInfo { void (*cancel)(SCSIRequest *req); void (*hotplug)(SCSIBus *bus, SCSIDevice *dev); void (*hot_unplug)(SCSIBus *bus, SCSIDevice *dev); + void (*change)(SCSIBus *bus, SCSIDevice *dev, SCSISense sense); QEMUSGList *(*get_sg_list)(SCSIRequest *req); void (*save_request)(QEMUFile *f, SCSIRequest *req); @@ -240,6 +241,7 @@ void scsi_req_cancel(SCSIRequest *req); void scsi_req_retry(SCSIRequest *req); void scsi_device_purge_requests(SCSIDevice *sdev, SCSISense sense); void scsi_device_set_ua(SCSIDevice *sdev, SCSISense sense); +void scsi_device_report_change(SCSIDevice *dev, SCSISense sense); int scsi_device_get_sense(SCSIDevice *dev, uint8_t *buf, int len, bool fixed); SCSIDevice *scsi_device_find(SCSIBus *bus, int channel, int target, int lun);