From patchwork Thu Oct 18 13:04:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 10647137 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A307D109C for ; Thu, 18 Oct 2018 13:05:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96033288B7 for ; Thu, 18 Oct 2018 13:05:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A2B0288CB; Thu, 18 Oct 2018 13:05:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 39305288B7 for ; Thu, 18 Oct 2018 13:05:51 +0000 (UTC) Received: from localhost ([::1]:42322 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gD7zq-0007Rh-Dq for patchwork-qemu-devel@patchwork.kernel.org; Thu, 18 Oct 2018 09:05:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39084) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gD7yt-0006lR-0N for qemu-devel@nongnu.org; Thu, 18 Oct 2018 09:04:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gD7ys-00032Y-9i for qemu-devel@nongnu.org; Thu, 18 Oct 2018 09:04:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58844) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gD7ys-0002yK-3J for qemu-devel@nongnu.org; Thu, 18 Oct 2018 09:04:50 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 50AEC88E4F; Thu, 18 Oct 2018 13:04:49 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.158]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E7372105704F; Thu, 18 Oct 2018 13:04:46 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peng Hao Date: Thu, 18 Oct 2018 15:04:31 +0200 Message-Id: <20181018130434.23237-2-philmd@redhat.com> In-Reply-To: <20181018130434.23237-1-philmd@redhat.com> References: <20181018130434.23237-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 18 Oct 2018 13:04:49 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 1/4] hw/misc/pvpanic: Build the pvpanic device in $(common-obj) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , qemu-devel@nongnu.org, Wen Congyang , Hu Tao Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The 'pvpanic' ISA device can be use by any machine with an ISA bus. Signed-off-by: Philippe Mathieu-Daudé --- hw/misc/Makefile.objs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs index 6d50b03cfd..74e7300f30 100644 --- a/hw/misc/Makefile.objs +++ b/hw/misc/Makefile.objs @@ -11,6 +11,7 @@ common-obj-$(CONFIG_PCA9552) += pca9552.o common-obj-y += unimp.o common-obj-$(CONFIG_FW_CFG_DMA) += vmcoreinfo.o +common-obj-$(CONFIG_PVPANIC) += pvpanic.o # ARM devices common-obj-$(CONFIG_PL310) += arm_l2x0.o @@ -70,7 +71,6 @@ obj-$(CONFIG_IOTKIT_SECCTL) += iotkit-secctl.o obj-$(CONFIG_IOTKIT_SYSCTL) += iotkit-sysctl.o obj-$(CONFIG_IOTKIT_SYSINFO) += iotkit-sysinfo.o -obj-$(CONFIG_PVPANIC) += pvpanic.o obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o obj-$(CONFIG_AUX) += auxbus.o obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o aspeed_sdmc.o From patchwork Thu Oct 18 13:04:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 10647149 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 748FD14E2 for ; Thu, 18 Oct 2018 13:08:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64C7B28944 for ; Thu, 18 Oct 2018 13:08:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6157128901; Thu, 18 Oct 2018 13:08:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 667E5289E2 for ; Thu, 18 Oct 2018 13:07:58 +0000 (UTC) Received: from localhost ([::1]:42335 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gD81t-0000le-AD for patchwork-qemu-devel@patchwork.kernel.org; Thu, 18 Oct 2018 09:07:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39186) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gD7yx-0006oa-Np for qemu-devel@nongnu.org; Thu, 18 Oct 2018 09:04:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gD7yw-0003C5-AX for qemu-devel@nongnu.org; Thu, 18 Oct 2018 09:04:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58898) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gD7yw-0003A2-0w for qemu-devel@nongnu.org; Thu, 18 Oct 2018 09:04:54 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 277E688E52; Thu, 18 Oct 2018 13:04:53 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.158]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E09B5105704B; Thu, 18 Oct 2018 13:04:49 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peng Hao Date: Thu, 18 Oct 2018 15:04:32 +0200 Message-Id: <20181018130434.23237-3-philmd@redhat.com> In-Reply-To: <20181018130434.23237-1-philmd@redhat.com> References: <20181018130434.23237-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 18 Oct 2018 13:04:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 2/4] hw/misc/pvpanic: Cosmetic renaming X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , qemu-devel@nongnu.org, Wen Congyang , Hu Tao Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP To ease the MMIO device addition in the next patch, rename: - ISA_PVPANIC_DEVICE -> PVPANIC (this just returns a generic Object), - ISADevice parent_obj -> isadev, - MemoryRegion io -> mr. Signed-off-by: Philippe Mathieu-Daudé --- hw/misc/pvpanic.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c index 9d8961ba0c..4f552e1533 100644 --- a/hw/misc/pvpanic.c +++ b/hw/misc/pvpanic.c @@ -25,7 +25,7 @@ /* The pv event value */ #define PVPANIC_PANICKED (1 << PVPANIC_F_PANICKED) -#define ISA_PVPANIC_DEVICE(obj) \ +#define PVPANIC(obj) \ OBJECT_CHECK(PVPanicState, (obj), TYPE_PVPANIC) static void handle_event(int event) @@ -46,9 +46,11 @@ static void handle_event(int event) #include "hw/isa/isa.h" typedef struct PVPanicState { - ISADevice parent_obj; + /*< private >*/ + ISADevice isadev; - MemoryRegion io; + /*< public >*/ + MemoryRegion mr; uint16_t ioport; } PVPanicState; @@ -75,15 +77,15 @@ static const MemoryRegionOps pvpanic_ops = { static void pvpanic_isa_initfn(Object *obj) { - PVPanicState *s = ISA_PVPANIC_DEVICE(obj); + PVPanicState *s = PVPANIC(obj); - memory_region_init_io(&s->io, OBJECT(s), &pvpanic_ops, s, "pvpanic", 1); + memory_region_init_io(&s->mr, OBJECT(s), &pvpanic_ops, s, "pvpanic", 1); } static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp) { ISADevice *d = ISA_DEVICE(dev); - PVPanicState *s = ISA_PVPANIC_DEVICE(dev); + PVPanicState *s = PVPANIC(dev); FWCfgState *fw_cfg = fw_cfg_find(); uint16_t *pvpanic_port; @@ -96,7 +98,7 @@ static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp) fw_cfg_add_file(fw_cfg, "etc/pvpanic-port", pvpanic_port, sizeof(*pvpanic_port)); - isa_register_ioport(d, &s->io, s->ioport); + isa_register_ioport(d, &s->mr, s->ioport); } static Property pvpanic_isa_properties[] = { From patchwork Thu Oct 18 13:04:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 10647151 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9CBDF109C for ; Thu, 18 Oct 2018 13:08:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C31828909 for ; Thu, 18 Oct 2018 13:08:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88E4D28944; Thu, 18 Oct 2018 13:08:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 66F12289F3 for ; Thu, 18 Oct 2018 13:08:58 +0000 (UTC) Received: from localhost ([::1]:42337 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gD82r-0001kl-Fi for patchwork-qemu-devel@patchwork.kernel.org; Thu, 18 Oct 2018 09:08:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39280) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gD7z3-0006qv-L5 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 09:05:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gD7yy-0003Jx-Td for qemu-devel@nongnu.org; Thu, 18 Oct 2018 09:05:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64507) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gD7yy-0003Gv-Kf for qemu-devel@nongnu.org; Thu, 18 Oct 2018 09:04:56 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DD9B03D97F; Thu, 18 Oct 2018 13:04:55 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.158]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AA0851042557; Thu, 18 Oct 2018 13:04:53 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peng Hao Date: Thu, 18 Oct 2018 15:04:33 +0200 Message-Id: <20181018130434.23237-4-philmd@redhat.com> In-Reply-To: <20181018130434.23237-1-philmd@redhat.com> References: <20181018130434.23237-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 18 Oct 2018 13:04:56 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 3/4] hw/misc/pvpanic: Add the MMIO interface X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , qemu-devel@nongnu.org, Wen Congyang , Hu Tao Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Peng Hao Signed-off-by: Philippe Mathieu-Daudé [PMD: Use TYPE_PVPANIC definition, split in 2 patches] --- Peng: I hope this is now more obvious how you could reuse the pvpanic device. hw/misc/pvpanic.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c index 4f552e1533..b81c5fa633 100644 --- a/hw/misc/pvpanic.c +++ b/hw/misc/pvpanic.c @@ -2,10 +2,12 @@ * QEMU simulated pvpanic device. * * Copyright Fujitsu, Corp. 2013 + * Copyright (c) 2018 ZTE Ltd. * * Authors: * Wen Congyang * Hu Tao + * Peng Hao * * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. @@ -47,7 +49,10 @@ static void handle_event(int event) typedef struct PVPanicState { /*< private >*/ - ISADevice isadev; + union { + ISADevice isadev; + SysBusDevice busdev; + }; /*< public >*/ MemoryRegion mr; @@ -123,9 +128,54 @@ static TypeInfo pvpanic_isa_info = { .class_init = pvpanic_isa_class_init, }; +static uint64_t pvpanic_mmio_read(void *opaque, hwaddr addr, unsigned size) +{ + return -1; +} + +static void pvpanic_mmio_write(void *opaque, hwaddr addr, uint64_t value, + unsigned size) +{ + handle_event(value); +} + +static const MemoryRegionOps pvpanic_mmio_ops = { + .read = pvpanic_mmio_read, + .write = pvpanic_mmio_write, + .impl = { + .max_access_size = 1, + }, +}; + +static void pvpanic_mmio_initfn(Object *obj) +{ + PVPanicState *s = PVPANIC(obj); + SysBusDevice *sbd = SYS_BUS_DEVICE(obj); + + memory_region_init_io(&s->mr, OBJECT(s), &pvpanic_mmio_ops, s, + TYPE_PVPANIC, 2); + sysbus_init_mmio(sbd, &s->mr); +} + +static void pvpanic_mmio_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + set_bit(DEVICE_CATEGORY_MISC, dc->categories); +} + +static TypeInfo pvpanic_mmio_info = { + .name = TYPE_PVPANIC, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(PVPanicState), + .instance_init = pvpanic_mmio_initfn, + .class_init = pvpanic_mmio_class_init, +}; + static void pvpanic_register_types(void) { type_register_static(&pvpanic_isa_info); + type_register_static(&pvpanic_mmio_info); } type_init(pvpanic_register_types) From patchwork Thu Oct 18 13:04:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 10647177 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0694515E2 for ; Thu, 18 Oct 2018 13:11:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB191288C6 for ; Thu, 18 Oct 2018 13:11:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA7B9288DB; Thu, 18 Oct 2018 13:11:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7791E288C6 for ; Thu, 18 Oct 2018 13:11:18 +0000 (UTC) Received: from localhost ([::1]:42357 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gD857-0003fj-Oq for patchwork-qemu-devel@patchwork.kernel.org; Thu, 18 Oct 2018 09:11:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gD7zH-00071K-Ax for qemu-devel@nongnu.org; Thu, 18 Oct 2018 09:05:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gD7z9-0003h3-Os for qemu-devel@nongnu.org; Thu, 18 Oct 2018 09:05:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58944) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gD7z1-0003S9-Ry; Thu, 18 Oct 2018 09:05:00 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1371A88E55; Thu, 18 Oct 2018 13:04:59 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.158]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 54FCA10018F8; Thu, 18 Oct 2018 13:04:56 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peng Hao Date: Thu, 18 Oct 2018 15:04:34 +0200 Message-Id: <20181018130434.23237-5-philmd@redhat.com> In-Reply-To: <20181018130434.23237-1-philmd@redhat.com> References: <20181018130434.23237-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 18 Oct 2018 13:04:59 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 4/4] hw/arm/virt: Use the pvpanic device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Wen Congyang , Hu Tao , qemu-devel@nongnu.org, "open list:ARM" , =?utf-8?q?Phi?= =?utf-8?q?lippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Peng Hao Signed-off-by: Philippe Mathieu-Daudé [PMD: Use TYPE_PVPANIC definition, split in 2 patches] --- default-configs/arm-softmmu.mak | 2 +- hw/arm/virt.c | 21 +++++++++++++++++++++ include/hw/arm/virt.h | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak index 2420491aac..def07fa095 100644 --- a/default-configs/arm-softmmu.mak +++ b/default-configs/arm-softmmu.mak @@ -43,7 +43,7 @@ CONFIG_USB_MUSB=y CONFIG_USB_EHCI_SYSBUS=y CONFIG_PLATFORM_BUS=y CONFIG_VIRTIO_MMIO=y - +CONFIG_PVPANIC=y CONFIG_ARM11MPCORE=y CONFIG_A9MPCORE=y CONFIG_A15MPCORE=y diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 9f677825f9..40469e6785 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -59,6 +59,7 @@ #include "qapi/visitor.h" #include "standard-headers/linux/input.h" #include "hw/arm/smmuv3.h" +#include "hw/misc/pvpanic.h" #define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \ static void virt_##major##_##minor##_class_init(ObjectClass *oc, \ @@ -140,6 +141,7 @@ static const MemMapEntry a15memmap[] = { [VIRT_UART] = { 0x09000000, 0x00001000 }, [VIRT_RTC] = { 0x09010000, 0x00001000 }, [VIRT_FW_CFG] = { 0x09020000, 0x00000018 }, + [VIRT_PVPANIC_MMIO] = { 0x09020018, 0x00000002 }, [VIRT_GPIO] = { 0x09030000, 0x00001000 }, [VIRT_SECURE_UART] = { 0x09040000, 0x00001000 }, [VIRT_SMMU] = { 0x09050000, 0x00020000 }, @@ -802,6 +804,23 @@ static void create_gpio(const VirtMachineState *vms, qemu_irq *pic) g_free(nodename); } +static void create_pvpanic_device(const VirtMachineState *vms) +{ + char *nodename; + hwaddr base = vms->memmap[VIRT_PVPANIC_MMIO].base; + hwaddr size = vms->memmap[VIRT_PVPANIC_MMIO].size; + + sysbus_create_simple(TYPE_PVPANIC, base, NULL); + + nodename = g_strdup_printf("/pvpanic-mmio@%" PRIx64, base); + qemu_fdt_add_subnode(vms->fdt, nodename); + qemu_fdt_setprop_string(vms->fdt, nodename, + "compatible", "pvpanic,mmio"); + qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg", + 2, base, 2, size); + g_free(nodename); +} + static void create_virtio_devices(const VirtMachineState *vms, qemu_irq *pic) { int i; @@ -1548,6 +1567,8 @@ static void machvirt_init(MachineState *machine) create_pcie(vms, pic); + create_pvpanic_device(vms); + create_gpio(vms, pic); /* Create mmio transports, so the user can create virtio backends diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 4cc57a7ef6..61cc3109b2 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -70,6 +70,7 @@ enum { VIRT_MMIO, VIRT_RTC, VIRT_FW_CFG, + VIRT_PVPANIC_MMIO, VIRT_PCIE, VIRT_PCIE_MMIO, VIRT_PCIE_PIO,