From nobody Mon Feb 9 19:30:12 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=163.com ARC-Seal: i=1; a=rsa-sha256; t=1599583422; cv=none; d=zohomail.com; s=zohoarc; b=BmzkYBJESdmBK8FXlZA/jN4aBOcAE4mJNj7MoscCojn38Vh6ILDmUDzBqkIcuxFK/yNxVkQhhXABGyv47ntqD+BmKhVJx43WLewbGh6i535h+DImWYd0rKVhLcVMpl5kExLoyl4a6DjsjkHZHanv8hYN9J9ipH+jUfbdP01oBEI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599583422; 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=6o6Keb5oFii1iCN3xIh04mis0S3GAV4u9wS5ltt8Iao=; b=P9f16CvAZNOb3tEpi7MpUiIpzP80d5uKFN60AT3bJpi6SxnZRkdrG76Gff0sd0QDh61iAxWt4jusKIG33vB/spTaA4inSCBguUVD+L4YAEC0lsM2uOCzp/CIj2gMZDe5/epOW3CR5ZQmlwXvrThG+sTuSPde45rE8SXjga5+gyk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1599583422770265.7918350366897; Tue, 8 Sep 2020 09:43:42 -0700 (PDT) Received: from localhost ([::1]:49388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFgia-0008LA-NC for importer@patchew.org; Tue, 08 Sep 2020 12:43:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFghW-00075L-Mt for qemu-devel@nongnu.org; Tue, 08 Sep 2020 12:42:34 -0400 Received: from mail-m975.mail.163.com ([123.126.97.5]:49856) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kFghR-0002LP-GR for qemu-devel@nongnu.org; Tue, 08 Sep 2020 12:42:33 -0400 Received: from localhost.localdomain (unknown [183.158.94.209]) by smtp5 (Coremail) with SMTP id HdxpCgCnGRhetFdf9j7RJg--.1087S5; Wed, 09 Sep 2020 00:42:09 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=6o6Keb5oFii1iCN3xI h04mis0S3GAV4u9wS5ltt8Iao=; b=ev3Nk22JBi+5itTFJJn3QhYmJmo0HJvfgP 6vgZHfY5jEV/9efBYTNu7+xuAnbyG7Y4PNm/EhgzkMlGgZmRIULFsWyWnvbF7PNn OqpbowiwJfbAJ6+EvHg662BqDgWxOaT2AS3oREri7e56XMzATFFRMrx1eQk9iv7+ vzzPhJoHw= From: Li Qiang To: dmitry.fleytman@gmail.com, jasowang@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, berrange@redhat.com, ehabkost@redhat.com, alxndr@bu.edu, peter.maydell@linaro.org, f4bug@amsat.org Subject: [RFC 1/4] memory: add memory_region_init_io_with_dev interface Date: Tue, 8 Sep 2020 09:41:54 -0700 Message-Id: <20200908164157.47108-2-liq3ea@163.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200908164157.47108-1-liq3ea@163.com> References: <20200908164157.47108-1-liq3ea@163.com> X-CM-TRANSID: HdxpCgCnGRhetFdf9j7RJg--.1087S5 X-Coremail-Antispam: 1Uf129KBjvJXoW7ZrW8ZF1kur48Kr1DKw47CFg_yoW8CF1kpF 97uF9Ygr48tF9xZF1ftF4DWFyrA3y8K3W7Cr9rZwn2krs7tF9xArWUG345AryUCrWUX3W5 XFyUXr4fuan5J3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zRaYL9UUUUU= X-Originating-IP: [183.158.94.209] X-CM-SenderInfo: 5oltjvrd6rljoofrz/1tbiKQGZbVXlxmTITQAAsL 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=123.126.97.5; envelope-from=liq3ea@163.com; helo=mail-m975.mail.163.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 12:42:19 X-ACL-Warn: Detected OS = Linux 3.1-3.10 X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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: Li Qiang , liq3ea@gmail.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @163.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently the MR is not explicitly connecting with its device instead of a opaque. In most situation this opaque is the deivce but it is not an enforcement. This patch adds a DeviceState member of to MemoryRegion we will use it in later patch. Signed-off-by: Li Qiang --- include/exec/memory.h | 9 +++++++++ softmmu/memory.c | 15 +++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/exec/memory.h b/include/exec/memory.h index 0cfe987ab4..620fb12d9b 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -404,6 +404,7 @@ struct MemoryRegion { const char *name; unsigned ioeventfd_nb; MemoryRegionIoeventfd *ioeventfds; + DeviceState *dev; }; =20 struct IOMMUMemoryRegion { @@ -794,6 +795,14 @@ void memory_region_init_io(MemoryRegion *mr, const char *name, uint64_t size); =20 +void memory_region_init_io_with_dev(MemoryRegion *mr, + struct Object *owner, + const MemoryRegionOps *ops, + void *opaque, + const char *name, + uint64_t size, + DeviceState *dev); + /** * memory_region_init_ram_nomigrate: Initialize RAM memory region. Acces= ses * into the region will modify memory diff --git a/softmmu/memory.c b/softmmu/memory.c index 70b93104e8..2628c9d2d9 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -1490,6 +1490,21 @@ void memory_region_init_io(MemoryRegion *mr, mr->terminates =3D true; } =20 +void memory_region_init_io_with_dev(MemoryRegion *mr, + Object *owner, + const MemoryRegionOps *ops, + void *opaque, + const char *name, + uint64_t size, + DeviceState *dev) +{ + memory_region_init(mr, owner, name, size); + mr->ops =3D ops ? ops : &unassigned_mem_ops; + mr->opaque =3D opaque; + mr->terminates =3D true; + mr->dev =3D dev; +} + void memory_region_init_ram_nomigrate(MemoryRegion *mr, Object *owner, const char *name, --=20 2.17.1