From patchwork Mon Nov 26 19:55:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peng Hao X-Patchwork-Id: 10698057 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 ACFA917D5 for ; Mon, 26 Nov 2018 11:36:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AC972988F for ; Mon, 26 Nov 2018 11:36:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B9B7295E1; Mon, 26 Nov 2018 11:36:09 +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=-6.0 required=2.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, 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 14FFC295E1 for ; Mon, 26 Nov 2018 11:36:08 +0000 (UTC) Received: from localhost ([::1]:35285 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRFBP-0002V7-Fy for patchwork-qemu-devel@patchwork.kernel.org; Mon, 26 Nov 2018 06:36:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRF8f-0000Gt-Lf for qemu-devel@nongnu.org; Mon, 26 Nov 2018 06:33:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRF8d-0001xd-Uh for qemu-devel@nongnu.org; Mon, 26 Nov 2018 06:33:17 -0500 Received: from mxhk.zte.com.cn ([63.217.80.70]:30190) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRF8U-0001lQ-4V; Mon, 26 Nov 2018 06:33:06 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id DAD8F7662A6CD862AC6D; Mon, 26 Nov 2018 19:32:58 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id wAQBWrcc031645; Mon, 26 Nov 2018 19:32:53 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018112619330091-13057763 ; Mon, 26 Nov 2018 19:33:00 +0800 From: Peng Hao To: peter.maydell@linaro.org, drjones@redhat.com, philmd@redhat.com Date: Tue, 27 Nov 2018 03:55:54 +0800 Message-Id: <1543262162-6351-2-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1543262162-6351-1-git-send-email-peng.hao2@zte.com.cn> References: <1543262162-6351-1-git-send-email-peng.hao2@zte.com.cn> MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-11-26 19:33:00, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-11-26 19:32:52 X-MAIL: mse01.zte.com.cn wAQBWrcc031645 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 63.217.80.70 Subject: [Qemu-devel] [PATCH V9 1/9] 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: Peng Hao , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Philippe Mathieu-Daudé The 'pvpanic' ISA device can be use by any machine with an ISA bus. Reviewed-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Peng Hao --- 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 680350b..c387ce4 100644 --- a/hw/misc/Makefile.objs +++ b/hw/misc/Makefile.objs @@ -8,6 +8,7 @@ common-obj-$(CONFIG_ISA_TESTDEV) += pc-testdev.o common-obj-$(CONFIG_PCI_TESTDEV) += pci-testdev.o common-obj-$(CONFIG_EDU) += edu.o common-obj-$(CONFIG_PCA9552) += pca9552.o +common-obj-$(CONFIG_PVPANIC) += pvpanic.o common-obj-y += unimp.o common-obj-$(CONFIG_FW_CFG_DMA) += vmcoreinfo.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_AUX) += auxbus.o obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o aspeed_sdmc.o obj-$(CONFIG_MSF2) += msf2-sysreg.o From patchwork Mon Nov 26 19:55:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peng Hao X-Patchwork-Id: 10698051 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 DB14F109C for ; Mon, 26 Nov 2018 11:35:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA65F295E1 for ; Mon, 26 Nov 2018 11:35:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDE63298B1; Mon, 26 Nov 2018 11:35:15 +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=-6.0 required=2.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, 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 B64372988F for ; Mon, 26 Nov 2018 11:35:14 +0000 (UTC) Received: from localhost ([::1]:35280 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRFAW-0001jg-M1 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 26 Nov 2018 06:35:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56842) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRF8f-0000GH-3F for qemu-devel@nongnu.org; Mon, 26 Nov 2018 06:33:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRF8d-0001xe-UX for qemu-devel@nongnu.org; Mon, 26 Nov 2018 06:33:17 -0500 Received: from out1.zte.com.cn ([202.103.147.172]:56364 helo=mxct.zte.com.cn) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRF8W-0001mh-DN; Mon, 26 Nov 2018 06:33:08 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id E524A28D3E9689AFD846; Mon, 26 Nov 2018 19:33:00 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id wAQBWsqQ031648; Mon, 26 Nov 2018 19:32:54 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018112619330227-13057766 ; Mon, 26 Nov 2018 19:33:02 +0800 From: Peng Hao To: peter.maydell@linaro.org, drjones@redhat.com, philmd@redhat.com Date: Tue, 27 Nov 2018 03:55:55 +0800 Message-Id: <1543262162-6351-3-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1543262162-6351-1-git-send-email-peng.hao2@zte.com.cn> References: <1543262162-6351-1-git-send-email-peng.hao2@zte.com.cn> MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-11-26 19:33:02, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-11-26 19:32:54 X-MAIL: mse01.zte.com.cn wAQBWsqQ031648 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 202.103.147.172 Subject: [Qemu-devel] [PATCH V9 2/9] 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: Peng Hao , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Philippe Mathieu-Daudé To ease the MMIO device addition in the next patch, rename: - ISA_PVPANIC_DEVICE -> PVPANIC_ISA_DEVICE. - MemoryRegion io -> mr. Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Peng Hao --- hw/misc/pvpanic.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c index 9d8961b..0f23a67 100644 --- a/hw/misc/pvpanic.c +++ b/hw/misc/pvpanic.c @@ -25,8 +25,8 @@ /* The pv event value */ #define PVPANIC_PANICKED (1 << PVPANIC_F_PANICKED) -#define ISA_PVPANIC_DEVICE(obj) \ - OBJECT_CHECK(PVPanicState, (obj), TYPE_PVPANIC) +#define PVPANIC_ISA_DEVICE(obj) \ + OBJECT_CHECK(PVPanicISAState, (obj), TYPE_PVPANIC) static void handle_event(int event) { @@ -45,12 +45,16 @@ static void handle_event(int event) #include "hw/isa/isa.h" -typedef struct PVPanicState { +/* PVPanicISAState for ISA device and + * use ioport. + */ +typedef struct PVPanicISAState { ISADevice parent_obj; - - MemoryRegion io; + /*< private>*/ uint16_t ioport; -} PVPanicState; + /**/ + MemoryRegion mr; +} PVPanicISAState; /* return supported events on read */ static uint64_t pvpanic_ioport_read(void *opaque, hwaddr addr, unsigned size) @@ -75,15 +79,15 @@ static const MemoryRegionOps pvpanic_ops = { static void pvpanic_isa_initfn(Object *obj) { - PVPanicState *s = ISA_PVPANIC_DEVICE(obj); + PVPanicISAState *s = PVPANIC_ISA_DEVICE(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); + PVPanicISAState *s = PVPANIC_ISA_DEVICE(dev); FWCfgState *fw_cfg = fw_cfg_find(); uint16_t *pvpanic_port; @@ -96,11 +100,11 @@ 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[] = { - DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicState, ioport, 0x505), + DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicISAState, ioport, 0x505), DEFINE_PROP_END_OF_LIST(), }; @@ -116,7 +120,7 @@ static void pvpanic_isa_class_init(ObjectClass *klass, void *data) static TypeInfo pvpanic_isa_info = { .name = TYPE_PVPANIC, .parent = TYPE_ISA_DEVICE, - .instance_size = sizeof(PVPanicState), + .instance_size = sizeof(PVPanicISAState), .instance_init = pvpanic_isa_initfn, .class_init = pvpanic_isa_class_init, }; From patchwork Mon Nov 26 19:55:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Hao X-Patchwork-Id: 10698059 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 066D017D5 for ; Mon, 26 Nov 2018 11:37:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBC15298FB for ; Mon, 26 Nov 2018 11:37:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF7B329955; Mon, 26 Nov 2018 11:37:56 +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=-6.0 required=2.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, 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 58CF72992F for ; Mon, 26 Nov 2018 11:37:56 +0000 (UTC) Received: from localhost ([::1]:35295 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRFD9-0003yb-Ix for patchwork-qemu-devel@patchwork.kernel.org; Mon, 26 Nov 2018 06:37:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRF8g-0000I5-KI for qemu-devel@nongnu.org; Mon, 26 Nov 2018 06:33:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRF8d-0001xb-Un for qemu-devel@nongnu.org; Mon, 26 Nov 2018 06:33:18 -0500 Received: from out1.zte.com.cn ([202.103.147.172]:56444 helo=mxct.zte.com.cn) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRF8U-0001pH-Gm; Mon, 26 Nov 2018 06:33:08 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 87A554590BFC74BD5CA6; Mon, 26 Nov 2018 19:33:04 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id wAQBWu0H031666; Mon, 26 Nov 2018 19:32:56 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018112619330377-13057778 ; Mon, 26 Nov 2018 19:33:03 +0800 From: Peng Hao To: peter.maydell@linaro.org, drjones@redhat.com, philmd@redhat.com Date: Tue, 27 Nov 2018 03:55:56 +0800 Message-Id: <1543262162-6351-4-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1543262162-6351-1-git-send-email-peng.hao2@zte.com.cn> References: <1543262162-6351-1-git-send-email-peng.hao2@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-11-26 19:33:03, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-11-26 19:32:55, Serialize complete at 2018-11-26 19:32:55 X-MAIL: mse01.zte.com.cn wAQBWu0H031666 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 202.103.147.172 Subject: [Qemu-devel] [PATCH V9 3/9] 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: Peng Hao , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add pvpanic new type "TYPE_PVPANIC_MMIO" Signed-off-by: Peng Hao --- hw/misc/pvpanic.c | 50 +++++++++++++++++++++++++++++++++++++++++++---- include/hw/misc/pvpanic.h | 1 + 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c index 0f23a67..c9382a8 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. @@ -28,6 +30,9 @@ #define PVPANIC_ISA_DEVICE(obj) \ OBJECT_CHECK(PVPanicISAState, (obj), TYPE_PVPANIC) +#define PVPANIC_MMIO_DEVICE(obj) \ + OBJECT_CHECK(PVPanicMMIOState, (obj), TYPE_PVPANIC_MMIO) + static void handle_event(int event) { static bool logged; @@ -56,21 +61,32 @@ typedef struct PVPanicISAState { MemoryRegion mr; } PVPanicISAState; +/* PVPanicMMIOState for sysbus device and + * use mmio. + */ +typedef struct PVPanicMMIOState { + SysBusDevice parent_obj; + /**/ + + /* public */ + MemoryRegion mr; +} PVPanicMMIOState; + /* return supported events on read */ -static uint64_t pvpanic_ioport_read(void *opaque, hwaddr addr, unsigned size) +static uint64_t pvpanic_read(void *opaque, hwaddr addr, unsigned size) { return PVPANIC_PANICKED; } -static void pvpanic_ioport_write(void *opaque, hwaddr addr, uint64_t val, +static void pvpanic_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { handle_event(val); } static const MemoryRegionOps pvpanic_ops = { - .read = pvpanic_ioport_read, - .write = pvpanic_ioport_write, + .read = pvpanic_read, + .write = pvpanic_write, .impl = { .min_access_size = 1, .max_access_size = 1, @@ -125,9 +141,35 @@ static TypeInfo pvpanic_isa_info = { .class_init = pvpanic_isa_class_init, }; +static void pvpanic_mmio_initfn(Object *obj) +{ + PVPanicMMIOState *s = PVPANIC_MMIO_DEVICE(obj); + SysBusDevice *sbd = SYS_BUS_DEVICE(obj); + + memory_region_init_io(&s->mr, OBJECT(s), &pvpanic_ops, s, + TYPE_PVPANIC_MMIO, 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_MMIO, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(PVPanicMMIOState), + .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) diff --git a/include/hw/misc/pvpanic.h b/include/hw/misc/pvpanic.h index 1ee071a..f1a05b2 100644 --- a/include/hw/misc/pvpanic.h +++ b/include/hw/misc/pvpanic.h @@ -15,6 +15,7 @@ #define HW_MISC_PVPANIC_H #define TYPE_PVPANIC "pvpanic" +#define TYPE_PVPANIC_MMIO "pvpanic-mmio" #define PVPANIC_IOPORT_PROP "ioport" From patchwork Mon Nov 26 19:55:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Hao X-Patchwork-Id: 10698053 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 935AE109C for ; Mon, 26 Nov 2018 11:35:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83DCC295E1 for ; Mon, 26 Nov 2018 11:35:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 77FAC298B1; Mon, 26 Nov 2018 11:35:17 +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=-6.0 required=2.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, 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 59246295E1 for ; Mon, 26 Nov 2018 11:35:16 +0000 (UTC) Received: from localhost ([::1]:35282 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRFAZ-0001mD-7h for patchwork-qemu-devel@patchwork.kernel.org; Mon, 26 Nov 2018 06:35:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRF8f-0000GR-5y for qemu-devel@nongnu.org; Mon, 26 Nov 2018 06:33:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRF8d-0001xj-Ur for qemu-devel@nongnu.org; Mon, 26 Nov 2018 06:33:17 -0500 Received: from out1.zte.com.cn ([202.103.147.172]:56460 helo=mxct.zte.com.cn) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRF8W-0001pd-EW; Mon, 26 Nov 2018 06:33:08 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 3A5A2772E8E9E8E46DAA; Mon, 26 Nov 2018 19:33:05 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id wAQBWv84031717; Mon, 26 Nov 2018 19:32:57 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018112619330544-13057780 ; Mon, 26 Nov 2018 19:33:05 +0800 From: Peng Hao To: peter.maydell@linaro.org, drjones@redhat.com, philmd@redhat.com Date: Tue, 27 Nov 2018 03:55:57 +0800 Message-Id: <1543262162-6351-5-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1543262162-6351-1-git-send-email-peng.hao2@zte.com.cn> References: <1543262162-6351-1-git-send-email-peng.hao2@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-11-26 19:33:05, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-11-26 19:32:57, Serialize complete at 2018-11-26 19:32:57 X-MAIL: mse01.zte.com.cn wAQBWv84031717 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 202.103.147.172 Subject: [Qemu-devel] [PATCH V9 4/9] 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: Peng Hao , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add pvpanic device in arm virt machine. Signed-off-by: Peng Hao --- default-configs/arm-softmmu.mak | 1 + hw/arm/virt.c | 21 +++++++++++++++++++++ include/hw/arm/virt.h | 1 + 3 files changed, 23 insertions(+) diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak index 2420491..50345df 100644 --- a/default-configs/arm-softmmu.mak +++ b/default-configs/arm-softmmu.mak @@ -159,3 +159,4 @@ CONFIG_PCI_DESIGNWARE=y CONFIG_STRONGARM=y CONFIG_HIGHBANK=y CONFIG_MUSICPAL=y +CONFIG_PVPANIC=y diff --git a/hw/arm/virt.c b/hw/arm/virt.c index a2b8d8f..f2cb5de 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -143,6 +143,7 @@ static const MemMapEntry a15memmap[] = { [VIRT_GPIO] = { 0x09030000, 0x00001000 }, [VIRT_SECURE_UART] = { 0x09040000, 0x00001000 }, [VIRT_SMMU] = { 0x09050000, 0x00020000 }, + [VIRT_PVPANIC] = { 0x09070000, 0x00000002 }, [VIRT_MMIO] = { 0x0a000000, 0x00000200 }, /* ...repeating for a total of NUM_VIRTIO_TRANSPORTS, each of that size */ [VIRT_PLATFORM_BUS] = { 0x0c000000, 0x02000000 }, @@ -190,6 +191,24 @@ static bool cpu_type_valid(const char *cpu) return false; } +static void create_pvpanic_device(const VirtMachineState *vms) +{ + char *nodename; + hwaddr base = vms->memmap[VIRT_PVPANIC].base; + hwaddr size = vms->memmap[VIRT_PVPANIC].size; + + sysbus_create_simple(TYPE_PVPANIC_MMIO, 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", "qemu,pvpanic-mmio"); + qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg", + 2, base, 2, size); + + g_free(nodename); +} + static void create_fdt(VirtMachineState *vms) { void *fdt = create_device_tree(&vms->fdt_size); @@ -1531,6 +1550,8 @@ static void machvirt_init(MachineState *machine) create_flash(vms, sysmem, secure_sysmem ? secure_sysmem : sysmem); + create_pvpanic_device(vms); + create_gic(vms, pic); fdt_add_pmu_nodes(vms); diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 4cc57a7..937c124 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -66,6 +66,7 @@ enum { VIRT_GIC_REDIST, VIRT_GIC_REDIST2, VIRT_SMMU, + VIRT_PVPANIC, VIRT_UART, VIRT_MMIO, VIRT_RTC, From patchwork Mon Nov 26 19:55:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Hao X-Patchwork-Id: 10698065 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 3182516B1 for ; Mon, 26 Nov 2018 11:40:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23B83290D9 for ; Mon, 26 Nov 2018 11:40:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1806C2992E; Mon, 26 Nov 2018 11:40: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=-6.0 required=2.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, 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 B5F4B29955 for ; Mon, 26 Nov 2018 11:39:59 +0000 (UTC) Received: from localhost ([::1]:35305 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRFF9-0006Au-1M for patchwork-qemu-devel@patchwork.kernel.org; Mon, 26 Nov 2018 06:39:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRF8k-0000Na-Mq for qemu-devel@nongnu.org; Mon, 26 Nov 2018 06:33:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRF8d-0001xU-Ua for qemu-devel@nongnu.org; Mon, 26 Nov 2018 06:33:22 -0500 Received: from out1.zte.com.cn ([202.103.147.172]:56492 helo=mxct.zte.com.cn) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRF8X-0001r5-6M; Mon, 26 Nov 2018 06:33:10 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id D0658966ECBEAC5DD497; Mon, 26 Nov 2018 19:33:06 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id wAQBWwhr031733; Mon, 26 Nov 2018 19:32:58 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018112619330653-13057781 ; Mon, 26 Nov 2018 19:33:06 +0800 From: Peng Hao To: peter.maydell@linaro.org, drjones@redhat.com, philmd@redhat.com Date: Tue, 27 Nov 2018 03:55:58 +0800 Message-Id: <1543262162-6351-6-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1543262162-6351-1-git-send-email-peng.hao2@zte.com.cn> References: <1543262162-6351-1-git-send-email-peng.hao2@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-11-26 19:33:06, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-11-26 19:32:58, Serialize complete at 2018-11-26 19:32:58 X-MAIL: mse01.zte.com.cn wAQBWwhr031733 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 202.103.147.172 Subject: [Qemu-devel] [PATCH V9 5/9] hw/arm/virt: add pvpanic device in virt acpi table 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: Peng Hao , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add pvpanic device in virt acpi table, so when kenrel command line uses acpi=force, kernel can get info from acpi table. Signed-off-by: Peng Hao --- hw/arm/virt-acpi-build.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 5785fb6..2adba60 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -84,6 +84,20 @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap, aml_append(scope, dev); } +static void acpi_dsdt_add_pvpanic(Aml *scope, const MemMapEntry *pvpanic_memmap) +{ + Aml *dev = aml_device("PEVT"); + aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0001"))); + aml_append(dev, aml_name_decl("_UID", aml_int(0))); + + Aml *crs = aml_resource_template(); + aml_append(crs, aml_memory32_fixed(pvpanic_memmap->base, + pvpanic_memmap->size, AML_READ_WRITE)); + + aml_append(dev, aml_name_decl("_CRS", crs)); + aml_append(scope, dev); +} + static void acpi_dsdt_add_fw_cfg(Aml *scope, const MemMapEntry *fw_cfg_memmap) { Aml *dev = aml_device("FWCF"); @@ -771,6 +785,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) acpi_dsdt_add_uart(scope, &memmap[VIRT_UART], (irqmap[VIRT_UART] + ARM_SPI_BASE)); acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH]); + acpi_dsdt_add_pvpanic(scope, &memmap[VIRT_PVPANIC]); acpi_dsdt_add_fw_cfg(scope, &memmap[VIRT_FW_CFG]); acpi_dsdt_add_virtio(scope, &memmap[VIRT_MMIO], (irqmap[VIRT_MMIO] + ARM_SPI_BASE), NUM_VIRTIO_TRANSPORTS); From patchwork Mon Nov 26 19:55:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Hao X-Patchwork-Id: 10698063 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 256CB1803 for ; Mon, 26 Nov 2018 11:39:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08FB029914 for ; Mon, 26 Nov 2018 11:39:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F19B52991F; Mon, 26 Nov 2018 11:39:56 +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=-6.0 required=2.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, 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 89ADF2992F for ; Mon, 26 Nov 2018 11:39:56 +0000 (UTC) Received: from localhost ([::1]:35304 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRFEu-00060e-KU for patchwork-qemu-devel@patchwork.kernel.org; Mon, 26 Nov 2018 06:39:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56884) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRF8h-0000Jj-Sj for qemu-devel@nongnu.org; Mon, 26 Nov 2018 06:33:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRF8f-0001yw-7K for qemu-devel@nongnu.org; Mon, 26 Nov 2018 06:33:19 -0500 Received: from out1.zte.com.cn ([202.103.147.172]:56510 helo=mxct.zte.com.cn) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRF8Y-0001rI-Ch; Mon, 26 Nov 2018 06:33:12 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 848B752AAF40B43A8EEF; Mon, 26 Nov 2018 19:33:07 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id wAQBWxng031734; Mon, 26 Nov 2018 19:33:00 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018112619330760-13057785 ; Mon, 26 Nov 2018 19:33:07 +0800 From: Peng Hao To: peter.maydell@linaro.org, drjones@redhat.com, philmd@redhat.com Date: Tue, 27 Nov 2018 03:55:59 +0800 Message-Id: <1543262162-6351-7-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1543262162-6351-1-git-send-email-peng.hao2@zte.com.cn> References: <1543262162-6351-1-git-send-email-peng.hao2@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-11-26 19:33:07, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-11-26 19:32:59, Serialize complete at 2018-11-26 19:32:59 X-MAIL: mse01.zte.com.cn wAQBWxng031734 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 202.103.147.172 Subject: [Qemu-devel] [PATCH V9 6/9] hw/misc/pvpanic: add configure query 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: Peng Hao , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add configure query interface for pvpanic-mmio. Signed-off-by: Peng Hao --- include/hw/misc/pvpanic.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/hw/misc/pvpanic.h b/include/hw/misc/pvpanic.h index f1a05b2..2f0e9f4 100644 --- a/include/hw/misc/pvpanic.h +++ b/include/hw/misc/pvpanic.h @@ -28,4 +28,9 @@ static inline uint16_t pvpanic_port(void) return object_property_get_uint(o, PVPANIC_IOPORT_PROP, NULL); } +static inline Object *pvpanic_mmio(void) +{ + return object_resolve_path_type("", TYPE_PVPANIC_MMIO, NULL); +} + #endif From patchwork Mon Nov 26 19:56:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Hao X-Patchwork-Id: 10698061 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 B0FB417D5 for ; Mon, 26 Nov 2018 11:38:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2098298DF for ; Mon, 26 Nov 2018 11:38:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95DBB2992D; Mon, 26 Nov 2018 11:38:08 +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=-6.0 required=2.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, 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 3ACDC298DF for ; Mon, 26 Nov 2018 11:38:08 +0000 (UTC) Received: from localhost ([::1]:35296 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRFDL-0004E3-Dq for patchwork-qemu-devel@patchwork.kernel.org; Mon, 26 Nov 2018 06:38:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRF8k-0000NZ-Mi for qemu-devel@nongnu.org; Mon, 26 Nov 2018 06:33:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRF8g-000205-Pa for qemu-devel@nongnu.org; Mon, 26 Nov 2018 06:33:22 -0500 Received: from mxhk.zte.com.cn ([63.217.80.70]:39722) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRF8Y-0001ro-Ds; Mon, 26 Nov 2018 06:33:12 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 3B39AD33C8E1A9C43870; Mon, 26 Nov 2018 19:33:08 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id wAQBX1Vl031808; Mon, 26 Nov 2018 19:33:01 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018112619330892-13057786 ; Mon, 26 Nov 2018 19:33:08 +0800 From: Peng Hao To: peter.maydell@linaro.org, drjones@redhat.com, philmd@redhat.com Date: Tue, 27 Nov 2018 03:56:00 +0800 Message-Id: <1543262162-6351-8-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1543262162-6351-1-git-send-email-peng.hao2@zte.com.cn> References: <1543262162-6351-1-git-send-email-peng.hao2@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-11-26 19:33:08, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-11-26 19:33:00, Serialize complete at 2018-11-26 19:33:00 X-MAIL: mse01.zte.com.cn wAQBX1Vl031808 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 63.217.80.70 Subject: [Qemu-devel] [PATCH V9 7/9] hw/misc/pvpanic: preparing for adding configure 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: Peng Hao , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Prepare for pvpanic-mmio configure interface. Signed-off-by: Peng Hao --- hw/arm/sysbus-fdt.c | 2 ++ hw/arm/virt.c | 1 + hw/misc/pvpanic.c | 10 +++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/hw/arm/sysbus-fdt.c b/hw/arm/sysbus-fdt.c index ad698d4..34577f3 100644 --- a/hw/arm/sysbus-fdt.c +++ b/hw/arm/sysbus-fdt.c @@ -38,6 +38,7 @@ #include "hw/vfio/vfio-amd-xgbe.h" #include "hw/display/ramfb.h" #include "hw/arm/fdt.h" +#include "hw/misc/pvpanic.h" /* * internal struct that contains the information to create dynamic @@ -459,6 +460,7 @@ static const BindingEntry bindings[] = { VFIO_PLATFORM_BINDING("amd,xgbe-seattle-v1a", add_amd_xgbe_fdt_node), #endif TYPE_BINDING(TYPE_RAMFB_DEVICE, no_fdt_node), + TYPE_BINDING(TYPE_PVPANIC_MMIO, no_fdt_node), TYPE_BINDING("", NULL), /* last element */ }; diff --git a/hw/arm/virt.c b/hw/arm/virt.c index f2cb5de..bb756a6 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1783,6 +1783,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_CALXEDA_XGMAC); machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_AMD_XGBE); machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE); + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PVPANIC_MMIO); machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_PLATFORM); mc->block_default_type = IF_VIRTIO; mc->no_cdrom = 1; diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c index c9382a8..08263ed 100644 --- a/hw/misc/pvpanic.c +++ b/hw/misc/pvpanic.c @@ -67,7 +67,7 @@ typedef struct PVPanicISAState { typedef struct PVPanicMMIOState { SysBusDevice parent_obj; /**/ - + uint32_t base; /* public */ MemoryRegion mr; } PVPanicMMIOState; @@ -151,10 +151,18 @@ static void pvpanic_mmio_initfn(Object *obj) sysbus_init_mmio(sbd, &s->mr); } +static Property pvpanic_mmio_properties[] = { + DEFINE_PROP_UINT32("mmio", PVPanicMMIOState, base, 0x09070000), + DEFINE_PROP_END_OF_LIST(), +}; + + static void pvpanic_mmio_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + dc->user_creatable = true; + dc->props = pvpanic_mmio_properties; set_bit(DEVICE_CATEGORY_MISC, dc->categories); } From patchwork Mon Nov 26 19:56:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Hao X-Patchwork-Id: 10698067 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 6263313BB for ; Mon, 26 Nov 2018 11:41:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52A6E29982 for ; Mon, 26 Nov 2018 11:41:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BB82299E3; Mon, 26 Nov 2018 11:41:30 +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=-6.0 required=2.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, 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 BE2AB29982 for ; Mon, 26 Nov 2018 11:41:29 +0000 (UTC) Received: from localhost ([::1]:35315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRFGa-0007M7-BH for patchwork-qemu-devel@patchwork.kernel.org; Mon, 26 Nov 2018 06:41:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRF8p-0000UC-ID for qemu-devel@nongnu.org; Mon, 26 Nov 2018 06:33:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRF8m-00023G-DE for qemu-devel@nongnu.org; Mon, 26 Nov 2018 06:33:27 -0500 Received: from mxhk.zte.com.cn ([63.217.80.70]:51844) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRF8c-0001sk-1Y; Mon, 26 Nov 2018 06:33:14 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id BF8A77ACFB77BA1B9DC7; Mon, 26 Nov 2018 19:33:09 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id wAQBX23j031826; Mon, 26 Nov 2018 19:33:02 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018112619330992-13057794 ; Mon, 26 Nov 2018 19:33:09 +0800 From: Peng Hao To: peter.maydell@linaro.org, drjones@redhat.com, philmd@redhat.com Date: Tue, 27 Nov 2018 03:56:01 +0800 Message-Id: <1543262162-6351-9-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1543262162-6351-1-git-send-email-peng.hao2@zte.com.cn> References: <1543262162-6351-1-git-send-email-peng.hao2@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-11-26 19:33:10, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-11-26 19:33:01, Serialize complete at 2018-11-26 19:33:01 X-MAIL: mse01.zte.com.cn wAQBX23j031826 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 63.217.80.70 Subject: [Qemu-devel] [PATCH V9 8/9] hw/misc/pvpanic: realize the configure 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: Peng Hao , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add configure interface for pvpanic-mmio. In qemu command line use -device pvpanic-mmio to enable the device. Signed-off-by: Peng Hao --- hw/arm/virt-acpi-build.c | 4 +++- hw/arm/virt.c | 9 ++++----- hw/misc/pvpanic.c | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 2adba60..50cea23 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -785,7 +785,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) acpi_dsdt_add_uart(scope, &memmap[VIRT_UART], (irqmap[VIRT_UART] + ARM_SPI_BASE)); acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH]); - acpi_dsdt_add_pvpanic(scope, &memmap[VIRT_PVPANIC]); + if (pvpanic_mmio()) { + acpi_dsdt_add_pvpanic(scope, &memmap[VIRT_PVPANIC]); + } acpi_dsdt_add_fw_cfg(scope, &memmap[VIRT_FW_CFG]); acpi_dsdt_add_virtio(scope, &memmap[VIRT_MMIO], (irqmap[VIRT_MMIO] + ARM_SPI_BASE), NUM_VIRTIO_TRANSPORTS); diff --git a/hw/arm/virt.c b/hw/arm/virt.c index bb756a6..fcaa597 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -197,8 +197,6 @@ static void create_pvpanic_device(const VirtMachineState *vms) hwaddr base = vms->memmap[VIRT_PVPANIC].base; hwaddr size = vms->memmap[VIRT_PVPANIC].size; - sysbus_create_simple(TYPE_PVPANIC_MMIO, base, NULL); - nodename = g_strdup_printf("/pvpanic-mmio@%" PRIx64, base); qemu_fdt_add_subnode(vms->fdt, nodename); qemu_fdt_setprop_string(vms->fdt, nodename, @@ -1329,6 +1327,9 @@ void virt_machine_done(Notifier *notifier, void *data) struct arm_boot_info *info = &vms->bootinfo; AddressSpace *as = arm_boot_address_space(cpu, info); + if (pvpanic_mmio()) { + create_pvpanic_device(vms); + } /* * If the user provided a dtb, we assume the dynamic sysbus nodes * already are integrated there. This corresponds to a use case where @@ -1548,9 +1549,7 @@ static void machvirt_init(MachineState *machine) machine->ram_size); memory_region_add_subregion(sysmem, vms->memmap[VIRT_MEM].base, ram); - create_flash(vms, sysmem, secure_sysmem ? secure_sysmem : sysmem); - - create_pvpanic_device(vms); + create_flash(vms, sysmem, secure_sysmem ? secure_sysmem : sysmem); create_gic(vms, pic); diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c index 08263ed..f199173 100644 --- a/hw/misc/pvpanic.c +++ b/hw/misc/pvpanic.c @@ -149,6 +149,7 @@ static void pvpanic_mmio_initfn(Object *obj) memory_region_init_io(&s->mr, OBJECT(s), &pvpanic_ops, s, TYPE_PVPANIC_MMIO, 2); sysbus_init_mmio(sbd, &s->mr); + sysbus_mmio_map(sbd, 0, s->base); } static Property pvpanic_mmio_properties[] = { From patchwork Mon Nov 26 19:56:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Hao X-Patchwork-Id: 10698069 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 D3C9A16B1 for ; Mon, 26 Nov 2018 11:41:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3B8F299C8 for ; Mon, 26 Nov 2018 11:41:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B855429982; Mon, 26 Nov 2018 11:41:38 +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=-6.0 required=2.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, 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 48E1C299C8 for ; Mon, 26 Nov 2018 11:41:38 +0000 (UTC) Received: from localhost ([::1]:35316 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRFGj-0007Sb-Dc for patchwork-qemu-devel@patchwork.kernel.org; Mon, 26 Nov 2018 06:41:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRF8o-0000Rp-2R for qemu-devel@nongnu.org; Mon, 26 Nov 2018 06:33:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRF8k-000225-Dv for qemu-devel@nongnu.org; Mon, 26 Nov 2018 06:33:24 -0500 Received: from out1.zte.com.cn ([202.103.147.172]:56582 helo=mxct.zte.com.cn) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRF8c-0001uW-Ah; Mon, 26 Nov 2018 06:33:14 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 1F7F48C353C489583040; Mon, 26 Nov 2018 19:33:12 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id wAQBX3fM031875; Mon, 26 Nov 2018 19:33:03 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018112619331147-13057804 ; Mon, 26 Nov 2018 19:33:11 +0800 From: Peng Hao To: peter.maydell@linaro.org, drjones@redhat.com, philmd@redhat.com Date: Tue, 27 Nov 2018 03:56:02 +0800 Message-Id: <1543262162-6351-10-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1543262162-6351-1-git-send-email-peng.hao2@zte.com.cn> References: <1543262162-6351-1-git-send-email-peng.hao2@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-11-26 19:33:11, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-11-26 19:33:03, Serialize complete at 2018-11-26 19:33:03 X-MAIL: mse01.zte.com.cn wAQBX3fM031875 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 202.103.147.172 Subject: [Qemu-devel] [PATCH V9 9/9] pvpanic : update pvpanic document 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: Peng Hao , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add mmio support info in docs/specs/pvpanic.txt. Signed-off-by: Peng Hao --- docs/specs/pvpanic.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/specs/pvpanic.txt b/docs/specs/pvpanic.txt index c7bbacc..67f5591 100644 --- a/docs/specs/pvpanic.txt +++ b/docs/specs/pvpanic.txt @@ -1,14 +1,18 @@ PVPANIC DEVICE ============== -pvpanic device is a simulated ISA device, through which a guest panic -event is sent to qemu, and a QMP event is generated. This allows +pvpanic device is a simulated ISA/SysBus device, through which a guest +panic event is sent to qemu, and a QMP event is generated. This allows management apps (e.g. libvirt) to be notified and respond to the event. The management app has the option of waiting for GUEST_PANICKED events, and/or polling for guest-panicked RunState, to learn when the pvpanic device has fired a panic event. +When pvpanic device is implemented as a ISA device, it supports IOPORT +mode. Since QEMU v3.2 pvpanic also supports MMIO mode, it will be +implemented as a SYSBUS device. + ISA Interface ------------- @@ -19,6 +23,13 @@ Software should set only bits both itself and the device recognize. Currently, only bit 0 is recognized, setting it indicates a guest panic has happened. +SYSBUS Interface +---------------- + +The SYSBUS interface is similar to the ISA interface except that it uses +MMIO. For example, the arm virt machine could put the pvpanic device at +[0x9070000, 0x9070001] and currently only the first byte is used. + ACPI Interface --------------