From patchwork Thu Nov 2 17:38:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740447 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp961400wrv; Thu, 2 Nov 2023 10:39:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6kkyixURu2ptmPTg4uIAhB3IWvjFwP2tRNgZpGn+gtvR9M+6Znj3xIC/o1oarHm6CKzn6 X-Received: by 2002:a05:620a:24d4:b0:773:fa62:39fe with SMTP id m20-20020a05620a24d400b00773fa6239femr334979qkn.1.1698946777117; Thu, 02 Nov 2023 10:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946777; cv=none; d=google.com; s=arc-20160816; b=J25IrOAffLekSlK+sdrD51Zet+itneurtfiXkrbLTTvBT0dJG7+gsmgeSGedgKeB9v +We7OylaQmtw6au4y0ZJK0wNqy7VR6ChyXN77GCLVz+BNFG3MzN4RjmdNPxairJaO0lD yEfEfDGDNJiK3+vI5EH3tPlnwk6ZgAVg78ZO9pwaa+EW1lBbYwyWKyq1wrCyAM46Ic2S FzDnZdOJg0hszOLl6VGZMOpEovR70oKBUVIAlBqjXhR/lZkIwTci4gmqIsKjP/3YN5BC xT5d7qLLaMqfAVlT3mOV5gJMdTWC7bST+T+q1fLueeEaEn/xyBA67T9DD9ujryeo18+f 8f9Q== 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:to:from :dkim-signature; bh=uKA7bn5x9XExQ1qcDE6U/Plr8Mt6ZUx9Ro4D4g9gp3I=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=T8s2r3Y3rMjhA9VjT/2LOCGcmSd6MwB4ytvLeZ3eiy/C+2k0Hrjh2eMcA8tzYRZLLF P2RFRbYEjxg22RSis/KKO/ZCbPJWqpkiXvLew9bCEHLaOQQh0QSU94OEKXPofxWStjKQ 7RpkgM0HWs0Bpd2EXn989vEQetf665fuWIDj0oA1nIsrG1aE4rXQZcnrwbQLj47bebGF HsIkL3CyLFaQf4Etw0CV12Vd6mWZRwFT8W3zBwFZQKW8ODQvwKdAIN0WuTky7qvfXVHN s8jP3wqcQvlotL+uSU7kz2aMP37OMTiPmX1tJOZJX0s3rAT7HAuShpClrGThYlPbESi2 0ZSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iKH9OZij; 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 qs19-20020a05620a395300b00767cc0f9316si292249qkn.289.2023.11.02.10.39.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:39:37 -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=iKH9OZij; 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 1qybf9-0003Ow-5r; Thu, 02 Nov 2023 13:39:27 -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 1qybef-0003FN-Jh for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:53 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybea-0002l8-1S for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:52 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40859c466efso8808465e9.3 for ; Thu, 02 Nov 2023 10:38:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946726; x=1699551526; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=uKA7bn5x9XExQ1qcDE6U/Plr8Mt6ZUx9Ro4D4g9gp3I=; b=iKH9OZijOU6qzxIy9L2zPGBID+Tu58jVZ/PtVAoKj8qxhBM28cUWoH/O5qS7lcbjho 8O9IxISmICpvnNniQXeeo4IwGTj+NkWbj98aOAgBzMSQJZfF9T04KILveajNEfpEjjol T3Fo1usA7hrs5ymHeubWRxjfzGMJPJ8qsgRd+4dk0/EOlFSD8CXj+StrAwk4rnxpLnrZ zjqBWOTEMxL+iB2nYcuoQloN5aLxFGglGlMVlyoapvZMMV2GfPNth48u56Lq/QWzilcZ DCrO29z5pXrI32qGF5BYUmFBQ65KmqaeYbi7XCje0XMLCGi3wOYtUO25aHsgXVzdiHc7 GSLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946726; x=1699551526; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uKA7bn5x9XExQ1qcDE6U/Plr8Mt6ZUx9Ro4D4g9gp3I=; b=LBiR+Pn5Er1fwclT7aYlvDPDNX/Q47x9pwuEHohxILudNp0ypqf3/sU8t3Q+lQ3aJ1 SngQxjIa02lwClM9T6f0h1TLAf6avu0lSgCaThYa6pk+0UH2rMBckjifdp3VbAeibLOR I2x6u+ix1ZkPh/nbpbXb/x0QAhU62iPz1SGix0ttOJQ6H9zXUn7UtIlKuixj31CWeZMb uNylWOOJj/MmUIgezWprl/7/OyFm0B/RY16xpxAeNmbr/Sj0c3DlwjNwf/lr6BUluLj8 RaoxjDaapJlvvF4hSfbpveauA5u3oEnNThrLC/s8V1ykEC8WL8nrQuoAKdZdnNDvai+l HNuQ== X-Gm-Message-State: AOJu0YzfJtRtamrHFmJwC+WUmEY8riC8M0U4u6SFUPR8QIH1AhP/dQnu IrcSm496gEOfH4+joc4Zy3AwpB7C15pIC/yFUos= X-Received: by 2002:a5d:64c8:0:b0:32f:9977:eefd with SMTP id f8-20020a5d64c8000000b0032f9977eefdmr6914028wri.42.1698946726702; Thu, 02 Nov 2023 10:38:46 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:46 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/33] hw/arm/pxa2xx_gpio: Pass CPU using QOM link property Date: Thu, 2 Nov 2023 17:38:19 +0000 Message-Id: <20231102173835.609985-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Philippe Mathieu-Daudé Instead of passing the CPU index and resolving it, use a QOM link to directly pass the CPU. Signed-off-by: Philippe Mathieu-Daudé Message-id: 20231030083706.63685-1-philmd@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- 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 e7c3d99224a..c8db5e8e2b7 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; /* XXX: GNU C vectors are more suitable */ @@ -266,12 +265,11 @@ static const MemoryRegionOps pxa_gpio_ops = { DeviceState *pxa2xx_gpio_init(hwaddr base, ARMCPU *cpu, DeviceState *pic, int lines) { - CPUState *cs = CPU(cpu); DeviceState *dev; dev = 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); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); @@ -303,8 +301,6 @@ static void pxa2xx_gpio_realize(DeviceState *dev, Error **errp) { PXA2xxGPIOInfo *s = PXA2XX_GPIO(dev); - s->cpu = 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_regs = { static Property pxa2xx_gpio_properties[] = { 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(), };