From patchwork Wed Oct 18 13:12:19 2023 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: 735049 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp986075wro; Wed, 18 Oct 2023 06:16:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE0OGfuKRISKe+f/0oA6tgtDFqUSrPMiEMOd5F3jSThWNNMjPuR7WAlnVrZnkWCK0hL+Sam X-Received: by 2002:a05:6214:2686:b0:66d:55d9:bc7b with SMTP id gm6-20020a056214268600b0066d55d9bc7bmr7276684qvb.31.1697634976818; Wed, 18 Oct 2023 06:16:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697634976; cv=none; d=google.com; s=arc-20160816; b=Koq6khV3BB+R9q8zCOPlbcd/PuF11qOkoYSLr8aRJIxAigP2CEpO32Cr49R+OlqNtV 2TD4jmiEO+nheUe5W6HHLEuc4WJOsQNIdh0+qphNXQ7xONIVEKF15NRL1p9w5RIpiENH rEyde4cc8c45B+Zb3I+e32/f+BADUfQnCVNOTKFGn2TjTegum9nljhwcVYMQWaIqCJhM rVoNcZzyNb6QGlwdvpKSHuid6UFjutMDVnPzVMBCJsyWVGwQT4+x54NnJwq4Kxcq33xn Irx1hHNApEAmtEOTiJir3Z8zz3EwHBCFe5B2DJyrSy6o2z25+O1FrAiPkmL8QN/sm+Vc 0uxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RG5zLlWN/LC4pJbPVJoFLnGQz4i0tpH2bVvTXsYTeOI=; fh=Uq4CCH4qgIScoA1ZlzK6h1LD8Rw6xac8JtYTs6G5zlc=; b=oS0Tdi8v/0vfxp6XriqOR0ruq7KqKsmDL/1eXZSjvOzx3bEIja3PJc0HepZmjCLfha G0zdYQQ7z2CCeljf2GHDsFLPFeFFjf0fMMFQh10lIuTyx47wmvMu0MhVUAdQ2gztbu/K I7HnH22YNz6CdPYa3Rc31F62XV8SyE933yhIWytuRoSjyNYp6YzG4X3mwp2JYv6HZvZQ zczUKLVwuXOzii3cCep0LvYB/NMTHDbho5C2Og4sHIUwe+Pn1vFzEnEjmo2Jh+GSlI/B 5mtCl5hB3l1Ufvq/w1s/7sH6UNrz+Y5htNrwy6JQqbSWB77N1w6LncHjhhtNSBmYo7Bv z+oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y40qUJps; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 3-20020a0562140dc300b00656304f4f1esi2914869qvt.421.2023.10.18.06.16.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2023 06:16:16 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y40qUJps; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt6MY-0007hN-DY; Wed, 18 Oct 2023 09:13:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt6MH-0007Vy-G0 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 09:13:09 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt6MF-0000np-Gw for qemu-devel@nongnu.org; Wed, 18 Oct 2023 09:13:08 -0400 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-9bf0ac97fdeso629287966b.2 for ; Wed, 18 Oct 2023 06:13:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697634785; x=1698239585; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RG5zLlWN/LC4pJbPVJoFLnGQz4i0tpH2bVvTXsYTeOI=; b=Y40qUJpsJNbgIx7vMG4lVxRCHty9Ljn6M0yZK+HaEQAypC8qhPzq1UluE9H4t36JLD UOJa/+4sBIZCtt5jYosk+zkz6jlPq24GUzna2iYVu8RXY6L9c3QoSFLtbXvPdhq3k+aw lV1J1cKXn2OTzQeTlcL4ZuHi83Hj3d31zTOQ4nRhU+rGIzCSOCQ0yavFDcxG4ZSPiZKH Sua1K6hqVJ3K9cTo9Tb/dcXyyuzO0eQVXZGe8872SBrBA52Gt71RipA+tW9iFJ5rEK4j o9PpXBmNrZqg01gFK1i5CJN8AYbeoutckxjNJ6axNOuc8vrwT6IMvQI4XRWuVUUg2Afz cexg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697634785; x=1698239585; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RG5zLlWN/LC4pJbPVJoFLnGQz4i0tpH2bVvTXsYTeOI=; b=p+134V6PbtO2i7D0uHQjl5WWHwHI77mquGgghulbY4sYXg176QbjwqRywWgh7EtZ2C hbvoyv0oU/dhfJk2LXvpTGccYGAzvOI8/Lz8+PxvLHvEgYAe00ZpugcZ9vwUeotSmvEs K8jM13E6gmTtXmpVg133pVX6Rjsxi6Fq6eGRrd078/rjiNd37hYYhw52Yu86jm4ZZYAq w2V/WeYQkdD5NiipjradPApUY25hFxyAXYj6fu7CTkMKMdjXi68LvQGvMK3vT5QGHyTR F8ldSEg5Rrw+h59uNIKbUXjQsl74dDmpFDTRUpnA+fW/gYcHl2Zvf/Srr7I6aZfNCUxd bC9w== X-Gm-Message-State: AOJu0Yy2foVQzydRSi3Tgj+0w2YvnmiepXh5zmeKkCepXmKAs+hUZo9w ZkSwibZzJEdYHA0HiqRVIeE94zPipJcoa6yyrWA= X-Received: by 2002:a17:907:d48d:b0:9c6:7ec2:e129 with SMTP id vj13-20020a170907d48d00b009c67ec2e129mr2603043ejc.42.1697634784797; Wed, 18 Oct 2023 06:13:04 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id z6-20020a17090674c600b00992e14af9c3sm1686110ejl.143.2023.10.18.06.13.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 06:13:04 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 7/8] hw/intc/pxa2xx: Pass CPU reference using QOM link property Date: Wed, 18 Oct 2023 15:12:19 +0200 Message-ID: <20231018131220.84380-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018131220.84380-1-philmd@linaro.org> References: <20231018131220.84380-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=philmd@linaro.org; helo=mail-ej1-x636.google.com 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, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org QOM objects shouldn't access each other internals fields except using the QOM API. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/pxa2xx_pic.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c index 2eb869a605..7e180635c2 100644 --- a/hw/arm/pxa2xx_pic.c +++ b/hw/arm/pxa2xx_pic.c @@ -15,6 +15,7 @@ #include "cpu.h" #include "hw/arm/pxa.h" #include "hw/sysbus.h" +#include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "qom/object.h" #include "target/arm/cpregs.h" @@ -288,7 +289,8 @@ DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) DeviceState *dev = qdev_new(TYPE_PXA2XX_PIC); PXA2xxPICState *s = PXA2XX_PIC(dev); - s->cpu = cpu; + object_property_set_link(OBJECT(dev), "arm-cpu", + OBJECT(cpu), &error_abort); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); @@ -321,11 +323,18 @@ static const VMStateDescription vmstate_pxa2xx_pic_regs = { }, }; +static Property pxa2xx_pic_properties[] = { + DEFINE_PROP_LINK("arm-cpu", PXA2xxPICState, cpu, + TYPE_ARM_CPU, ARMCPU *), + DEFINE_PROP_END_OF_LIST(), +}; + static void pxa2xx_pic_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); ResettableClass *rc = RESETTABLE_CLASS(klass); + device_class_set_props(dc, pxa2xx_pic_properties); dc->desc = "PXA2xx PIC"; dc->vmsd = &vmstate_pxa2xx_pic_regs; rc->phases.hold = pxa2xx_pic_reset_hold;