From nobody Sun Apr 13 18:15:27 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612544661; cv=none; d=zohomail.com; s=zohoarc; b=jk7BbL7ROxpmO2nrFpLZx5Q7XAjb4kfG4PUaLHz3FooM+emz7VUyW2ew9thJN19/g8GaXfbFmNcJtoVRethDD47G+aSl2U7TQI/VLWrYnewes4Rl+JyOOGedLRHo2GYIy03uqQYBPlfZs/UnzvF64NMsc6akcz+rQ8FfYpcd9qQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612544661; 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=KMLyNEibZrrvvOgQKGmNjVmqHFUEKL29qF8ilAlWx1U=; b=E3Wl0TkOisqs1rZZx8Y0egFqsiDhsAFkh45ZhfnULOn4Xy3vxCGNK+5+kYUrZkXGy+AKWVNDqyLcEy2R4QppVTzMFuBY6GAncKZrE5eBziUL2R6l0JWtzgipwYKQjSQXucXZ6bstC5a7XWpGaTLQ/x5aCpVVXE5GMnkp9cPiMcY= 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 1612544661499201.85186054219014; Fri, 5 Feb 2021 09:04:21 -0800 (PST) Received: from localhost ([::1]:37788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l84Wn-0001Kw-Sx for importer@patchew.org; Fri, 05 Feb 2021 12:04:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42650) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l84GT-0002Nb-Ee for qemu-devel@nongnu.org; Fri, 05 Feb 2021 11:47:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:28703) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l84GQ-0006n9-R1 for qemu-devel@nongnu.org; Fri, 05 Feb 2021 11:47:25 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-374-w3tYPjflNyu5LC_lIjoKaA-1; Fri, 05 Feb 2021 11:47:18 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 64759107ACF3; Fri, 5 Feb 2021 16:47:16 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 116EF5D734; Fri, 5 Feb 2021 16:47:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612543642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KMLyNEibZrrvvOgQKGmNjVmqHFUEKL29qF8ilAlWx1U=; b=PjfE5ps+TZiFciIdYMdJfh+0qEuDzoVDJkR45GMKxzGRpQK2qOR37t1op3U3JyvsOb7Utt EHxFaZlpbDhwbg3T5TE/PCNpJSRDgfRkfXjny+C8/nHMq4GGrglEMQGT4soLty7y0KbFKI AdSAXkX6N7UixyzRmDRqVLbdXL0Usjw= X-MC-Unique: w3tYPjflNyu5LC_lIjoKaA-1 From: Stefan Hajnoczi To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL v3 12/27] multi-process: setup a machine object for remote device process Date: Fri, 5 Feb 2021 16:44:44 +0000 Message-Id: <20210205164459.432714-13-stefanha@redhat.com> In-Reply-To: <20210205164459.432714-1-stefanha@redhat.com> References: <20210205164459.432714-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=63.128.21.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.352, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: Fam Zheng , John G Johnson , Thomas Huth , Jagannathan Raman , Stefan Hajnoczi , qemu-block@nongnu.org, "Michael S. Tsirkin" , "Denis V. Lunev" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Elena Ufimtseva , Wainer dos Santos Moschetta , Igor Mammedov , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Jagannathan Raman x-remote-machine object sets up various subsystems of the remote device process. Instantiate PCI host bridge object and initialize RAM, IO & PCI memory regions. Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman Signed-off-by: Elena Ufimtseva Reviewed-by: Stefan Hajnoczi Message-id: c537f38d17f90453ca610c6b70cf3480274e0ba1.1611938319.git.jag.ram= an@oracle.com Signed-off-by: Stefan Hajnoczi --- MAINTAINERS | 2 ++ include/hw/pci-host/remote.h | 1 + include/hw/remote/machine.h | 27 ++++++++++++++ hw/remote/machine.c | 70 ++++++++++++++++++++++++++++++++++++ hw/meson.build | 1 + hw/remote/meson.build | 5 +++ 6 files changed, 106 insertions(+) create mode 100644 include/hw/remote/machine.h create mode 100644 hw/remote/machine.c create mode 100644 hw/remote/meson.build diff --git a/MAINTAINERS b/MAINTAINERS index 45e777bc55..45979452ed 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3203,6 +3203,8 @@ F: docs/devel/multi-process.rst F: docs/system/multi-process.rst F: hw/pci-host/remote.c F: include/hw/pci-host/remote.h +F: hw/remote/machine.c +F: include/hw/remote/machine.h =20 Build and test automation ------------------------- diff --git a/include/hw/pci-host/remote.h b/include/hw/pci-host/remote.h index 06b8a83a4b..3dcf6aa51d 100644 --- a/include/hw/pci-host/remote.h +++ b/include/hw/pci-host/remote.h @@ -24,6 +24,7 @@ struct RemotePCIHost { =20 MemoryRegion *mr_pci_mem; MemoryRegion *mr_sys_io; + MemoryRegion *mr_sys_mem; }; =20 #endif diff --git a/include/hw/remote/machine.h b/include/hw/remote/machine.h new file mode 100644 index 0000000000..bdfbca40b9 --- /dev/null +++ b/include/hw/remote/machine.h @@ -0,0 +1,27 @@ +/* + * Remote machine configuration + * + * Copyright =C2=A9 2018, 2021 Oracle and/or its affiliates. + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + * + */ + +#ifndef REMOTE_MACHINE_H +#define REMOTE_MACHINE_H + +#include "qom/object.h" +#include "hw/boards.h" +#include "hw/pci-host/remote.h" + +struct RemoteMachineState { + MachineState parent_obj; + + RemotePCIHost *host; +}; + +#define TYPE_REMOTE_MACHINE "x-remote-machine" +OBJECT_DECLARE_SIMPLE_TYPE(RemoteMachineState, REMOTE_MACHINE) + +#endif diff --git a/hw/remote/machine.c b/hw/remote/machine.c new file mode 100644 index 0000000000..9519a6c0a4 --- /dev/null +++ b/hw/remote/machine.c @@ -0,0 +1,70 @@ +/* + * Machine for remote device + * + * This machine type is used by the remote device process in multi-process + * QEMU. QEMU device models depend on parent busses, interrupt controller= s, + * memory regions, etc. The remote machine type offers this environment so + * that QEMU device models can be used as remote devices. + * + * Copyright =C2=A9 2018, 2021 Oracle and/or its affiliates. + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + * + */ + +#include "qemu/osdep.h" +#include "qemu-common.h" + +#include "hw/remote/machine.h" +#include "exec/address-spaces.h" +#include "exec/memory.h" +#include "qapi/error.h" + +static void remote_machine_init(MachineState *machine) +{ + MemoryRegion *system_memory, *system_io, *pci_memory; + RemoteMachineState *s =3D REMOTE_MACHINE(machine); + RemotePCIHost *rem_host; + + system_memory =3D get_system_memory(); + system_io =3D get_system_io(); + + pci_memory =3D g_new(MemoryRegion, 1); + memory_region_init(pci_memory, NULL, "pci", UINT64_MAX); + + rem_host =3D REMOTE_PCIHOST(qdev_new(TYPE_REMOTE_PCIHOST)); + + rem_host->mr_pci_mem =3D pci_memory; + rem_host->mr_sys_mem =3D system_memory; + rem_host->mr_sys_io =3D system_io; + + s->host =3D rem_host; + + object_property_add_child(OBJECT(s), "remote-pcihost", OBJECT(rem_host= )); + memory_region_add_subregion_overlap(system_memory, 0x0, pci_memory, -1= ); + + qdev_realize(DEVICE(rem_host), sysbus_get_default(), &error_fatal); +} + +static void remote_machine_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + + mc->init =3D remote_machine_init; + mc->desc =3D "Experimental remote machine"; +} + +static const TypeInfo remote_machine =3D { + .name =3D TYPE_REMOTE_MACHINE, + .parent =3D TYPE_MACHINE, + .instance_size =3D sizeof(RemoteMachineState), + .class_init =3D remote_machine_class_init, +}; + +static void remote_machine_register_types(void) +{ + type_register_static(&remote_machine); +} + +type_init(remote_machine_register_types); diff --git a/hw/meson.build b/hw/meson.build index 010de7219c..e615d72d4d 100644 --- a/hw/meson.build +++ b/hw/meson.build @@ -56,6 +56,7 @@ subdir('moxie') subdir('nios2') subdir('openrisc') subdir('ppc') +subdir('remote') subdir('riscv') subdir('rx') subdir('s390x') diff --git a/hw/remote/meson.build b/hw/remote/meson.build new file mode 100644 index 0000000000..197b038646 --- /dev/null +++ b/hw/remote/meson.build @@ -0,0 +1,5 @@ +remote_ss =3D ss.source_set() + +remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('machine.c')) + +softmmu_ss.add_all(when: 'CONFIG_MULTIPROCESS', if_true: remote_ss) --=20 2.29.2