From nobody Mon Feb 9 21:29:31 2026 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=1601924592; cv=none; d=zohomail.com; s=zohoarc; b=lefIolkCD4UlToL8kzmwJrO6mOQfVx6wqKAkMXY3+4zehurR1mV4Za6EWvYeYXw1nktlNdXCU2LN5OlrGR5BVsZLNVEUSEBE2n0L4VavBHrV4keZ9OGMAvsOyJOlV+msqGdleSgisXEx1aTO2LL1LT+6uF73D5/5Af/cZEt/7WU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601924592; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=F56bvLYTO4rQ82quXFrq0H0xxB6A2M92PAv/VM0qrVg=; b=I7PTW5Jjlv5aTPHn4n7wQdtQAs3AOkqPsvYmI9h8lBbh1rUsAMf+L6QyhGGwtadXptIgEpuQZHJj0As5fKb8ZtHwnjzPGvWdanxLpVG2OPzVPSf7IR6Jc3tXgDltFUDwy4WnrDPMeTNM3S+brOPadqD6F5ZBqtR9JAB8o8QoAtw= 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 1601924592549604.542223305698; Mon, 5 Oct 2020 12:03:12 -0700 (PDT) Received: from localhost ([::1]:51382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPVlP-0001lA-8N for importer@patchew.org; Mon, 05 Oct 2020 15:03:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPVaB-0006eJ-Jv for qemu-devel@nongnu.org; Mon, 05 Oct 2020 14:51:35 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:56346) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPVa9-00083e-Ag for qemu-devel@nongnu.org; Mon, 05 Oct 2020 14:51:35 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 095InPjl184594; Mon, 5 Oct 2020 18:51:24 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 33xhxmq54r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 05 Oct 2020 18:51:24 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 095IpDj4182621; Mon, 5 Oct 2020 18:51:23 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 33y2vkvf5k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 05 Oct 2020 18:51:23 +0000 Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 095IpM6V005270; Mon, 5 Oct 2020 18:51:22 GMT Received: from flaka.hsd1.ca.comcast.net (/67.180.143.163) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 05 Oct 2020 11:51:22 -0700 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 : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=F56bvLYTO4rQ82quXFrq0H0xxB6A2M92PAv/VM0qrVg=; b=BO9cqe9anoJGtnvAI3lG34arvQ/9Q//1SvKRnPq6HBzDv3c5llJdSQMwz3gyY0yl23+N BhjQg9+hs82JdSPLTY8nt7ZW7mHmUjL5YGJAZeY6vCRhMUiDxRYqSzhL/3RZhhRnVHCA vASTyD6X3ZlPsrZSyp4y4pqovqSozqTuJad/NLPueWLtNxiDMmk1gH8p2UNaYeBRZGMX QhWI4w4LBu9d91FojauQagR3E7oAGO9cRnCe8FAErrOwepeXelVuEcPf7P+QbJILalMZ dFmZzcWGFk6M5pDma/J64PJIR/28bjOq7eKwh0oJF7PRu0Y8RA54G+oHOkkzrScF4oJ0 DQ== From: elena.ufimtseva@oracle.com To: qemu-devel@nongnu.org Subject: [PATCH v10 07/19] multi-process: Initialize message handler in remote device Date: Mon, 5 Oct 2020 11:50:55 -0700 Message-Id: <5d30e11c97869c7ae9ce6fd9c3318098ee8f23ec.1601923020.git.elena.ufimtseva@oracle.com> X-Mailer: git-send-email 2.25.GIT In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9765 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 malwarescore=0 suspectscore=1 spamscore=0 phishscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010050136 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9765 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=1 phishscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010050136 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.85; envelope-from=elena.ufimtseva@oracle.com; helo=userp2120.oracle.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 12:40:53 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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, stefanha@redhat.com, thanos.makatos@nutanix.com, rth@twiddle.net, 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) From: Jagannathan Raman Initializes the message handler function in the remote process. It is called whenever there's an event pending on QIOChannel that registers this function. Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman Reviewed-by: Stefan Hajnoczi --- MAINTAINERS | 1 + hw/i386/meson.build | 1 + hw/i386/remote-msg.c | 61 ++++++++++++++++++++++++++++++++++++++++ include/hw/i386/remote.h | 9 ++++++ 4 files changed, 72 insertions(+) create mode 100644 hw/i386/remote-msg.c diff --git a/MAINTAINERS b/MAINTAINERS index 1ca1f8ccff..9885c9499f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3047,6 +3047,7 @@ F: hw/i386/remote.c F: include/hw/i386/remote.h F: io/mpqemu-link.c F: include/io/mpqemu-link.h +F: hw/i386/remote-msg.c =20 Build and test automation ------------------------- diff --git a/hw/i386/meson.build b/hw/i386/meson.build index 1c1668c5db..238ae0879d 100644 --- a/hw/i386/meson.build +++ b/hw/i386/meson.build @@ -24,6 +24,7 @@ i386_ss.add(when: 'CONFIG_PC', if_true: files( 'acpi-build.c', 'port92.c')) i386_ss.add(when: 'CONFIG_MPQEMU', if_true: files('remote.c')) +i386_ss.add(when: 'CONFIG_MPQEMU', if_true: files('remote-msg.c')) =20 subdir('kvm') subdir('xen') diff --git a/hw/i386/remote-msg.c b/hw/i386/remote-msg.c new file mode 100644 index 0000000000..83fd7bd852 --- /dev/null +++ b/hw/i386/remote-msg.c @@ -0,0 +1,61 @@ +/* + * Copyright =C2=A9 2020 Oracle and/or its affiliates. + * + * This work is licensed under the terms of the GNU GPL-v2, version 2 or l= ater. + * + * See the COPYING file in the top-level directory. + * + */ + +#include "qemu/osdep.h" +#include "qemu-common.h" + +#include "hw/i386/remote.h" +#include "io/channel.h" +#include "io/mpqemu-link.h" +#include "qapi/error.h" +#include "sysemu/runstate.h" + +void coroutine_fn mpqemu_remote_msg_loop_co(void *data) +{ + RemoteCommDev *com =3D (RemoteCommDev *)data; + PCIDevice *pci_dev =3D NULL; + + pci_dev =3D com->dev; + for (;;) { + MPQemuMsg msg =3D {0}; + Error *local_err =3D NULL; + + if (!com->ioc) { + error_report("ERROR: No channel available"); + break; + } + mpqemu_msg_recv(&msg, com->ioc, &local_err); + if (local_err) { + error_report_err(local_err); + break; + } + + if (!mpqemu_msg_valid(&msg)) { + error_report("Received invalid message from proxy" + "in remote process pid=3D%d", getpid()); + break; + } + + switch (msg.cmd) { + default: + error_setg(&local_err, + "Unknown command (%d) received for device %s (pid= =3D%d)", + msg.cmd, DEVICE(pci_dev)->id, getpid()); + } + + if (local_err) { + error_report_err(local_err); + qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); + break; + } + } + qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); + + return; +} diff --git a/include/hw/i386/remote.h b/include/hw/i386/remote.h index 5b36b25ca1..e21bd5f68f 100644 --- a/include/hw/i386/remote.h +++ b/include/hw/i386/remote.h @@ -14,6 +14,7 @@ #include "qom/object.h" #include "hw/boards.h" #include "hw/pci-host/remote.h" +#include "io/channel.h" =20 typedef struct RemoteMachineState { MachineState parent_obj; @@ -21,8 +22,16 @@ typedef struct RemoteMachineState { RemotePCIHost *host; } RemoteMachineState; =20 +/* Used to pass to co-routine device and ioc. */ +typedef struct RemoteCommDev { + PCIDevice *dev; + QIOChannel *ioc; +} RemoteCommDev; + #define TYPE_REMOTE_MACHINE "remote-machine" #define REMOTE_MACHINE(obj) \ OBJECT_CHECK(RemoteMachineState, (obj), TYPE_REMOTE_MACHINE) =20 +void coroutine_fn mpqemu_remote_msg_loop_co(void *data); + #endif --=20 2.25.GIT