From nobody Tue Nov 18 04:28:29 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1607924279; cv=none; d=zohomail.com; s=zohoarc; b=f8ntMd0L65Rr5Ympzd7+a4tZudowqri+vQC0QPIzqKWB/QERFD2488I7tzQgcXzhGhCQyW5/ebnNNit3Rv7zPUrcD9n33Vo05ilAZV2cDR6fWOznU19DbnKe6zk1C/WEQz/NSrqP1H0MjdhISx4UoGprX3FhpsE9GCLtavCHzkI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607924279; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=NQrUtSHQ/SyjP9Lv7kgus4LkTCtsp1NGWGzWnNqtxWU=; b=asZrGokCw/XI+/X+IdV0Du1Q+rRTa9xyC3wjtTwfN9jSlJDpXxo7wk1iw2iKWfz480t5ot9vm7WUMLuKqVes6QS05981vuJJEG1Fd5J8+r+KhGEDp/35zUaLfjdIKRG2g1Im3+ku0vJIOJxDYGlOJxDrXaAvyEo9NtDELkALfPo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607924279183303.7008525457346; Sun, 13 Dec 2020 21:37:59 -0800 (PST) Received: from localhost ([::1]:48192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kogYX-0006Hm-W9 for importer@patchew.org; Mon, 14 Dec 2020 00:37:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42514) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kogF7-0007Gr-5W for qemu-devel@nongnu.org; Mon, 14 Dec 2020 00:17:53 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:40388) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kogF4-0007Lx-Hk for qemu-devel@nongnu.org; Mon, 14 Dec 2020 00:17:52 -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 0BE5EhQi007194; Mon, 14 Dec 2020 05:17:42 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 35cn9r3cjg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 14 Dec 2020 05:17:42 +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 0BE5AwxE162449; Mon, 14 Dec 2020 05:15:42 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3020.oracle.com with ESMTP id 35d7mpfg4y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Dec 2020 05:15:42 +0000 Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0BE5FeBW006632; Mon, 14 Dec 2020 05:15:40 GMT Received: from jaraman-bur-1.us.oracle.com (/10.152.33.39) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 13 Dec 2020 21:15:40 -0800 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 : in-reply-to : references; s=corp-2020-01-29; bh=NQrUtSHQ/SyjP9Lv7kgus4LkTCtsp1NGWGzWnNqtxWU=; b=DrSbafsR3jHG/E0fzTK1RupbFzLH+rT962sMQOPccmgVboZwxKzEBvfWNw60qx+1oVrW yiEcdJPRaWe0hWAdtxel63F756gUlWOJAVC7MdAzhEcGLmhglT8lBHp7B8aF0NPJfJpi hhpk8Q915n4aPW1oELx9QRwLaRQqkyZbPHToGoqlhvHcoR+bUiW6BXTl1o6jw1vYOJzc Q2CwQoUa+SIGp9ByNqQh8N/a34dw9s2hPdUhx90p/YQtKZjMpbX++8TeI2bJqrhi/vSl ouf4lJ9OZlEVjNSYTPyZFQJpzZWz3gf2RU+8gUxx0One8wct+WnnhOTY9OY5qLjQ8vDy cw== From: Jagannathan Raman To: qemu-devel@nongnu.org Subject: [PATCH v13 19/19] multi-process: perform device reset in the remote process Date: Mon, 14 Dec 2020 00:14:59 -0500 Message-Id: <06082cf4fe8ff46d941669a7bb8d8a3bb407bace.1607922214.git.jag.raman@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9834 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012140040 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9834 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 impostorscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 malwarescore=0 priorityscore=1501 phishscore=0 mlxscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012140040 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=156.151.31.86; envelope-from=jag.raman@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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=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: elena.ufimtseva@oracle.com, fam@euphon.net, swapnil.ingle@nutanix.com, john.g.johnson@oracle.com, kraxel@redhat.com, jag.raman@oracle.com, quintela@redhat.com, mst@redhat.com, armbru@redhat.com, kanth.ghatraju@oracle.com, felipe@nutanix.com, thuth@redhat.com, ehabkost@redhat.com, konrad.wilk@oracle.com, dgilbert@redhat.com, alex.williamson@redhat.com, stefanha@redhat.com, thanos.makatos@nutanix.com, kwolf@redhat.com, berrange@redhat.com, mreitz@redhat.com, ross.lagerwall@citrix.com, marcandre.lureau@gmail.com, pbonzini@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Elena Ufimtseva Perform device reset in the remote process when QEMU performs device reset. This is required to reset the internal state (like registers, etc...) of emulated devices Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman Reviewed-by: Stefan Hajnoczi --- include/hw/remote/mpqemu-link.h | 1 + hw/remote/message.c | 22 ++++++++++++++++++++++ hw/remote/proxy.c | 19 +++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/include/hw/remote/mpqemu-link.h b/include/hw/remote/mpqemu-lin= k.h index 0de995e..49dcad9 100644 --- a/include/hw/remote/mpqemu-link.h +++ b/include/hw/remote/mpqemu-link.h @@ -40,6 +40,7 @@ typedef enum { MPQEMU_CMD_BAR_WRITE, MPQEMU_CMD_BAR_READ, MPQEMU_CMD_SET_IRQFD, + MPQEMU_CMD_DEVICE_RESET, MPQEMU_CMD_MAX, } MPQemuCmd; =20 diff --git a/hw/remote/message.c b/hw/remote/message.c index 96ed11d..97e608e 100644 --- a/hw/remote/message.c +++ b/hw/remote/message.c @@ -19,6 +19,7 @@ #include "exec/memattrs.h" #include "hw/remote/memory.h" #include "hw/remote/iohub.h" +#include "sysemu/reset.h" =20 static void process_config_write(QIOChannel *ioc, PCIDevice *dev, MPQemuMsg *msg, Error **errp); @@ -26,6 +27,8 @@ static void process_config_read(QIOChannel *ioc, PCIDevic= e *dev, MPQemuMsg *msg, Error **errp); static void process_bar_write(QIOChannel *ioc, MPQemuMsg *msg, Error **err= p); static void process_bar_read(QIOChannel *ioc, MPQemuMsg *msg, Error **errp= ); +static void process_device_reset_msg(QIOChannel *ioc, PCIDevice *dev, + Error **errp); =20 void coroutine_fn mpqemu_remote_msg_loop_co(void *data) { @@ -69,6 +72,9 @@ void coroutine_fn mpqemu_remote_msg_loop_co(void *data) case MPQEMU_CMD_SET_IRQFD: process_set_irqfd_msg(pci_dev, &msg); break; + case MPQEMU_CMD_DEVICE_RESET: + process_device_reset_msg(com->ioc, pci_dev, &local_err); + break; default: error_setg(&local_err, "Unknown command (%d) received for device %s" @@ -206,3 +212,19 @@ fail: getpid()); } } + +static void process_device_reset_msg(QIOChannel *ioc, PCIDevice *dev, + Error **errp) +{ + DeviceClass *dc =3D DEVICE_GET_CLASS(dev); + DeviceState *s =3D DEVICE(dev); + MPQemuMsg ret =3D { 0 }; + + if (dc->reset) { + dc->reset(s); + } + + ret.cmd =3D MPQEMU_CMD_RET; + + mpqemu_msg_send(&ret, ioc, errp); +} diff --git a/hw/remote/proxy.c b/hw/remote/proxy.c index 7db9794..253a703 100644 --- a/hw/remote/proxy.c +++ b/hw/remote/proxy.c @@ -25,6 +25,7 @@ #include "util/event_notifier-posix.c" =20 static void probe_pci_info(PCIDevice *dev, Error **errp); +static void proxy_device_reset(DeviceState *dev); =20 static void proxy_intx_update(PCIDevice *pci_dev) { @@ -194,6 +195,8 @@ static void pci_proxy_dev_class_init(ObjectClass *klass= , void *data) k->config_read =3D pci_proxy_read_config; k->config_write =3D pci_proxy_write_config; =20 + dc->reset =3D proxy_device_reset; + device_class_set_props(dc, proxy_properties); } =20 @@ -350,3 +353,19 @@ static void probe_pci_info(PCIDevice *dev, Error **err= p) } } } + +static void proxy_device_reset(DeviceState *dev) +{ + PCIProxyDev *pdev =3D PCI_PROXY_DEV(dev); + MPQemuMsg msg =3D { 0 }; + Error *local_err =3D NULL; + + msg.cmd =3D MPQEMU_CMD_DEVICE_RESET; + msg.size =3D 0; + + mpqemu_msg_send_and_await_reply(&msg, pdev, &local_err); + if (local_err) { + error_report_err(local_err); + } + +} --=20 1.8.3.1