From patchwork Tue Oct 30 12:16:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1670161 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id D1EC83FD8C for ; Tue, 30 Oct 2012 12:17:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933554Ab2J3MRI (ORCPT ); Tue, 30 Oct 2012 08:17:08 -0400 Received: from mail-da0-f46.google.com ([209.85.210.46]:35878 "EHLO mail-da0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933424Ab2J3MRG (ORCPT ); Tue, 30 Oct 2012 08:17:06 -0400 Received: by mail-da0-f46.google.com with SMTP id n41so88016dak.19 for ; Tue, 30 Oct 2012 05:17:06 -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=xLFwIYvuh70XgUn9wPSyOeoEs6YtkjeWFw1YdL8n2bk=; b=W4sw7WjEx6ErQvIi+AcZY0IRlWAibWXkeWIKH9zNuhdPVkF257UAvACrVpgZYRITNl 1yqUMRTF5AFKnleVon9BQFSRJ6lh8oDF3FV/wsXr7D6Ry7TwYQVp+2ESMprB5XAKUiI4 /LZQ87YqWJoibRzbMcRZDkpXOd6186EUnSW6YDGq/MOZBMJbiQgfmexxyd5xsuyZwQ0P 0uQw3yfHLQ/hfjt5/V440OWSj6/+WZAwQ7gqObzx6vOZ0KQqfEoLTs3FcRz/lSc7bm7G fJwA26XeHCOk2KJlypfhJjXFWxywsNy9D/dQuJsRG09G7W4sdHIyEEkN9UPcWhk343TO Js5A== Received: by 10.68.233.196 with SMTP id ty4mr102870815pbc.23.1351599426560; Tue, 30 Oct 2012 05:17:06 -0700 (PDT) Received: from yakj.usersys.redhat.com (93-34-169-1.ip50.fastwebnet.it. [93.34.169.1]) by mx.google.com with ESMTPS id o10sm319041paz.37.2012.10.30.05.17.03 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 30 Oct 2012 05:17:05 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: avi@redhat.com, mtosatti@redhat.com, jan.kiszka@siemens.com, kvm@vger.kernel.org Subject: [PATCH 5/3] ioapic: unify reset callbacks Date: Tue, 30 Oct 2012 13:16:34 +0100 Message-Id: <1351599394-24876-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.12.1 In-Reply-To: <1351599394-24876-1-git-send-email-pbonzini@redhat.com> References: <1351599394-24876-1-git-send-email-pbonzini@redhat.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The reset callback of the in-kernel ioapic has to update the kernel state. This can be done for all "models" using ioapic_put. Signed-off-by: Paolo Bonzini --- hw/ioapic.c | 2 -- hw/ioapic_common.c | 2 ++ hw/ioapic_internal.h | 2 -- hw/kvm/ioapic.c | 9 --------- 4 files changed, 2 insertions(+), 13 deletions(-) diff --git a/hw/ioapic.c b/hw/ioapic.c index 7273095..c9f5993 100644 --- a/hw/ioapic.c +++ b/hw/ioapic.c @@ -238,10 +238,8 @@ static void ioapic_init(IOAPICCommonState *s, int instance_no) static void ioapic_class_init(ObjectClass *klass, void *data) { IOAPICCommonClass *k = IOAPIC_COMMON_CLASS(klass); - DeviceClass *dc = DEVICE_CLASS(klass); k->init = ioapic_init; - dc->reset = ioapic_reset_common; } static TypeInfo ioapic_info = { diff --git a/hw/ioapic_common.c b/hw/ioapic_common.c index 1f3ea37..37715ab 100644 --- a/hw/ioapic_common.c +++ b/hw/ioapic_common.c @@ -52,6 +52,7 @@ static void ioapic_reset_common(DeviceState *dev) for (i = 0; i < IOAPIC_NUM_PINS; i++) { s->ioredtbl[i] = 1 << IOAPIC_LVT_MASKED_SHIFT; } + ioapic_put(s); } static void ioapic_pre_save(void *opaque) @@ -109,6 +110,7 @@ static void ioapic_common_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); sc->init = ioapic_init_common; + dc->reset = ioapic_reset_common; dc->vmsd = &vmstate_ioapic_common; dc->no_user = 1; } diff --git a/hw/ioapic_internal.h b/hw/ioapic_internal.h index 7311ad0..f8861a2 100644 --- a/hw/ioapic_internal.h +++ b/hw/ioapic_internal.h @@ -97,6 +97,4 @@ struct IOAPICCommonState { uint64_t ioredtbl[IOAPIC_NUM_PINS]; }; -void ioapic_reset_common(DeviceState *dev); - #endif /* !QEMU_IOAPIC_INTERNAL_H */ diff --git a/hw/kvm/ioapic.c b/hw/kvm/ioapic.c index 03cb36c..41cfa08 100644 --- a/hw/kvm/ioapic.c +++ b/hw/kvm/ioapic.c @@ -69,14 +69,6 @@ static void kvm_ioapic_put(IOAPICCommonState *s) } } -static void kvm_ioapic_reset(DeviceState *dev) -{ - IOAPICCommonState *s = DO_UPCAST(IOAPICCommonState, busdev.qdev, dev); - - ioapic_reset_common(dev); - kvm_ioapic_put(s); -} - static void kvm_ioapic_set_irq(void *opaque, int irq, int level) { KVMIOAPICState *s = opaque; @@ -106,7 +98,6 @@ static void kvm_ioapic_class_init(ObjectClass *klass, void *data) k->init = kvm_ioapic_init; k->get = kvm_ioapic_get; k->put = kvm_ioapic_put; - dc->reset = kvm_ioapic_reset; dc->props = kvm_ioapic_properties; }