From nobody Wed Nov 27 11:52:45 2024 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1698655106; cv=none; d=zohomail.com; s=zohoarc; b=Q9aXVBnZ4Qasmhca40CzbGetgU1zAKgOz4U5F8APQZG21fQb78gNOgqEHQkDa6J5mkAfMG1BxzeJCFzVU27DsHkKhTMIgp+whTdlyg4wcnuyha7a1xALPAPt2QafZ0HlgM2LfRvCOUyMLQbT7aJAGmAUTCRgYubje62uu8XmOO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698655106; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vzmvmyVQ+oA867Qws9NF2zxwyLsLq34rfuCOG7/GxcY=; b=W1u64EhhkG8yA0uQfZ0A8yubrrNsu7A8l460hqxXofFSBzZBDFN6brzznqvXqpUQ9jfUbyliPMLyNllo47Y4ov0FRE70yJNef2zOYaRSR3NGgzeNvuPdFXGgeVpkCPlmzV/VeXNJ3cHjHD+gA88n64nyl180+Ci4ELpsGkKT/o0= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1698655106444798.1406796230078; Mon, 30 Oct 2023 01:38:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qxNlv-0005O0-22; Mon, 30 Oct 2023 04:37:20 -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 1qxNlr-0005NB-Ax for qemu-devel@nongnu.org; Mon, 30 Oct 2023 04:37:16 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qxNlo-0004F3-VE for qemu-devel@nongnu.org; Mon, 30 Oct 2023 04:37:15 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-9c5b313b3ffso621148966b.0 for ; Mon, 30 Oct 2023 01:37:10 -0700 (PDT) Received: from m1x-phil.lan ([176.170.212.50]) by smtp.gmail.com with ESMTPSA id b14-20020a1709062b4e00b00988e953a586sm5627636ejg.61.2023.10.30.01.37.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 30 Oct 2023 01:37:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698655029; x=1699259829; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vzmvmyVQ+oA867Qws9NF2zxwyLsLq34rfuCOG7/GxcY=; b=quAwy3hX86F6NqV1CcRde3wQdSkkVIsY3DYvNTACZxBcMqNctKAqvTc7UpKPspe+cB uYxV2qxYA1QCPWTJt69fjfjg6No4aUOBlI7t8T/wFKpleC3365kdoNAJwnLjiVM0SHZI 3B0/FvsghH8ieVs9Oa1bjZWEvzlEtCfu/4doJnGCiPNx8J2XgNOGgDN7AyHew2bcheBW /82aG2V2eTFYeWRjyyeIsDwrqAVklMvK37wDLOwysE3W6DqcEqo9Wz1/xspbSFSuCiwD tLATiP03tPJQ6L0xIIoXEkTH4ITgoutqvfdJq1EszQqtNwqB5oIHZy1Tefa/8Qpy1Tg2 l8xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698655029; x=1699259829; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vzmvmyVQ+oA867Qws9NF2zxwyLsLq34rfuCOG7/GxcY=; b=j3Sgx63zSs23U9XQu7O6vmU3GH2p1FWHHWD0O3Ay2KtwLz29LCbDZbOKh98Rt6ZAxd HhGxXC9Z4Pbn6NikAtFMp9Go1pNnBFURqYszAwwyqw5amYU7hT9klyF1lZqDJbj/UEfe sUl/xLQK3lPWbZbXpl8e7gj9rl6siasK+VhB+W4tBDWpRsTi0K0mxcpz5/RD1wjqiXNE YEKO+6o83JCfCwyo2XFBIYGo4XRFFPu+BN2tYba3kxlvHkhe2KrPDRn88ubBg8aBc2bf O0oa1VLKjfuJyzlP1vSPbvaF7GnjcYvNl5hoYgNcppGyDSxS8qVq3PyWdbeMbPGT0Cml 2Q8A== X-Gm-Message-State: AOJu0Yy+Bnn46o6b+J3v5g02VFMCgxvchaCUJJqA2KkE+2aG7pA/wu/H 5x4y3E/nPKTTDXEwq06QCPZNi7G2XnZxRJ+RHHc= X-Google-Smtp-Source: AGHT+IG2abL72UwnUo6mToooCAhy4BEMIUY6j2QPoQzFL4tIQKahNjpdZLbGv6L48o0+kOBxr25FYA== X-Received: by 2002:a17:907:7ba1:b0:9b7:37de:601a with SMTP id ne33-20020a1709077ba100b009b737de601amr8044179ejc.49.1698655029305; Mon, 30 Oct 2023 01:37:09 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH] hw/arm/pxa2xx_gpio: Pass CPU using QOM link property Date: Mon, 30 Oct 2023 09:37:05 +0100 Message-ID: <20231030083706.63685-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::62f; envelope-from=philmd@linaro.org; helo=mail-ej1-x62f.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=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1698655108238100001 Instead of passing the CPU index and resolving it, use a QOM link to directly pass the CPU. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/pxa2xx_gpio.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/arm/pxa2xx_gpio.c b/hw/arm/pxa2xx_gpio.c index e7c3d99224..c8db5e8e2b 100644 --- a/hw/arm/pxa2xx_gpio.c +++ b/hw/arm/pxa2xx_gpio.c @@ -32,7 +32,6 @@ struct PXA2xxGPIOInfo { MemoryRegion iomem; qemu_irq irq0, irq1, irqX; int lines; - int ncpu; ARMCPU *cpu; =20 /* XXX: GNU C vectors are more suitable */ @@ -266,12 +265,11 @@ static const MemoryRegionOps pxa_gpio_ops =3D { DeviceState *pxa2xx_gpio_init(hwaddr base, ARMCPU *cpu, DeviceState *pic, int lines) { - CPUState *cs =3D CPU(cpu); DeviceState *dev; =20 dev =3D qdev_new(TYPE_PXA2XX_GPIO); qdev_prop_set_int32(dev, "lines", lines); - qdev_prop_set_int32(dev, "ncpu", cs->cpu_index); + object_property_set_link(OBJECT(dev), "cpu", OBJECT(cpu), &error_abort= ); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); =20 sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); @@ -303,8 +301,6 @@ static void pxa2xx_gpio_realize(DeviceState *dev, Error= **errp) { PXA2xxGPIOInfo *s =3D PXA2XX_GPIO(dev); =20 - s->cpu =3D ARM_CPU(qemu_get_cpu(s->ncpu)); - qdev_init_gpio_in(dev, pxa2xx_gpio_set, s->lines); qdev_init_gpio_out(dev, s->handler, s->lines); } @@ -339,7 +335,7 @@ static const VMStateDescription vmstate_pxa2xx_gpio_reg= s =3D { =20 static Property pxa2xx_gpio_properties[] =3D { DEFINE_PROP_INT32("lines", PXA2xxGPIOInfo, lines, 0), - DEFINE_PROP_INT32("ncpu", PXA2xxGPIOInfo, ncpu, 0), + DEFINE_PROP_LINK("cpu", PXA2xxGPIOInfo, cpu, TYPE_ARM_CPU, ARMCPU *), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.41.0