From patchwork Fri Feb 21 17:30:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11397013 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DBB9E14BC for ; Fri, 21 Feb 2020 17:32:56 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id B2C72222C4 for ; Fri, 21 Feb 2020 17:32:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CVqh4gPK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B2C72222C4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5CAZ-0008Ov-Te for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Feb 2020 12:32:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38051) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5C8m-00065x-Va for qemu-devel@nongnu.org; Fri, 21 Feb 2020 12:31:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j5C8l-0007yi-UR for qemu-devel@nongnu.org; Fri, 21 Feb 2020 12:31:04 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:22650 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j5C8l-0007yM-Pm for qemu-devel@nongnu.org; Fri, 21 Feb 2020 12:31:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582306263; 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=l2pPJB7dVv53xB+pM6ByHDe1JdpbC3cSQ0yop2iaXBM=; b=CVqh4gPK64BU+2r+AAn8/4KtAaYQxnGvkFzRzYr493HlwxZo8GAu90IuE5vfPcpZTX0Mlh 1AxG40C5D6l9w0RoICfJe6YmDDJ86jETpLbq213KBwlPtWz78FIT++1pHiNXowUe3VXGsQ h3bvkOpam5KpAJyli08nA8GEwwTaBdc= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-157-xiPfrd_HMey2i75zoVhZIg-1; Fri, 21 Feb 2020 12:31:01 -0500 X-MC-Unique: xiPfrd_HMey2i75zoVhZIg-1 Received: by mail-wm1-f69.google.com with SMTP id f207so854794wme.6 for ; Fri, 21 Feb 2020 09:31:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1tNyRzGC0EsXOg8ox9ROXwfpcEcBwuRdTCHdqcdRxTY=; b=KUP0Y3wRDw2bKfJjWOMPOtHNTW3nxCMsKEzUbpK2zQeGDf33YCIT4ivapzMXOxfYwG 11vJ8yD1jIQu1adozGMvu+8K35ev0+HDQYxGf6XmXKTjjH5Rr+FPi1VYkf8bRMMK6hi4 VKBfTQlAoo9hWcZS/gad8DX7ZYcH8go8wtikCaPox5+Bdz++yRvv+RXUeKdebyh+pXCU jGnyCpyPHGGbTpFsM7u923BgB82QdS/sS6OhAbor0I881RnxJTD14ML3O/qt8nFTdVKN t+jfETsQfBebCwr2YxCazam3n0N4Sd3hC33jeBEgTYmUhpklUgimaI3q0WyLdCsQnR+Z GEgg== X-Gm-Message-State: APjAAAU3qpfHY6dnlumdGEru1XK+6JEGHyRWCpxVfP4D+O7nuDamp+M4 Q1aDDf6yjGQRJcAyPz1woDfC4wL0W/Ku7yIMU8ZBI0S7X+HkMRdVWxjj4gmkwMqEDeZ3SO6GUMi reGvHIYDfPagRc6c= X-Received: by 2002:adf:f091:: with SMTP id n17mr48035246wro.387.1582306260616; Fri, 21 Feb 2020 09:31:00 -0800 (PST) X-Google-Smtp-Source: APXvYqxAW+qR5XRP7uwi7KWjtLc+Ik1gy311YfEvXAKKV0p8ZnHFE0EazAPFpnBibOLVdwTqQTE/UQ== X-Received: by 2002:adf:f091:: with SMTP id n17mr48035215wro.387.1582306260447; Fri, 21 Feb 2020 09:31:00 -0800 (PST) Received: from x1w.redhat.com (78.red-88-21-202.staticip.rima-tde.net. [88.21.202.78]) by smtp.gmail.com with ESMTPSA id h18sm5000871wrv.78.2020.02.21.09.30.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 09:30:59 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 4/7] hw/core: Let devices own the MemoryRegion they create Date: Fri, 21 Feb 2020 18:30:46 +0100 Message-Id: <20200221173049.18134-5-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200221173049.18134-1-philmd@redhat.com> References: <20200221173049.18134-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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: Peter Maydell , Sagar Karandikar , "Michael S. Tsirkin" , Mark Cave-Ayland , Alistair Francis , "Edgar E. Iglesias" , Jean-Christophe Dubois , =?utf-8?q?Herv=C3=A9_Poussine?= =?utf-8?q?au?= , Joel Stanley , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Aleksandar Rikalo , =?utf-8?q?Philippe_Mathieu?= =?utf-8?q?-Daud=C3=A9?= , Alistair Francis , qemu-arm@nongnu.org, Peter Chubb , qemu-riscv@nongnu.org, Igor Mitsyanko , Bastian Koppelmann , Laurent Vivier , Subbaraya Sundeep , Palmer Dabbelt , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" To avoid orphean memory regions being added in the /unattached QOM container, use the memory_region_owner_nonnull.cocci script to set the correct ownership. Signed-off-by: Philippe Mathieu-Daudé --- hw/core/platform-bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/core/platform-bus.c b/hw/core/platform-bus.c index 22c5f76dd0..d494e5cec1 100644 --- a/hw/core/platform-bus.c +++ b/hw/core/platform-bus.c @@ -187,7 +187,8 @@ static void platform_bus_realize(DeviceState *dev, Error **errp) d = SYS_BUS_DEVICE(dev); pbus = PLATFORM_BUS_DEVICE(dev); - memory_region_init(&pbus->mmio, NULL, "platform bus", pbus->mmio_size); + memory_region_init(&pbus->mmio, OBJECT(dev), "platform bus", + pbus->mmio_size); sysbus_init_mmio(d, &pbus->mmio); pbus->used_irqs = bitmap_new(pbus->num_irqs);