From patchwork Wed Jan 20 12:11:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Carabas X-Patchwork-Id: 1429162 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2020-01-29 header.b=oSylka8Y; dkim=pass (1024-bit key; unprotected) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-oracle-onmicrosoft-com header.b=spdCjx6m; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DLQkD2YG6z9sSs for ; Thu, 21 Jan 2021 00:05:40 +1100 (AEDT) Received: from localhost ([::1]:37782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l2DB3-0001v1-Ja for incoming@patchwork.ozlabs.org; Wed, 20 Jan 2021 08:05:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2D6n-0007S9-CG for qemu-devel@nongnu.org; Wed, 20 Jan 2021 08:01:13 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:46218) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2D6h-0002zC-J8 for qemu-devel@nongnu.org; Wed, 20 Jan 2021 08:01:13 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10KCxWaA191544; Wed, 20 Jan 2021 13:00:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2020-01-29; bh=Kp/O3xU8k/uWK2I5pmHkAImByeza11AbiTMPXo+7mBI=; b=oSylka8YwjTRKhz3bo49XfSRtY5/tvHik392NBv4EHgZhELFhSwZSRfAkgBZcvwULzRu 42TQfdDe9BZ6GpnpUwhyGK8Tbe1R/AEtZi8Y4idF1GLyF7NMYB6l9CBZZAO6z8Xrt5Xp KO2y3nwTXOGt+6hmZlfmLsfaJTHy1p4i+90BJiBh3JpAqRLkM6gGUCxyveEpOFwop3EB HodqbdbBTab3kFJodkxfr+Un90s5v6PJWPNWyqY+sqVQLTDr/QBhgsTCUJEFZQpBQ2dC MmC9DIRPhzj5oHXLUAtcgcaVRf20WdT0UmGqln4fj7GKlHhWrbrR/5umgNW7NfnCufBE yw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 3668qaab9b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jan 2021 13:00:58 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10KCZnKV099518; Wed, 20 Jan 2021 12:58:58 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2105.outbound.protection.outlook.com [104.47.70.105]) by aserp3020.oracle.com with ESMTP id 3668rdvpq4-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jan 2021 12:58:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oPqOxR2akg/7TX+gPBv3SBB/IdjcvaPSGxuuz++KGnyeYlXNGJkV2aiqbXoH+uMThwiLwo3qtoSFJXkDViWEPGTOfqFZsR46QzITIgo6ZYEykG5/8IWoH5M9AwxdwwQUPG52J9JkQ0lHNSPhLIQmNEkPwQpj/FF1khrumWHtBxzCaGMz8S/b7ZHUb1z+WYYJXEsUnbJcOQR+h0mAIPmpbhtZVM9tpfTmiUAjdqyp6QsYgW9mcTVBnV6FlybtuEMnftyMb7B6T2JJkHKqAQ7GZAtT95I1G9dbnFZImjLIA4Kzjkj3lLjypQZziFULP3kf6FIbYIB04sghWzsbrC6CgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Kp/O3xU8k/uWK2I5pmHkAImByeza11AbiTMPXo+7mBI=; b=X92LawJVMPWXUj8bzoV1/gXMLzK9h2DXQvknxcceRkZ3SYVS4p1do+7i9Vop1aAh9HG+2d1ukBXANAvaODfdvotoPahAse+p9tlZTJNDMrmkruf1PCE33w5F7AtCapAUwqvESpJ1LTfBxfNcJVqYFCVZoRWnBAvP+UHn8ggPKcSROzAN1nwkww3llc7+VtBMIOKPsUb84EE4xOpEbAOBnWeO287q1iZBszVqhkeff0sAi7Sy29uFSUDxMxbVR2JYPhDQNeBUCTZMQuGPprQKUVgZxtyyT6qtH+Q+dGamwPJuQt4dSFVdqhrWvUw7b6pH0fEHhVCuPQ6wNeovVrKqhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Kp/O3xU8k/uWK2I5pmHkAImByeza11AbiTMPXo+7mBI=; b=spdCjx6mCj9rh0+l2etDIHFzxekv6DensBsbHyjFYeIWUx7S1LG035ZjDfB1PTtxRMvG3soERRs/Y8uhNsvj3Qjc0A4vQwciuunPfa1N4afZqHoJr6OA4DBYwk2o4HyHtZpbRXYoltl/aQPkD3fOmoZBMTkX3KGHrMgH25tVOZU= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=oracle.com; Received: from MWHPR1001MB2285.namprd10.prod.outlook.com (2603:10b6:301:2e::32) by CO1PR10MB4739.namprd10.prod.outlook.com (2603:10b6:303:96::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Wed, 20 Jan 2021 12:58:56 +0000 Received: from MWHPR1001MB2285.namprd10.prod.outlook.com ([fe80::f48a:d4cb:d74c:48ba]) by MWHPR1001MB2285.namprd10.prod.outlook.com ([fe80::f48a:d4cb:d74c:48ba%6]) with mapi id 15.20.3742.014; Wed, 20 Jan 2021 12:58:56 +0000 From: Mihai Carabas To: qemu-devel@nongnu.org Subject: [PATCH v5 1/4] hw/misc/pvpanic: split-out generic and bus dependent code Date: Wed, 20 Jan 2021 14:11:50 +0200 Message-Id: <1611144713-21433-2-git-send-email-mihai.carabas@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1611144713-21433-1-git-send-email-mihai.carabas@oracle.com> References: <1611144713-21433-1-git-send-email-mihai.carabas@oracle.com> X-Originating-IP: [138.3.200.25] X-ClientProxiedBy: SA9PR10CA0026.namprd10.prod.outlook.com (2603:10b6:806:a7::31) To MWHPR1001MB2285.namprd10.prod.outlook.com (2603:10b6:301:2e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mihai.localdomain (138.3.200.25) by SA9PR10CA0026.namprd10.prod.outlook.com (2603:10b6:806:a7::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Wed, 20 Jan 2021 12:58:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 91ddaa63-1386-4771-df90-08d8bd4325a3 X-MS-TrafficTypeDiagnostic: CO1PR10MB4739: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:785; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ewn/HNTT+AaKWCPe8QHDYcydXuVcQhHgWBVNtKsMUJTX5gXz+KvQWpTUUcbblr+d61R9aW0S4FhBbm2lsLUQfh+A+SFpNh66Q6DweEaM1jOq7lsg6Y+XzoQLxdPCrJ7UulcYb0CZ4TC0+UeUKWSHeMW6TsvlrsWQtXcGHHooQowA2yL2sheFp9vUje0RG8qFqdH+iZmNvZ/nlThGCusfBS+/vakEomTvft6BCfQKHCz80GKlUd0XgLzFstbzRy4Aqkufz2ffNzNVEfqcWPiet8e9fltWQKOEbo8lF+uG1w7vU3iAOEmA2kZjc2tE8lXLu62K+9Ybry+46t0Np+TXZZWYlECUl52O1YbIFDIJbZCp0S+Dg0kmLsOwwRGq0f5JM6qMwBCSdGDWNHV9QE2eLn1HvAOwQsBOdnOv8f+4E2XpeqxGmR3FdI0qvEE1tuDJ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2285.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(346002)(366004)(376002)(136003)(39860400002)(396003)(6916009)(6666004)(52116002)(4326008)(2906002)(66946007)(30864003)(508600001)(66556008)(66476007)(5660300002)(36756003)(2616005)(86362001)(956004)(8936002)(316002)(6512007)(44832011)(107886003)(8676002)(6506007)(6486002)(83380400001)(186003)(26005)(16526019)(41533002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: JSiI9PD8duCSTgBO00CSxIZr8vdZAwgbzSmGByfIIYc7CNbYQLjnlheBMxVA+lsTxYNYe0iqxXxWetVY4trM110Q9+sfO16L0kSO+/GimHtRQxcdVEqvI4MHF21jDJQYzgvGny5nLWkpiS24CqBgixqSnElH8LBiFETX1jasrVYOOk/SIlDLBr5NwvjYiUp5QMbAavqlxlYJ6hoQiy/OU+fzbNMs5Q8tdEEtN3B+Gj5obkdRgVmgZTQO5mUVnq3RijG9w0lrxCxvekgZtuQI9jD23+n7DGGv6o5UAy8swTbuzPNIVatEgZm2Hd2y/WIMRt3/aJgIhxMpZ0OmasnXsFEveP34qrVVlTBnUoPbPw0976qo/iZYOhZRvXCK2XTkHigwNg2w1495Y9XjfcYgT80W1+wxWOrsIASN1gfAaB08I+7GMdmdMu5NPqFFKxKU7gjyAfJogctvdpReg+ObG7RS4TusKWWHba395d6RTNziU8u4EkNxWJpJ6RnPPcWJNgTjUH9L0zgPW0Tf2pRwVOUawbcIv8adjnRddqPyFPou2m6aasDsinfb2gd6Y+DoVxz//uFHM+AIgTQt3KiFwiCQGWOhhXuQgYuvyxzCxYMIVo5w+d6S5rnFuqAQS/XVXHXiipKLiOrkvE3n3zMG5YuV0CLIZbUS6lZWzZorWQQEbEUF7Sah17UECFrttahjs/cONFgTwI+mjoYsgbeJBriYVCQVEFBca87rCVXky2+xvpMWxDpx0jfgy8x61zmLHSjPQXvB8c7oisblfbp9WQPQrCNmFczCinuE/lxIDX7EMrmw+TfQB0K66CLA/I84xRiyaxVbkRFVCJk7BRwy62DuCiLid9A0YMbVadhdK2izGej8ctTXFt1acl+PX8PCyATLQ/VR/geb5NwqpQETSroVKTZlTnfDVXQWJtqQIY6ZSX8/kW6ODPq2NjVYHagE+8fqxzlph5jD1G5d95L76ROuu9sLhhFRZ3/Ql8hDjEhVjYTGtmKrmxLodnyoWIQx X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91ddaa63-1386-4771-df90-08d8bd4325a3 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2285.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2021 12:58:56.6289 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KL8LmAkTVWVE1DJRWm4DEVg+3FAjtgaEVYew1dFgdpy5q0VpgC81K6at+j/rKTDK2yNK0GeW7AMzFsA2NPnj8CKR2U/t+U7KwMrQVlUm/io= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4739 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9869 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101200074 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9869 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 impostorscore=0 mlxscore=0 priorityscore=1501 phishscore=0 mlxlogscore=999 lowpriorityscore=0 malwarescore=0 adultscore=0 clxscore=1015 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101200075 Received-SPF: pass client-ip=156.151.31.86; envelope-from=mihai.carabas@oracle.com; helo=userp2130.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mihai Carabas , peter.maydell@linaro.org, yvugenfi@redhat.com, kraxel@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" To ease the PCI device addition in next patches, split the code as follows: - generic code (read/write/setup) is being kept in pvpanic.c - ISA dependent code moved to pvpanic-isa.c Also, rename: - ISA_PVPANIC_DEVICE -> PVPANIC_ISA_DEVICE. - TYPE_PVPANIC -> TYPE_PVPANIC_ISA. - MemoryRegion io -> mr. - pvpanic_ioport_* in pvpanic_*. Update the build system with the new files and config structure. Signed-off-by: Mihai Carabas Reviewed-by: Peter Maydell --- hw/i386/Kconfig | 2 +- hw/misc/Kconfig | 6 ++- hw/misc/meson.build | 3 +- hw/misc/pvpanic-isa.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++ hw/misc/pvpanic.c | 85 +++--------------------------------------- include/hw/misc/pvpanic.h | 23 +++++++++++- tests/qtest/meson.build | 2 +- 7 files changed, 130 insertions(+), 85 deletions(-) create mode 100644 hw/misc/pvpanic-isa.c diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig index eea059f..7f91f30 100644 --- a/hw/i386/Kconfig +++ b/hw/i386/Kconfig @@ -14,7 +14,7 @@ config PC imply ISA_DEBUG imply PARALLEL imply PCI_DEVICES - imply PVPANIC + imply PVPANIC_ISA imply QXL imply SEV imply SGA diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig index cf18ac0..23bc978 100644 --- a/hw/misc/Kconfig +++ b/hw/misc/Kconfig @@ -121,9 +121,13 @@ config IOTKIT_SYSCTL config IOTKIT_SYSINFO bool -config PVPANIC +config PVPANIC_COMMON + bool + +config PVPANIC_ISA bool depends on ISA_BUS + select PVPANIC_COMMON config AUX bool diff --git a/hw/misc/meson.build b/hw/misc/meson.build index 607cd38..edaaec2 100644 --- a/hw/misc/meson.build +++ b/hw/misc/meson.build @@ -13,6 +13,7 @@ softmmu_ss.add(when: 'CONFIG_EMC141X', if_true: files('emc141x.c')) softmmu_ss.add(when: 'CONFIG_UNIMP', if_true: files('unimp.c')) softmmu_ss.add(when: 'CONFIG_EMPTY_SLOT', if_true: files('empty_slot.c')) softmmu_ss.add(when: 'CONFIG_LED', if_true: files('led.c')) +softmmu_ss.add(when: 'CONFIG_PVPANIC_COMMON', if_true: files('pvpanic.c')) # ARM devices softmmu_ss.add(when: 'CONFIG_PL310', if_true: files('arm_l2x0.c')) @@ -98,7 +99,7 @@ softmmu_ss.add(when: 'CONFIG_IOTKIT_SYSINFO', if_true: files('iotkit-sysinfo.c') softmmu_ss.add(when: 'CONFIG_ARMSSE_CPUID', if_true: files('armsse-cpuid.c')) softmmu_ss.add(when: 'CONFIG_ARMSSE_MHU', if_true: files('armsse-mhu.c')) -softmmu_ss.add(when: 'CONFIG_PVPANIC', if_true: files('pvpanic.c')) +softmmu_ss.add(when: 'CONFIG_PVPANIC_ISA', if_true: files('pvpanic-isa.c')) softmmu_ss.add(when: 'CONFIG_AUX', if_true: files('auxbus.c')) softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_scu.c', 'aspeed_sdmc.c', 'aspeed_xdma.c')) softmmu_ss.add(when: 'CONFIG_MSF2', if_true: files('msf2-sysreg.c')) diff --git a/hw/misc/pvpanic-isa.c b/hw/misc/pvpanic-isa.c new file mode 100644 index 0000000..27113ab --- /dev/null +++ b/hw/misc/pvpanic-isa.c @@ -0,0 +1,94 @@ +/* + * QEMU simulated pvpanic device. + * + * Copyright Fujitsu, Corp. 2013 + * + * Authors: + * Wen Congyang + * Hu Tao + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ + +#include "qemu/osdep.h" +#include "qemu/log.h" +#include "qemu/module.h" +#include "sysemu/runstate.h" + +#include "hw/nvram/fw_cfg.h" +#include "hw/qdev-properties.h" +#include "hw/misc/pvpanic.h" +#include "qom/object.h" +#include "hw/isa/isa.h" + +OBJECT_DECLARE_SIMPLE_TYPE(PVPanicISAState, PVPANIC_ISA_DEVICE) + +/* + * PVPanicISAState for ISA device and + * use ioport. + */ +struct PVPanicISAState { + ISADevice parent_obj; + + uint16_t ioport; + PVPanicState pvpanic; +}; + +static void pvpanic_isa_initfn(Object *obj) +{ + PVPanicISAState *s = PVPANIC_ISA_DEVICE(obj); + + pvpanic_setup_io(&s->pvpanic, DEVICE(s), 1); +} + +static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp) +{ + ISADevice *d = ISA_DEVICE(dev); + PVPanicISAState *s = PVPANIC_ISA_DEVICE(dev); + PVPanicState *ps = &s->pvpanic; + FWCfgState *fw_cfg = fw_cfg_find(); + uint16_t *pvpanic_port; + + if (!fw_cfg) { + return; + } + + pvpanic_port = g_malloc(sizeof(*pvpanic_port)); + *pvpanic_port = cpu_to_le16(s->ioport); + fw_cfg_add_file(fw_cfg, "etc/pvpanic-port", pvpanic_port, + sizeof(*pvpanic_port)); + + isa_register_ioport(d, &ps->mr, s->ioport); +} + +static Property pvpanic_isa_properties[] = { + DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicISAState, ioport, 0x505), + DEFINE_PROP_UINT8("events", PVPanicISAState, pvpanic.events, PVPANIC_PANICKED | PVPANIC_CRASHLOADED), + DEFINE_PROP_END_OF_LIST(), +}; + +static void pvpanic_isa_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + dc->realize = pvpanic_isa_realizefn; + device_class_set_props(dc, pvpanic_isa_properties); + set_bit(DEVICE_CATEGORY_MISC, dc->categories); +} + +static TypeInfo pvpanic_isa_info = { + .name = TYPE_PVPANIC_ISA_DEVICE, + .parent = TYPE_ISA_DEVICE, + .instance_size = sizeof(PVPanicISAState), + .instance_init = pvpanic_isa_initfn, + .class_init = pvpanic_isa_class_init, +}; + +static void pvpanic_register_types(void) +{ + type_register_static(&pvpanic_isa_info); +} + +type_init(pvpanic_register_types) diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c index 35d6797..e2cb4a5 100644 --- a/hw/misc/pvpanic.c +++ b/hw/misc/pvpanic.c @@ -22,18 +22,6 @@ #include "hw/misc/pvpanic.h" #include "qom/object.h" -/* The bit of supported pv event, TODO: include uapi header and remove this */ -#define PVPANIC_F_PANICKED 0 -#define PVPANIC_F_CRASHLOADED 1 - -/* The pv event value */ -#define PVPANIC_PANICKED (1 << PVPANIC_F_PANICKED) -#define PVPANIC_CRASHLOADED (1 << PVPANIC_F_CRASHLOADED) - -typedef struct PVPanicState PVPanicState; -DECLARE_INSTANCE_CHECKER(PVPanicState, ISA_PVPANIC_DEVICE, - TYPE_PVPANIC) - static void handle_event(int event) { static bool logged; @@ -54,90 +42,29 @@ static void handle_event(int event) } } -#include "hw/isa/isa.h" - -struct PVPanicState { - ISADevice parent_obj; - - MemoryRegion io; - uint16_t ioport; - uint8_t events; -}; - /* 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) { PVPanicState *pvp = opaque; return pvp->events; } -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, }, }; -static void pvpanic_isa_initfn(Object *obj) -{ - PVPanicState *s = ISA_PVPANIC_DEVICE(obj); - - memory_region_init_io(&s->io, 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); - FWCfgState *fw_cfg = fw_cfg_find(); - uint16_t *pvpanic_port; - - if (!fw_cfg) { - return; - } - - pvpanic_port = g_malloc(sizeof(*pvpanic_port)); - *pvpanic_port = cpu_to_le16(s->ioport); - fw_cfg_add_file(fw_cfg, "etc/pvpanic-port", pvpanic_port, - sizeof(*pvpanic_port)); - - isa_register_ioport(d, &s->io, s->ioport); -} - -static Property pvpanic_isa_properties[] = { - DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicState, ioport, 0x505), - DEFINE_PROP_UINT8("events", PVPanicState, events, PVPANIC_PANICKED | PVPANIC_CRASHLOADED), - DEFINE_PROP_END_OF_LIST(), -}; - -static void pvpanic_isa_class_init(ObjectClass *klass, void *data) +void pvpanic_setup_io(PVPanicState *s, DeviceState *dev, unsigned size) { - DeviceClass *dc = DEVICE_CLASS(klass); - - dc->realize = pvpanic_isa_realizefn; - device_class_set_props(dc, pvpanic_isa_properties); - set_bit(DEVICE_CATEGORY_MISC, dc->categories); + memory_region_init_io(&s->mr, OBJECT(dev), &pvpanic_ops, s, "pvpanic", size); } - -static TypeInfo pvpanic_isa_info = { - .name = TYPE_PVPANIC, - .parent = TYPE_ISA_DEVICE, - .instance_size = sizeof(PVPanicState), - .instance_init = pvpanic_isa_initfn, - .class_init = pvpanic_isa_class_init, -}; - -static void pvpanic_register_types(void) -{ - type_register_static(&pvpanic_isa_info); -} - -type_init(pvpanic_register_types) diff --git a/include/hw/misc/pvpanic.h b/include/hw/misc/pvpanic.h index ae0c818..abc9dde 100644 --- a/include/hw/misc/pvpanic.h +++ b/include/hw/misc/pvpanic.h @@ -17,13 +17,32 @@ #include "qom/object.h" -#define TYPE_PVPANIC "pvpanic" +#define TYPE_PVPANIC_ISA_DEVICE "pvpanic" #define PVPANIC_IOPORT_PROP "ioport" +/* The bit of supported pv event, TODO: include uapi header and remove this */ +#define PVPANIC_F_PANICKED 0 +#define PVPANIC_F_CRASHLOADED 1 + +/* The pv event value */ +#define PVPANIC_PANICKED (1 << PVPANIC_F_PANICKED) +#define PVPANIC_CRASHLOADED (1 << PVPANIC_F_CRASHLOADED) + +/* + * PVPanicState for any device type + */ +typedef struct PVPanicState PVPanicState; +struct PVPanicState { + MemoryRegion mr; + uint8_t events; +}; + +void pvpanic_setup_io(PVPanicState *s, DeviceState *dev, unsigned size); + static inline uint16_t pvpanic_port(void) { - Object *o = object_resolve_path_type("", TYPE_PVPANIC, NULL); + Object *o = object_resolve_path_type("", TYPE_PVPANIC_ISA_DEVICE, NULL); if (!o) { return 0; } diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 16d0462..0e85343 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -33,7 +33,7 @@ qtests_i386 = \ (config_host.has_key('CONFIG_LINUX') and \ config_all_devices.has_key('CONFIG_ISA_IPMI_BT') ? ['ipmi-bt-test'] : []) + \ (config_all_devices.has_key('CONFIG_WDT_IB700') ? ['wdt_ib700-test'] : []) + \ - (config_all_devices.has_key('CONFIG_PVPANIC') ? ['pvpanic-test'] : []) + \ + (config_all_devices.has_key('CONFIG_PVPANIC_ISA') ? ['pvpanic-test'] : []) + \ (config_all_devices.has_key('CONFIG_HDA') ? ['intel-hda-test'] : []) + \ (config_all_devices.has_key('CONFIG_I82801B11') ? ['i82801b11-test'] : []) + \ (config_all_devices.has_key('CONFIG_IOH3420') ? ['ioh3420-test'] : []) + \ From patchwork Wed Jan 20 12:11:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Carabas X-Patchwork-Id: 1429161 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2020-01-29 header.b=I3LValIh; dkim=pass (1024-bit key; unprotected) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-oracle-onmicrosoft-com header.b=Odsacyq0; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DLQgK2lyvz9sWR for ; Thu, 21 Jan 2021 00:03:08 +1100 (AEDT) Received: from localhost ([::1]:33172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l2D8c-0008Nj-E1 for incoming@patchwork.ozlabs.org; Wed, 20 Jan 2021 08:03:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2D4p-00067F-CF for qemu-devel@nongnu.org; Wed, 20 Jan 2021 07:59:11 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:43310) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2D4k-0002Fg-Qf for qemu-devel@nongnu.org; Wed, 20 Jan 2021 07:59:11 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10KCdW3a145790; Wed, 20 Jan 2021 12:59:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2020-01-29; bh=UOmdQt/gps3pRvRVGUAzIwXKmBRuK2tNgpVkV/i4Hp8=; b=I3LValIhQYERfY01SoMmCIpoJBGKNY5RA4HQkjTw/FXEJxYSbarPik0Zbhnzo7bG3Nzu ihPargFleQlm+MEt2C6VbkRxgzecneUDtSX0vFbv3r91i1bSDL1Jl6Ba9Z/Qve+26pUY afu3A7zHvm6ywJo8lzhhnn9gX22U3Doe96x2V2aMxeoRLbkFloLdXrab0U9BRAq5qQNG pUrRj7cp/NK32oqfgcePokuh2jR7RMzbKCm/Harz/SQL+kf5ypgDvccgkM0pUDGCorCB EiZ4224ysMKSvjt5QHj9k0p94EQ/EFb+YtCWjVWiSTVPKPjnGC0Is/ePfkV21VFxKTMd Jg== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 3668qaab03-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jan 2021 12:59:01 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10KCZoJm099532; Wed, 20 Jan 2021 12:59:00 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) by aserp3020.oracle.com with ESMTP id 3668rdvprk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jan 2021 12:59:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fSBwxzF/QhFRnVLkyXhwXWSQRLw5l4al3veyGn/3hXY7DI4MUcQfY3iJB6BKEfBTnvMovzo00W0eDiKpihmiZUkkYY83Q0Wq7Ja2AvLUA6AOwFn3qw0iLbINjpB0KTV5FY8KgGeqDXXi2CysZrUqAmmhmdJrvDASzf9xXK5FvjC9KlzFuhxvWdU67GxuB9ReJ9usbeWcYzkezl5kvEY3UgSEMaLRFGDa++eIuAAFDawnSgM1IYI3V8ZvCYx4cZC1DhX9c2lW7WUQDjrgk/NxHLiLQ9yOEKJOdnU/bG6+31rSMsfH+bS4t5jRLr82brghW6lhBgTQgfsm3ouNMq8MEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UOmdQt/gps3pRvRVGUAzIwXKmBRuK2tNgpVkV/i4Hp8=; b=hB7F+OLF3ceIzsDyAmq1Vjlbofrl/fop/fENd9qRnQDaZGUtw2RMfNZ9PCfjxhgZ6DfVT0S9HN2UJIitS3mEC7N/4bROOENkEcKeAzotOQ1rY6DmQt8wy41w+MEv+MV59ec3wxk/giwKv57BlCm2aWckO5up44GMTjSPKL1yPaUbiz7ddSrqvLLz3Uvv5ENdZFeMV8jJ/9yMIridI2b2FrnRMCB5rI6NXRa4mTfzX0jtBcSuFufOczY3Rpgpc28tp3ed06J4ngTsiBp96GhyJMk43Cd6LsZa50yGQbsJqk5gw/RrY7nOUlZSHSy3BsIXok7KsN/NP56zlLRiHKb6EQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UOmdQt/gps3pRvRVGUAzIwXKmBRuK2tNgpVkV/i4Hp8=; b=Odsacyq0qVe9OFAQHbAqZhkWZO6arU5T6VE+70FmBLU3/IZN5j0FVOFm4HXNSnvi/o1M1y51V+0V6/vh5j4nHRFzEpEDcFjT0Ye6VsQf+nFpijHansqHhdKEXQiZCe6DZbGcNNYqTvSZXQJrz3d8JEx+yGJvNAaif6nyKBYGVHc= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=oracle.com; Received: from MWHPR1001MB2285.namprd10.prod.outlook.com (2603:10b6:301:2e::32) by CO1PR10MB4739.namprd10.prod.outlook.com (2603:10b6:303:96::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Wed, 20 Jan 2021 12:58:58 +0000 Received: from MWHPR1001MB2285.namprd10.prod.outlook.com ([fe80::f48a:d4cb:d74c:48ba]) by MWHPR1001MB2285.namprd10.prod.outlook.com ([fe80::f48a:d4cb:d74c:48ba%6]) with mapi id 15.20.3742.014; Wed, 20 Jan 2021 12:58:58 +0000 From: Mihai Carabas To: qemu-devel@nongnu.org Subject: [PATCH v5 2/4] hw/misc/pvpanic: add PCI interface support Date: Wed, 20 Jan 2021 14:11:51 +0200 Message-Id: <1611144713-21433-3-git-send-email-mihai.carabas@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1611144713-21433-1-git-send-email-mihai.carabas@oracle.com> References: <1611144713-21433-1-git-send-email-mihai.carabas@oracle.com> X-Originating-IP: [138.3.200.25] X-ClientProxiedBy: SA9PR10CA0026.namprd10.prod.outlook.com (2603:10b6:806:a7::31) To MWHPR1001MB2285.namprd10.prod.outlook.com (2603:10b6:301:2e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mihai.localdomain (138.3.200.25) by SA9PR10CA0026.namprd10.prod.outlook.com (2603:10b6:806:a7::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Wed, 20 Jan 2021 12:58:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5b88f8da-ab04-417e-ce10-08d8bd432696 X-MS-TrafficTypeDiagnostic: CO1PR10MB4739: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:227; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rFt3ppYk+K2lK42n9OKqIdJcE4+Dzw53DWSiaI1TLs9LBxxkuVXQJOFCuSDivDzaDvpFNHe03nUfETmM7yICCoNWYLritcVv2OgWBAWuDoU7xvI+Mva2GNr3gUPiHHO4Vm0RZ6s2kaGYAHXSVoaouj+jdF2TYB9/JU2C4sOKiVZry2pONwBDfNpZ6r09NagQtDsMncbBi7S89WEp54BoOl9rUpyUloj83VqJEsgY8oaQhMZW7N209Oam6+pi4dpV702+3SfBO+Qd6wjHmA0Rax7XutjQn+/Wn7SaQIDazpwtMDMWgv1rCYrio1odtd2DIDE8ldgEIwrERmbzB/PezYvCVylnYI8CkYd7hD1R+8CWE6BgyCCnBjydN2IvXqcjUg3s6oFsdVSecHz9W1Dyqw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2285.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(346002)(366004)(376002)(136003)(39860400002)(396003)(6916009)(6666004)(52116002)(4326008)(2906002)(66946007)(508600001)(66556008)(66476007)(5660300002)(36756003)(2616005)(86362001)(956004)(8936002)(316002)(6512007)(44832011)(107886003)(8676002)(6506007)(6486002)(83380400001)(186003)(26005)(16526019); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: nm/aE3apgXKxlV1hhO6hjlVPUI5ek6CtF3W4yThzljszTnEC2UMJ/lZX8lW8oPoKVHaUOOHrBN6iC2oUHzemYfdbVGpCPaC6Kr0ee5SWOTnPErDrNmDGKEtEDlWncvcAmH7La0KsJCAmjRVM/kWb3K4YaMiOsKumzBSGWV85XQkDK9BEjhWVqmMW9nSTG0u7PyD0j/D/8mkDPOEQQMH1rxLFRKe/tuaOJJLHbKTX+9RkYR5N+iWvD1rmXupZJH1BItf+Wy3wreAhIoJUwizhuI0dFaoTa7tC/MzhU95eFhDojXZ9QPFNgz+A736R4HDd96cob7cqTC5l70xGiXVFSCZ2TAvk2UN8B1/iZIch61I5oQWka5wHqTH1tjtLoPDgiXrVy+68QvVYmy4mC84LXAjA0RNnICf7vl6t17XtUzQAd2DQ8GQ3O3LCRf5Q+tPtAJ10AwTqHYgfoqC/3vSRLFk1Avos0ICJ1/npoc0tarNMelPvcBJaURIoUT3xanIf539j6D19yauuxWyWJXRxfvo5o4tpYZoQTKzKMqhrfk8m8tBvlekak84WZz8N6U0Sg8rw9M+GzelKQSQk5AEsf6dUzBJuc/2Bx0exutwNDQyZOGn8cmEeTrSOvkLfiKo1jVv+C19F+sGUR81cxB+meU4xlLBeWwwHW/zSyGl//Hm0qSJtqG1mR4sDyylA6bTA1b0QVrXhnQ3HBSUKYJZr/REtTKj9id66uLNUHg6bWNnBmM9spe8bf8zOOL9MyfZybkWhAhCmtYQDnFVVstSUDb0jgzRbS598OY3ofTFrbWtnaPQ9JKEp4Pf0mhRw7SFmCIQoCJkbJYOPww1Ez1ONBxrsWFEtJGv+9dxY5jIkrGWSPVGAU022rxO3sl6h0Nq7TvPENs2nr089JECzO3rSnNw7cGLvD9SYL/jostg1y9kl2Omh9/g0AaQjYvYqUuRsK9uE5c7CTQu6/9q1S/xGuwLp7HYQF6npQUmAwgU6T/VaXmW0AfEe7yEsc1AJqrOL X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b88f8da-ab04-417e-ce10-08d8bd432696 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2285.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2021 12:58:58.2280 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: s11Q2MPoecFS5+bgMbroOVS7Og2XczdxMWKTmTwBHwA0SnSvzJEQ07WSC6ifgVwgB9Bg+CGxztbiLdlSfcuXiq2ivce2ET9qcjjnOnCooCE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4739 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9869 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101200074 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9869 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 impostorscore=0 mlxscore=0 priorityscore=1501 phishscore=0 mlxlogscore=999 lowpriorityscore=0 malwarescore=0 adultscore=0 clxscore=1015 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101200074 Received-SPF: pass client-ip=156.151.31.86; envelope-from=mihai.carabas@oracle.com; helo=userp2130.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mihai Carabas , peter.maydell@linaro.org, yvugenfi@redhat.com, kraxel@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add PCI interface support for PVPANIC device. Create a new file pvpanic-pci.c where the PCI specific routines reside and update the build system with the new files and config structure. Signed-off-by: Mihai Carabas Reviewed-by: Gerd Hoffmann Reviewed-by: Peter Maydell --- docs/specs/pci-ids.txt | 1 + hw/misc/Kconfig | 6 +++ hw/misc/meson.build | 1 + hw/misc/pvpanic-pci.c | 96 +++++++++++++++++++++++++++++++++++++++++++++++ include/hw/misc/pvpanic.h | 1 + include/hw/pci/pci.h | 1 + 6 files changed, 106 insertions(+) create mode 100644 hw/misc/pvpanic-pci.c diff --git a/docs/specs/pci-ids.txt b/docs/specs/pci-ids.txt index abbdbca..5e407a6 100644 --- a/docs/specs/pci-ids.txt +++ b/docs/specs/pci-ids.txt @@ -64,6 +64,7 @@ PCI devices (other than virtio): 1b36:000d PCI xhci usb host adapter 1b36:000f mdpy (mdev sample device), linux/samples/vfio-mdev/mdpy.c 1b36:0010 PCIe NVMe device (-device nvme) +1b36:0011 PCI PVPanic device (-device pvpanic-pci) All these devices are documented in docs/specs. diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig index 23bc978..19c216f 100644 --- a/hw/misc/Kconfig +++ b/hw/misc/Kconfig @@ -124,6 +124,12 @@ config IOTKIT_SYSINFO config PVPANIC_COMMON bool +config PVPANIC_PCI + bool + default y if PCI_DEVICES + depends on PCI + select PVPANIC_COMMON + config PVPANIC_ISA bool depends on ISA_BUS diff --git a/hw/misc/meson.build b/hw/misc/meson.build index edaaec2..6292839 100644 --- a/hw/misc/meson.build +++ b/hw/misc/meson.build @@ -100,6 +100,7 @@ softmmu_ss.add(when: 'CONFIG_ARMSSE_CPUID', if_true: files('armsse-cpuid.c')) softmmu_ss.add(when: 'CONFIG_ARMSSE_MHU', if_true: files('armsse-mhu.c')) softmmu_ss.add(when: 'CONFIG_PVPANIC_ISA', if_true: files('pvpanic-isa.c')) +softmmu_ss.add(when: 'CONFIG_PVPANIC_PCI', if_true: files('pvpanic-pci.c')) softmmu_ss.add(when: 'CONFIG_AUX', if_true: files('auxbus.c')) softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_scu.c', 'aspeed_sdmc.c', 'aspeed_xdma.c')) softmmu_ss.add(when: 'CONFIG_MSF2', if_true: files('msf2-sysreg.c')) diff --git a/hw/misc/pvpanic-pci.c b/hw/misc/pvpanic-pci.c new file mode 100644 index 0000000..ba288c1 --- /dev/null +++ b/hw/misc/pvpanic-pci.c @@ -0,0 +1,96 @@ +/* + * QEMU simulated PCI pvpanic device. + * + * Copyright (C) 2020 Oracle + * + * Authors: + * Mihai Carabas + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ + +#include "qemu/osdep.h" +#include "qemu/log.h" +#include "qemu/module.h" +#include "sysemu/runstate.h" + +#include "hw/nvram/fw_cfg.h" +#include "hw/qdev-properties.h" +#include "migration/vmstate.h" +#include "hw/misc/pvpanic.h" +#include "qom/object.h" +#include "hw/pci/pci.h" + +OBJECT_DECLARE_SIMPLE_TYPE(PVPanicPCIState, PVPANIC_PCI_DEVICE) + +/* + * PVPanicPCIState for PCI device + */ +typedef struct PVPanicPCIState { + PCIDevice dev; + PVPanicState pvpanic; +} PVPanicPCIState; + +static const VMStateDescription vmstate_pvpanic_pci = { + .name = "pvpanic-pci", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_PCI_DEVICE(dev, PVPanicPCIState), + VMSTATE_END_OF_LIST() + } +}; + +static void pvpanic_pci_realizefn(PCIDevice *dev, Error **errp) +{ + PVPanicPCIState *s = PVPANIC_PCI_DEVICE(dev); + PVPanicState *ps = &s->pvpanic; + + pvpanic_setup_io(&s->pvpanic, DEVICE(s), 2); + + pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &ps->mr); +} + +static Property pvpanic_pci_properties[] = { + DEFINE_PROP_UINT8("events", PVPanicPCIState, pvpanic.events, PVPANIC_PANICKED | PVPANIC_CRASHLOADED), + DEFINE_PROP_END_OF_LIST(), +}; + +static void pvpanic_pci_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + PCIDeviceClass *pc = PCI_DEVICE_CLASS(klass); + + device_class_set_props(dc, pvpanic_pci_properties); + + pc->realize = pvpanic_pci_realizefn; + pc->vendor_id = PCI_VENDOR_ID_REDHAT; + pc->device_id = PCI_DEVICE_ID_REDHAT_PVPANIC; + pc->subsystem_vendor_id = PCI_VENDOR_ID_REDHAT; + pc->subsystem_id = PCI_DEVICE_ID_REDHAT_PVPANIC; + pc->revision = 1; + pc->class_id = PCI_CLASS_SYSTEM_OTHER; + dc->vmsd = &vmstate_pvpanic_pci; + + set_bit(DEVICE_CATEGORY_MISC, dc->categories); +} + +static TypeInfo pvpanic_pci_info = { + .name = TYPE_PVPANIC_PCI_DEVICE, + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(PVPanicPCIState), + .class_init = pvpanic_pci_class_init, + .interfaces = (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { } + } +}; + +static void pvpanic_register_types(void) +{ + type_register_static(&pvpanic_pci_info); +} + +type_init(pvpanic_register_types); diff --git a/include/hw/misc/pvpanic.h b/include/hw/misc/pvpanic.h index abc9dde..ca3c5bb 100644 --- a/include/hw/misc/pvpanic.h +++ b/include/hw/misc/pvpanic.h @@ -18,6 +18,7 @@ #include "qom/object.h" #define TYPE_PVPANIC_ISA_DEVICE "pvpanic" +#define TYPE_PVPANIC_PCI_DEVICE "pvpanic-pci" #define PVPANIC_IOPORT_PROP "ioport" diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 259f9c9..66db084 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -107,6 +107,7 @@ extern bool pci_available; #define PCI_DEVICE_ID_REDHAT_PCIE_BRIDGE 0x000e #define PCI_DEVICE_ID_REDHAT_MDPY 0x000f #define PCI_DEVICE_ID_REDHAT_NVME 0x0010 +#define PCI_DEVICE_ID_REDHAT_PVPANIC 0x0011 #define PCI_DEVICE_ID_REDHAT_QXL 0x0100 #define FMT_PCIBUS PRIx64 From patchwork Wed Jan 20 12:11:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Carabas X-Patchwork-Id: 1429159 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2020-01-29 header.b=sPDwXan0; dkim=pass (1024-bit key; unprotected) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-oracle-onmicrosoft-com header.b=P3eO53vX; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DLQby12P7z9sSs for ; Thu, 21 Jan 2021 00:00:14 +1100 (AEDT) Received: from localhost ([::1]:56480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l2D5o-00067M-2h for incoming@patchwork.ozlabs.org; Wed, 20 Jan 2021 08:00:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2D4o-000670-8Q for qemu-devel@nongnu.org; Wed, 20 Jan 2021 07:59:10 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:43332) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2D4k-0002Fk-Qo for qemu-devel@nongnu.org; Wed, 20 Jan 2021 07:59:09 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10KCdsMe145909; Wed, 20 Jan 2021 12:59:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2020-01-29; bh=3jkOSU73no9c1wvY97sdyMJOwxj1A1nBsaPRtYSJqiU=; b=sPDwXan0hapXC16Vnsaf+L9nKeb9vVTt45htwWovklfew6uG6LIWMUP6mmtCeUEduTLI vH2AOISDYPQkeIGe71r6fLGuCLn74Dx4gwU/T8YztEpbUKqo/Afv+QoHwDVJZyubw2O5 mO1zkfAd4crqqUgugu9s2wX3lOGnWwTm7k8dBmthx9uVqSjkcjz5piwWCRQFraUJBD37 bbM2QdW5ZuaSfrxqLR61uayhdG2D9Om+pFU99tG+MjTGXHAH/10k4L01p84v0esdKD00 Hcm86sbW1u9R9W/7jAjWRr+hl6EcVO+6MFBiP3QLkc486LSwajAE7au6TuI3Txp5mED9 mw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 3668qaab0b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jan 2021 12:59:02 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10KCaf3H061415; Wed, 20 Jan 2021 12:59:02 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by userp3020.oracle.com with ESMTP id 3668qw5s1p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jan 2021 12:59:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xag1LqD8myV3AGzP6PJ5T8QpWI8VFCePNh6JOgfkASUFGLPQTHgeEcq8K92TGf1y8AGQR2nf/f5UDeYh6BBnlsPebAogyxsABMucT/G4zeP7aa6USxXQ970ETACgWHs9M8pWY6XgL2JGa7u3vLx980KwcoRvLaEZEWEeLqOH0TpEes4+rmWY7Bodb79HH8sYovxD5VZ7KUIFJuQP+2PBr2ogJgQ5EjkTmwkf5pYkxRLzH2/9+ZUuxObqxMW7KWNXiDxlZV1F/rc5luHG+8dGeL+fWhFgwvtzJFUM4sudoEUoKoIH298NLVqR2rNteipOSl0fYuS2LD26vJRNlWNziw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3jkOSU73no9c1wvY97sdyMJOwxj1A1nBsaPRtYSJqiU=; b=KUClQW7JE9oqjhd4PNq+qU7lG5Vk8Y89e4KLzEupOfNv0CmqCF/o4DMVc0Zpy4wq1zFgNFDY4a289k/3jcsKnRLkqrs9jpjc214on2FgqkWcQfrcQi1jvUw6cGgu25I9vu1kBBtQ3XSZ2d+eyWq2bNAK8KykDrfcBbF24JzI+BG1mz0wEsJmoEJjBSnXc3tArYkAqh3sKA89LCgYhYqZ+xYSYNSt2Hi5ML45sPQNrQKL1J3wHThzYMo23h4RZIBjt5SOPWf2JNfDaZYPdFRut4JBuoR0kGsQK5ztkYVgpB+gPZ04uV1TirGT1NB7OrNJDFTm4GZ9j5zegi6hUV4tZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3jkOSU73no9c1wvY97sdyMJOwxj1A1nBsaPRtYSJqiU=; b=P3eO53vXjcLv+Wexw7fEsb6qrP4xKWFiKHmnL3XZB94BNyq4/Q87WPAdFceBWQTi2BQL7Ij4+UUMZBcmkyX7PYUiO4DrLc02R4a2ZwinCa2WZ2ogkS30y9bXfa2gEatpSUMc1tQjr88DoMCkN5oBDnjAloz6oleibE0olFRUxRA= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=oracle.com; Received: from MWHPR1001MB2285.namprd10.prod.outlook.com (2603:10b6:301:2e::32) by CO1PR10MB4739.namprd10.prod.outlook.com (2603:10b6:303:96::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Wed, 20 Jan 2021 12:59:00 +0000 Received: from MWHPR1001MB2285.namprd10.prod.outlook.com ([fe80::f48a:d4cb:d74c:48ba]) by MWHPR1001MB2285.namprd10.prod.outlook.com ([fe80::f48a:d4cb:d74c:48ba%6]) with mapi id 15.20.3742.014; Wed, 20 Jan 2021 12:59:00 +0000 From: Mihai Carabas To: qemu-devel@nongnu.org Subject: [PATCH v5 3/4] pvpanic : update pvpanic spec document Date: Wed, 20 Jan 2021 14:11:52 +0200 Message-Id: <1611144713-21433-4-git-send-email-mihai.carabas@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1611144713-21433-1-git-send-email-mihai.carabas@oracle.com> References: <1611144713-21433-1-git-send-email-mihai.carabas@oracle.com> X-Originating-IP: [138.3.200.25] X-ClientProxiedBy: SA9PR10CA0026.namprd10.prod.outlook.com (2603:10b6:806:a7::31) To MWHPR1001MB2285.namprd10.prod.outlook.com (2603:10b6:301:2e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mihai.localdomain (138.3.200.25) by SA9PR10CA0026.namprd10.prod.outlook.com (2603:10b6:806:a7::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Wed, 20 Jan 2021 12:58:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b52872e4-8371-4ab2-0aa0-08d8bd43278a X-MS-TrafficTypeDiagnostic: CO1PR10MB4739: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UA9PGPzUNcmhVKLvCTUAmzb64a+srEaF+K/I4t3RUqCcBwQmo78IunBeszUSih8eEQEt8VKvQR+YfyztZ3QodjkKqZPtnH/3xlK88srJENeoAxrsNIq0zhfozj9uDUVIlKYKhQo48ZJnJgGJE1GWEmmOMyT+Gs9YvuMwc/J9hMdZTgAdnBpTMsUmvWcEM2pn/VIIx/kTwLE58X32PZCL5Qe4CGapVtPklPxs38TEzktj9f+Sg+RKiJzJsD6duQRCqoyMCxgApOqStho/OAnlrB6My2gxhuL91v+hqaz1eBzkWzaUiS+cmK/S5YDI8EwxUoRmU+H/pnldyxRTWS2dtrpUU06U+tuVQZvfTN0zqbs4FmnYhyINcIZQKjj/47LsOlj6k8ZQaEb9it6q3N1ZZw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2285.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(346002)(366004)(376002)(136003)(39860400002)(396003)(6916009)(6666004)(52116002)(4326008)(2906002)(66946007)(508600001)(66556008)(66476007)(5660300002)(36756003)(2616005)(86362001)(956004)(8936002)(316002)(6512007)(44832011)(107886003)(8676002)(6506007)(6486002)(83380400001)(186003)(26005)(16526019); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: weYMDgvbl0P6nva0UJGVsiMduKQ1DMvrKAsTU2FPQhi0NfyWJF8jGN1tYVc7tJL1mqgC6WHDBSAXs10cq7aM5W/rpTWRPYvQBPJvZFeTV4oTU05QtqWAVD9DVn+VXYnTGleIcVjxfhNrnej3kgRuEKKCdjuFkuvRCkNSzX0jogeO+ovFafUJSgQ3EyXu0hqminZurXkJ/973UnqgkPmw9N87U2iWevaaKFo0XtfybIvIlWoiD8we6TLylBS95kz8tR9MIo82dz3dY5l7kjhkwg5UWMhgwBLgaYVAruZBUhwRQK4VyNCRrt1GyRDJq2+PSy8k/QWrWNNByxU7qyjdi222OwVSYWkmN/Kd68JxC6zqWEeDjGQi6WPkUZi8ZX/mwe6owsqq57buTQjeOtNvhOVb73HdlOdPugrHozvLPR0ExK70vi8gH9joFXWNIOD4s2mapdnJHXN2e9M0K3M41eneIgl9UhzvOalLzxERrKLOco4taNQq8nGUvyWj7lkAmiiW/wnCywjYgwlJ1yGL4qAVuXjYSDDUk+g+XwapQYl2+yZbezgryKksHJWGPg/M62xFAtWoDm3M7jrzSx606MSOCwakB1+J5lGZNkgWaP7BuoYwbI9Qxb8aYe61PN+yHHFO5pyGN3B0uI3Gl/79737OoNNFnURNxxuWmKluahRHda9aaXySIBiQAFiQge49bSmBC/+/YDs/RZzQFZm6Bik5OAbPoVKnDuOSi1qIylFExwIewCRw0gduDE2duB+xJmkfs2kwG6NXN3Jw/4GIbPaWGzaej/MRAFgvT5B4bGQWnflX+vFRhQc+bDnYcmklZSTR9R5Cdxg3jMyVkezM7ZDfhiLfDFEiMZz8pxTbM5HGIqkxGcfFIvF+JC/KiZTeBcWkiD9gci+lBlB/sB654dQV4WIsgEpJNj4dG7iKwhMpb3y7xT2AQBYahGODguSgpZWYnjFMR3vFbXXauN53QMVm33n2S/NoU1pUg6bdfDXNLtMX1lFgZX6BNCEvfXL5 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b52872e4-8371-4ab2-0aa0-08d8bd43278a X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2285.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2021 12:58:59.9420 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xgZkOgzzeiYvVH8wIY2fXgf8BUxLSa1q1J2Gb5ovsER/9NjWEHaGuDv8Nj4t7JJdvhN/9frSBpEUnSIq7+HY2WaUzKWnaVwFEiI1J106Q9s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4739 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9869 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 adultscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101200074 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9869 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 impostorscore=0 mlxscore=0 priorityscore=1501 phishscore=0 mlxlogscore=999 lowpriorityscore=0 malwarescore=0 adultscore=0 clxscore=1015 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101200074 Received-SPF: pass client-ip=156.151.31.86; envelope-from=mihai.carabas@oracle.com; helo=userp2130.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mihai Carabas , peter.maydell@linaro.org, yvugenfi@redhat.com, kraxel@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add pvpanic PCI device support details in docs/specs/pvpanic.txt. Signed-off-by: Mihai Carabas Reviewed-by: Peter Maydell --- docs/specs/pvpanic.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/specs/pvpanic.txt b/docs/specs/pvpanic.txt index a90fbca..8afcde1 100644 --- a/docs/specs/pvpanic.txt +++ b/docs/specs/pvpanic.txt @@ -1,7 +1,7 @@ PVPANIC DEVICE ============== -pvpanic device is a simulated ISA device, through which a guest panic +pvpanic device is a simulated 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. @@ -9,6 +9,9 @@ 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. +The pvpanic device can be implemented as an ISA device (using IOPORT) or as a +PCI device. + ISA Interface ------------- @@ -24,6 +27,14 @@ bit 1: a guest panic has happened and will be handled by the guest; the host should record it or report it, but should not affect the execution of the guest. +PCI Interface +------------- + +The PCI interface is similar to the ISA interface except that it uses an MMIO +address space provided by its BAR0, 1 byte long. Any machine with a PCI bus +can enable a pvpanic device by adding '-device pvpanic-pci' to the command +line. + ACPI Interface -------------- From patchwork Wed Jan 20 12:11:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Carabas X-Patchwork-Id: 1429158 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2020-01-29 header.b=zQ0wcsLR; dkim=pass (1024-bit key; unprotected) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-oracle-onmicrosoft-com header.b=iDhHRkkj; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DLQbm5nFkz9sSs for ; Thu, 21 Jan 2021 00:00:02 +1100 (AEDT) Received: from localhost ([::1]:56484 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l2D5b-00067P-4E for incoming@patchwork.ozlabs.org; Wed, 20 Jan 2021 07:59:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39178) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2D4o-000674-EV for qemu-devel@nongnu.org; Wed, 20 Jan 2021 07:59:10 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:43942) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2D4k-0002Fq-Qk for qemu-devel@nongnu.org; Wed, 20 Jan 2021 07:59:10 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10KCwZJW147944; Wed, 20 Jan 2021 12:59:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2020-01-29; bh=rCHHXbAp55ez5jmCCjUYEeruZ/HR+xMgHAD+Ph8lUlc=; b=zQ0wcsLRsXyGSn5i/R0CRK3lRcrqUYK3/cgAjahbc0EH652o02nVX+xJDA+s4UPhCx89 qIN3bokKiAVM9kY/lEutj9zxQEF4bcCespFDpYaZIlsNQd2FNPjHNu6aPWDYcFzs8cJQ 5KWMQsU0XHG6+rIsvgqhdJ0TJvj8C84ucGKdlbEPZeuBBwFCeLZ6h9HpjOFdyyM73/Ee 7NF9l7jbrhM86MUj/WqyDpvb6NnA7y4T0oMiX9D1tFGZugPCEbRVhEFRWa3GkFzF0MEw MmKo6aCkJKIyMuR1NAl0dCLXt/E+8ZDsh9Bg99N+iML+fUPq968kSCb2ya7b33YnDd7z 9w== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 3668qraart-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jan 2021 12:59:03 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10KCaf3I061415; Wed, 20 Jan 2021 12:59:03 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by userp3020.oracle.com with ESMTP id 3668qw5s1p-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jan 2021 12:59:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZfUlBvBmOtpMtZ38S4ELrAGc5auE3r3zXUjxopcgD+lJG9T58lhVcXgwxRHXjrYrzhPxt35taiyQPwVHrL0xz8u3w8PWy0nXMvMXJG8Xp+7QDS2FEsVfeJ49rqqeQKS5UDY/XbnH4S/2+rLi0t/ewe5JCsi8IwXIx6NHcjILPmsMcGFOGBB01n/fCqub5mPoY/WfIgzTQwkR/9BmIgJQBrodgsrUyYug2Tp+VY0ZuEWTahgODFU6HowWQXK5tPZbhLMFKMHy56JeHgdLlLXTxsTXRjTdT4WhRv+7xfn2wOfVk9fP0QfQ1SiWnv147pQD6mqypTPJf6tjsbwUUJBu5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rCHHXbAp55ez5jmCCjUYEeruZ/HR+xMgHAD+Ph8lUlc=; b=jibzGZRllib1awl+meqWGH0WhI7ns6GGXz94c4aSnnSUoaXyfVpGNW8JDGqLCh2nMNxQTGDM85h86v+4mVaAiqwAUz+LznWdAgOH0NmpHM8w28RQIrLW7DBcNUNBGyscRa3vXae+InUob1zvvomhOvJkmtw9ByjHao9HZR+0uNAs1XGxrmV6VPvP/KXGhHsTjkJOP+k9v1OGD4yKwGSZDYxDeCb8tJAIMIgMHQx5HNJYfYLSC5Mf+cGxG4/6ifVd7AlUZTldquW7PTBUrGC9SO1QRF00VfDmjVQUQOmIc8rn7h7vAoOGyUr5S/v1TWAsRHgasu4yBDEz4CGgx30GPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rCHHXbAp55ez5jmCCjUYEeruZ/HR+xMgHAD+Ph8lUlc=; b=iDhHRkkjqfMAD509ooQne2pLGCqMJqfiGBifgYvtp4KNnIxERUSG782w9QQwOyj6c+akcfVL67ccOhx5Hez3L2Ns+zAIFPwV7UOcm7xc9J5CpuZdf6Z1DFtWyK0Mu/xWrBWaUZHfVV5QMw+2lxz8+PCOjm9SNgkdd/LixDcc2Cg= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=oracle.com; Received: from MWHPR1001MB2285.namprd10.prod.outlook.com (2603:10b6:301:2e::32) by CO1PR10MB4739.namprd10.prod.outlook.com (2603:10b6:303:96::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Wed, 20 Jan 2021 12:59:01 +0000 Received: from MWHPR1001MB2285.namprd10.prod.outlook.com ([fe80::f48a:d4cb:d74c:48ba]) by MWHPR1001MB2285.namprd10.prod.outlook.com ([fe80::f48a:d4cb:d74c:48ba%6]) with mapi id 15.20.3742.014; Wed, 20 Jan 2021 12:59:01 +0000 From: Mihai Carabas To: qemu-devel@nongnu.org Subject: [PATCH v5 4/4] tests/qtest: add a test case for pvpanic-pci Date: Wed, 20 Jan 2021 14:11:53 +0200 Message-Id: <1611144713-21433-5-git-send-email-mihai.carabas@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1611144713-21433-1-git-send-email-mihai.carabas@oracle.com> References: <1611144713-21433-1-git-send-email-mihai.carabas@oracle.com> X-Originating-IP: [138.3.200.25] X-ClientProxiedBy: SA9PR10CA0026.namprd10.prod.outlook.com (2603:10b6:806:a7::31) To MWHPR1001MB2285.namprd10.prod.outlook.com (2603:10b6:301:2e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mihai.localdomain (138.3.200.25) by SA9PR10CA0026.namprd10.prod.outlook.com (2603:10b6:806:a7::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Wed, 20 Jan 2021 12:59:00 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 068e885a-a1e5-49f1-1217-08d8bd43288c X-MS-TrafficTypeDiagnostic: CO1PR10MB4739: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nN73HKVbaKi7RyABjqqcUis49Iga5Zxya3EBSYn53N02fN8SeOLBFAvyHdK1nvKutFyypLWn7pvZY1LFDFCbOih+OCeUiDlyW3eoKWFTECzBcZjbKhMc/kGXIW8v9OqTYWW/hIP5EsgiFzGrrtf5mXbMvd4wKtjiHNL7hbHVCE2ZBgugMHbLQQ+pcsXlKkyQUv6KfTXsutp51BU+6pv6J9vfqKvrnQ0J9b4UfQSyrE/4O5G+2vU7Dpq+GN41/4V/QBck07eVDT7M8QCgUh0akUYc0oUJwYBm5nWzbSEZqoGy6/e0xowuXcix/s86uhnPEZGsq4CEB5Kmkuy8Tw+JeRzk2crR8sBmqgC2szOTZpcvtffoVBYbjsSRNDPx9y3nD+w+qUuvp/+TRSLbZuRnYw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2285.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(346002)(366004)(376002)(136003)(39860400002)(396003)(6916009)(6666004)(52116002)(4326008)(2906002)(66946007)(508600001)(66556008)(66476007)(5660300002)(36756003)(2616005)(86362001)(956004)(8936002)(316002)(6512007)(44832011)(107886003)(8676002)(6506007)(6486002)(186003)(26005)(16526019); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: QA4wbITomvxwFmcdcGdW3Dx7ANh6vPHKIr+it3wG8wgqGCXMYXMOIU1nJhdZ0gSOdrEbnnfhm34PQ6aU5Zm3kQbDIzNbGijj53rbtSGc/SswG7oopr7ZlVFVMsATDlQQLAe9Rncv5UdRhvntuqKNyzHRExntUWpn6OPhY4MXMB5lUulijm94Z+/Qj+41JvFzY1LRkisbdOv2fzmuEMEDTPCDzMOFbD8ODhfxTK97+vB3FzhLXseAwi0VWmrxk8WmR8JauPTCirmgIYVd5a31nQsFd/Fso+DV2ToJJP3AtPyK2q5G8xBt7Vt68c+iRkyDFSSkYpeaBj+WzY8tX0syjvZfO+gYmXukDU7iAofztfLcZZo6MxGpqx7A4DWgOCYW8PwziEcLHwyKsKeoVQK1o5vcXOG4W2wdKvHnDFDG+yIFnR5zvvFScLPNi1f0GG8RMDaED6ubx/PXZnK7ZT9KTMn+8TpLTDsQX+cwPn6mMDLq1BTbUX92bgQAfiZWnEY1xpB9HxENoLy8Q72ZhmnvhACJGijNisFAVEg2WY/33hdu8bcyWDDcihyklAZ8PePUGRKVOsar/k/PZyVdVckE597/rly37Qt3ULT44OS8aDCNh9fh5A1kuAfCWqv31gzyASlu9DMLiOYTa1sCe5z+6DbCyE/8faESJDwHYkufYArzOapIbK6SKxfW7ZQwsLdcnFgye0lanv1I1DpFEka8m9WrM5k1dcYSNJLwt6XvwlVicyf7DYfCFitIwqJ+ZXVqqFpVn8xJ1xUpe7mP1v3Kv4RjbHroQh9ErYzEJIrBMH+unlC/dPRtQrGGvPLra9bySJs8f0eSf3tIqjocUftZdClvcG+iwuSlT1BMx2T86qZH9xGKIH4lN8+2AhaLNSjI1XCofj9M/k8fkhkb8S7XneyV4U2FV+MUaGpuAbV1dXUCMDlXac79KbaS74XI5CM4tbW2wvwvte6rYocwaA/sVmvz2x2uU3qLhbs+D3kmU3SUjlmRQfbfv7o3an54VoAr X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 068e885a-a1e5-49f1-1217-08d8bd43288c X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2285.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2021 12:59:01.6180 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Jer5jZnpgb2aUq0Jell8og3SOG4VzIsvbVaYoAByGj4U/JjtvVdcvB+E4i4LGo2V2RY1Qn8bvyRi5mEBiYykaYxN7K7W7lhBF3R9IFOio74= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4739 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9869 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 adultscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101200074 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9869 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 adultscore=0 spamscore=0 phishscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101200075 Received-SPF: pass client-ip=141.146.126.79; envelope-from=mihai.carabas@oracle.com; helo=aserp2130.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mihai Carabas , peter.maydell@linaro.org, yvugenfi@redhat.com, kraxel@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add a test case for pvpanic-pci device. The scenario is the same as pvpanic ISA device, but is using the PCI bus. Signed-off-by: Mihai Carabas Acked-by: Thomas Huth Reviewed-by: Peter Maydell --- tests/qtest/meson.build | 1 + tests/qtest/pvpanic-pci-test.c | 94 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 tests/qtest/pvpanic-pci-test.c diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 0e85343..12e456c 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -20,6 +20,7 @@ endif qtests_pci = \ (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) + \ + (config_all_devices.has_key('CONFIG_PVPANIC_PCI') ? ['pvpanic-pci-test'] : []) + \ (config_all_devices.has_key('CONFIG_IVSHMEM_DEVICE') ? ['ivshmem-test'] : []) qtests_i386 = \ diff --git a/tests/qtest/pvpanic-pci-test.c b/tests/qtest/pvpanic-pci-test.c new file mode 100644 index 0000000..3379970 --- /dev/null +++ b/tests/qtest/pvpanic-pci-test.c @@ -0,0 +1,94 @@ +/* + * QTest testcase for PV Panic PCI device + * + * Copyright (C) 2020 Oracle + * + * Authors: + * Mihai Carabas + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ + +#include "qemu/osdep.h" +#include "libqos/libqtest.h" +#include "qapi/qmp/qdict.h" +#include "libqos/pci.h" +#include "libqos/pci-pc.h" +#include "hw/pci/pci_regs.h" + +static void test_panic_nopause(void) +{ + uint8_t val; + QDict *response, *data; + QTestState *qts; + QPCIBus *pcibus; + QPCIDevice *dev; + QPCIBar bar; + + qts = qtest_init("-device pvpanic-pci -action panic=none"); + pcibus = qpci_new_pc(qts, NULL); + dev = qpci_device_find(pcibus, QPCI_DEVFN(0x4, 0x0)); + qpci_device_enable(dev); + bar = qpci_iomap(dev, 0, NULL); + + qpci_memread(dev, bar, 0, &val, sizeof(val)); + g_assert_cmpuint(val, ==, 3); + + val = 1; + qpci_memwrite(dev, bar, 0, &val, sizeof(val)); + + response = qtest_qmp_eventwait_ref(qts, "GUEST_PANICKED"); + g_assert(qdict_haskey(response, "data")); + data = qdict_get_qdict(response, "data"); + g_assert(qdict_haskey(data, "action")); + g_assert_cmpstr(qdict_get_str(data, "action"), ==, "run"); + qobject_unref(response); + + qtest_quit(qts); +} + +static void test_panic(void) +{ + uint8_t val; + QDict *response, *data; + QTestState *qts; + QPCIBus *pcibus; + QPCIDevice *dev; + QPCIBar bar; + + qts = qtest_init("-device pvpanic-pci -action panic=pause"); + pcibus = qpci_new_pc(qts, NULL); + dev = qpci_device_find(pcibus, QPCI_DEVFN(0x4, 0x0)); + qpci_device_enable(dev); + bar = qpci_iomap(dev, 0, NULL); + + qpci_memread(dev, bar, 0, &val, sizeof(val)); + g_assert_cmpuint(val, ==, 3); + + val = 1; + qpci_memwrite(dev, bar, 0, &val, sizeof(val)); + + response = qtest_qmp_eventwait_ref(qts, "GUEST_PANICKED"); + g_assert(qdict_haskey(response, "data")); + data = qdict_get_qdict(response, "data"); + g_assert(qdict_haskey(data, "action")); + g_assert_cmpstr(qdict_get_str(data, "action"), ==, "pause"); + qobject_unref(response); + + qtest_quit(qts); +} + +int main(int argc, char **argv) +{ + int ret; + + g_test_init(&argc, &argv, NULL); + qtest_add_func("/pvpanic-pci/panic", test_panic); + qtest_add_func("/pvpanic-pci/panic-nopause", test_panic_nopause); + + ret = g_test_run(); + + return ret; +}