From patchwork Thu Feb 15 17:57:35 2024 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: 772986 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp967940wre; Thu, 15 Feb 2024 10:06:40 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVftmAVfmswES7BeZR9L7+BN8zyDCoTuqcxRJZXqDe3G83zuX0gDOFl1dxBWvaFua8QYV13wloRLYn2WOWD7RNn X-Google-Smtp-Source: AGHT+IF2bs6uNptpkZosT86pTEWaO4iws551KzJAywqBmkVcZhQKHPw8xbU7ypzAM1g5O6pnC/N/ X-Received: by 2002:a05:6122:1783:b0:4c0:703e:766a with SMTP id o3-20020a056122178300b004c0703e766amr2964764vkf.14.1708020400065; Thu, 15 Feb 2024 10:06:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708020400; cv=none; d=google.com; s=arc-20160816; b=SHPJsIXc3HDfcKLZx16lWklpSiwNisJ2r7HI7Id0RASFFJ8lN0h0fq2u/RuvtHPStt hPceeZHeJylXmczw6sD/IzRRYdwhB3MlTxA6sgdwvz5Ed2n0MoiEHAKD2ZNzlWbX8AOu v1W81zjIlWKLDAA0YVRXBJ08bUZmgOy2z3Hqa176np3A4y1RJezdqHUGigU0DQGRhlwb gsc5BvqciVF+J37b2rUBo+ENI5cousWbb2bXrDR9UW9r5LZIaIqMtA+FFIgEaTJnDPwl bU9m70TMfvPAYoJ8GeQEv4Dm1BiALMt9HHgQJxBH5x+MUszAf134gpadyQlsUZRrY/Ff loDA== 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=BcKvmadiGqmKN7g4qDe2Hjh8lZOAnNypphJxj7H8q5A=; fh=V5JxqqyEY4b6dWxOweC8AEAagDbUoTdezTJaVAV4tao=; b=Xr9afm1Tu6yOPm0+EPjELv4NgyN8xGlEgazkkF2AUBz/lSxfKitS1hX6I7JMBPG++z birWrMy7hEHNKeoHaaHwUt9P5Ppo70FLZDn6WTNZ1BVeJc7HoiQZV9j/98SE+ip3Nq4v iL6GhVfLcAZVwMFXjoC+fW/GxUEiB5FRdNStSQKG1k211kVl/BmVICAF9mh+PvPcE4Hg QirfuY/L1RbPxLIpDQ5kYd0zpoxsULcWvxXn62xa4vZiXjeTlVByV9FS8vRSB1bEZFA4 ImuRt7g626N8iu8kTALhR+Gz/pLB1KM9JkTBlk4SHID545kDl4q1MtnXeo4tBszu3Du3 bFwg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f7paDpRx; 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 er5-20020a0561221b0500b004c03da3dbd4si428980vkb.276.2024.02.15.10.06.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Feb 2024 10:06:40 -0800 (PST) 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=f7paDpRx; 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 1rag4G-0006OL-U3; Thu, 15 Feb 2024 13:02:41 -0500 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 1rag4E-00064L-Bv for qemu-devel@nongnu.org; Thu, 15 Feb 2024 13:02:38 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rag49-0002sb-Nt for qemu-devel@nongnu.org; Thu, 15 Feb 2024 13:02:37 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-41211acfcfcso8437415e9.1 for ; Thu, 15 Feb 2024 10:02:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708020152; x=1708624952; 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=BcKvmadiGqmKN7g4qDe2Hjh8lZOAnNypphJxj7H8q5A=; b=f7paDpRxU1W1Jbr75o5aM8O4/n5UDydhEZasjhjNWqtb7lz1chLYUm7K7QI/6ejPpz VRmumpTnBw7L2BdwRE9scqyUQYX+J0ukicKE6hjoRrj6LV2sOn2Zj1w72x79X5o9/iBg JSUAz+gMVK5nol2asEY/l9DFuSsgJ4plcG5rvCNO69bGeoFI0Bf0RvMzV2xha7tcuP+I IswZnVMYWqKcroxeeu3uuTT2Lsr2faz/Kkqcsxp71L7UlQ7ZpbyzChNyPzd2zEKk2dLM qXedxhHGdtSXJLMH0jiYgDt6icq3IKgxHoDh+7ISkktT8r7FIFqLX1IT1dUYKxBx+EOY zIPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708020152; x=1708624952; 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=BcKvmadiGqmKN7g4qDe2Hjh8lZOAnNypphJxj7H8q5A=; b=RJEvzjTKuC7IMNiJJOU+JHjffqP1ivDBW4OqRREIss6LpysJbJtWagDsdL/cuLSElh Rlw0I5JSFZfFK5Q8SklXdRJqp45WOp6BZjssVc7MdDf/A6mGARfAiJXhJXIJ64nBYdW9 yDVD2H1ysJNFITFERphQPNKzvRshMWqeLr3kkzj2xdwdGjVe+lodgdLJeyT4gm+eUyH2 7RT1MndhJV9NP1W7RM1A4/w1GOrs6v4YzJcYWjeFCoW6n+bc1HUT0jg6VfeYIZDcrOVn SNEg4NHu/6HEOpBIKO+UrUcUUsh7s8V4d7ZQjmsRcyIJDFMEQcfW2bmgclIms2fBn+fa 83YQ== X-Gm-Message-State: AOJu0YynoCDzKpklWUYzTLzGhPNObTd0SADZHIUHvQZL4J9X8c7WMPIo bpPZbjT8YYvZXpaunQ7lqRhlxvcn+RWc2s7Da6ET4KVLSoSZrqpU45AqXS0WHZpIMBjxjHWiWsp EURY= X-Received: by 2002:adf:fe86:0:b0:33c:f638:ed0b with SMTP id l6-20020adffe86000000b0033cf638ed0bmr2208959wrr.8.1708020151951; Thu, 15 Feb 2024 10:02:31 -0800 (PST) Received: from m1x-phil.lan ([176.187.193.50]) by smtp.gmail.com with ESMTPSA id n5-20020adffe05000000b0033b47ee01f1sm2432289wrr.49.2024.02.15.10.02.27 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 15 Feb 2024 10:02:29 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Mark Cave-Ayland , =?utf-8?q?Cl=C3=A9ment_Ch?= =?utf-8?q?igot?= , Frederic Konrad , Artyom Tarasenko Subject: [PULL 41/56] hw/sparc/leon3: Pass DeviceState opaque argument to leon3_set_pil_in() Date: Thu, 15 Feb 2024 18:57:35 +0100 Message-ID: <20240215175752.82828-42-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240215175752.82828-1-philmd@linaro.org> References: <20240215175752.82828-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.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 By passing a DeviceState context to a QDev IRQ handler, we can simplify and use qdev_init_gpio_in_named() instead of qdev_init_gpio_in_named_with_opaque(). Suggested-by: Mark Cave-Ayland Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Mark Cave-Ayland Message-Id: <20240215144623.76233-2-philmd@linaro.org> --- hw/sparc/leon3.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index bea84f3ad6..a15f90e142 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -202,9 +202,10 @@ static void leon3_irq_ack(CPUSPARCState *env, int intno) */ static void leon3_set_pil_in(void *opaque, int n, int level) { - CPUSPARCState *env = opaque; + DeviceState *cpu = opaque; + CPUState *cs = CPU(cpu); + CPUSPARCState *env = cpu_env(cs); uint32_t pil_in = level; - CPUState *cs; assert(env != NULL); @@ -220,7 +221,6 @@ static void leon3_set_pil_in(void *opaque, int n, int level) env->interrupt_index = TT_EXTINT | i; if (old_interrupt != env->interrupt_index) { - cs = env_cpu(env); trace_leon3_set_irq(i); cpu_interrupt(cs, CPU_INTERRUPT_HARD); } @@ -228,7 +228,6 @@ static void leon3_set_pil_in(void *opaque, int n, int level) } } } else if (!env->pil_in && (env->interrupt_index & ~15) == TT_EXTINT) { - cs = env_cpu(env); trace_leon3_reset_irq(env->interrupt_index & 15); env->interrupt_index = 0; cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); @@ -316,8 +315,7 @@ static void leon3_generic_hw_init(MachineState *machine) qdev_connect_gpio_out_named(irqmpdev, "grlib-start-cpu", i, qdev_get_gpio_in_named(DEVICE(cpu), "start_cpu", 0)); - qdev_init_gpio_in_named_with_opaque(DEVICE(cpu), leon3_set_pil_in, - env, "pil", 1); + qdev_init_gpio_in_named(DEVICE(cpu), leon3_set_pil_in, "pil", 1); qdev_connect_gpio_out_named(irqmpdev, "grlib-irq", i, qdev_get_gpio_in_named(DEVICE(cpu), "pil", 0));