From patchwork Thu Feb 15 14:46:20 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: 772902 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp866632wre; Thu, 15 Feb 2024 06:47:26 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVqPRTtl24t0237bf9VlpvMnyIdaoi5YIff0AZthqS4MBQVm1R4dSSYl2yX2UK4sG09QDGmuHVC3WU/9BLij/86 X-Google-Smtp-Source: AGHT+IEz2d0YyFkgVIM+GAmDJQf+FP8h+bEZpKp16gvW+VBoCH9h/cL/1RJK0LiOqLWlQktEet7M X-Received: by 2002:a05:620a:16b3:b0:785:d5a8:ad74 with SMTP id s19-20020a05620a16b300b00785d5a8ad74mr2000322qkj.72.1708008446249; Thu, 15 Feb 2024 06:47:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708008446; cv=none; d=google.com; s=arc-20160816; b=O/SWPnnl7ck/UZSJLxaeyU6XiEoLSKrz8ixpN0Lci2BrdFVp2LMdF/vpxVeox1zbCr xVOeDWfl4bKROd93Bu4DAnjAYsEH/mwRz2c7NXV50EIowPWSLMXuEoq/iU06jOlQI7Pl C2JHyO9DEScb05C0V6mfYw4XaJJ55d39RFzWCSebSR6vzkSegIMQNaKVYQja90zrSm06 tXSmb4GNSzDaJjovWUUtcg8dXUJ+qw6AdntXABAhpPAU+bJszHCuaYp2GjmR7GIaCf5K JL0A2lYlZW7/gA9UxY/pFGB7zIsfxIBe7n5ZoHgYYTQy9uwh8tKPiIsf+G2QhTLI/8FQ nBKw== 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=OUfNPLmItBjPVQVkIuFZlyu1sOPgu8JxvvGpQGChzxE=; fh=vKL7DoExp4lE8whkmUTvP6IrGDB6wJ9Hzl8dHrUtro4=; b=SjpjLSildSTa9vfNlmn3+sh/b+Tf5KtAgMO082N84tJC3xbORaTeQ0u2daztjJSzH/ rC4D9mX2TJyJGoRIJD1+63ZBkb5p5VRG29nVc6ggDTs2e5wt4HhJ2jqWFpMADqv+XbJi XR5ThR5jrU+KNveA6iM54FK+mj01QZ3FEHVEVvQcOG0ArV7YCph3mwoy3tDKERHN3rxs v4mQ8xhY19/Qxy62PW7U7VnlTRd4S2jpuFqAIqz8vH+LeRL0T++XwXl7PRaCuvvZkdQj r44bwqpGOU5hV9PWXpaBntcRO1IoXrNKz3SId8IyFjeSPf2ry9EKCUgDPT8IbH5mp3gL XHYA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MGm3er0M; 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 vu16-20020a05620a561000b007871dbff708si1479482qkn.584.2024.02.15.06.47.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Feb 2024 06:47:26 -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=MGm3er0M; 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 1rad0h-0006mC-PX; Thu, 15 Feb 2024 09:46:47 -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 1rad0U-0006gu-6e for qemu-devel@nongnu.org; Thu, 15 Feb 2024 09:46:34 -0500 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rad0S-00072F-JQ for qemu-devel@nongnu.org; Thu, 15 Feb 2024 09:46:33 -0500 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-563d017696eso233115a12.0 for ; Thu, 15 Feb 2024 06:46:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708008391; x=1708613191; 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=OUfNPLmItBjPVQVkIuFZlyu1sOPgu8JxvvGpQGChzxE=; b=MGm3er0MwW9oNWe4prVX2uSI8V6rvz14sqC7pGqJPS3KZjLHj8wIvVP3+tFz5+sm4y Ham03+zMTmt7jD44o4GAIeREkk4ArGoEY3K0py1U+aja+v3oAU7k3iE9B6oO6m+enbzQ hHtFJ6G+84fepdGYjvWZYUKCUXe2rEWWQfTfaE5IfhLZfyL0+2mi7ZrwRUGyYkYQBGRM BZD1pDRw5Z73g/gbAMbIw70GogyGYIp8X/u9Qpth3Cdppfi9fDlNzgu+oUBw/TH75Idr OKh0UCZqs+Rt6SpWUD+4oymn/fsxwCeCtUvYRWFVfaDP9hI36lNQ8f9ayEsdEw/gcXUd l0eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008391; x=1708613191; 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=OUfNPLmItBjPVQVkIuFZlyu1sOPgu8JxvvGpQGChzxE=; b=vhzRADrt6KVqQSECIBWp7ZrTakIkcZ0okmu36HVF+Fj7JSkT/j5ZOw+wRKgMsnPdBr gzKs+N9HBggjPG2Hj7oXqSpIiOSoYs07VnDOTBlyMgTuVhmOcr9GmS30fbtjYOpvlnT0 A7MSVqKigW7fkr0FVNpVbNeM6HG2oSJTJmzjh2bobWGzN6NW0ZupT8fsiU2Z2r89/yXG 5EwgyNMN4cUfeECyzSgbaNBU3H/COF075e2R1F8xMKKkFy3BWz7R6TAW5eG6z04MOj/E s1yQk4I3UEkwypJhUGOTmYFa5Jt25IRqE1mJ2X15DVvoWC+ROLuh8jR4CgI2X3tEo1vp sdnA== X-Gm-Message-State: AOJu0Yw5sW5QvxtCifmXdw3GFa1/kCZDy/6YWO9jmfvJZJ41hPkCn68X zoXOMFp9VFSjYaXStMor+Mh7e0TljmubXLN5UkYxdr3rj+DT8K1qWFksrPZ77uj+pAjN/6KmsK7 Oodw= X-Received: by 2002:a05:6402:4306:b0:563:bd85:bc49 with SMTP id m6-20020a056402430600b00563bd85bc49mr1284105edc.12.1708008390891; Thu, 15 Feb 2024 06:46:30 -0800 (PST) Received: from m1x-phil.lan ([176.187.193.50]) by smtp.gmail.com with ESMTPSA id ig4-20020a056402458400b00560c6ff443esm592789edb.66.2024.02.15.06.46.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 15 Feb 2024 06:46:30 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Cl=C3=A9ment_Chigot?= , Frederic Konrad , Mark Cave-Ayland , Artyom Tarasenko , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v5 1/3] hw/sparc/leon3: Pass DeviceState opaque argument to leon3_set_pil_in() Date: Thu, 15 Feb 2024 15:46:20 +0100 Message-ID: <20240215144623.76233-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240215144623.76233-1-philmd@linaro.org> References: <20240215144623.76233-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.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 --- 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)); From patchwork Thu Feb 15 14:46:21 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: 772901 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp866492wre; Thu, 15 Feb 2024 06:47:12 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUL81C2TWIgiz1PXx078tGRG3QiNCIH+RSGUHY+kAD0l68BdWGUzrKL6DBJph9NTDJr589EvZkdjCqyKPCBnZfg X-Google-Smtp-Source: AGHT+IGRNWmQV1wMDG6ajfBu2qWXpT6O4+1HhbCEC7qkzKvNucUU8D1WZA1YIgWsxPnGjEx7fC+4 X-Received: by 2002:ac8:4e4a:0:b0:42d:d779:f14c with SMTP id e10-20020ac84e4a000000b0042dd779f14cmr664668qtw.11.1708008431960; Thu, 15 Feb 2024 06:47:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708008431; cv=none; d=google.com; s=arc-20160816; b=MNqAXKlvaGS5/MzK4RZoLRJmPrSJ1C2MP/QFocgr641ckQDX6FnVkmGgPB0Q/EiIkn rpxSRx9aqKWNnQbgQK86rcTH1umIq47D01s3X2CVXZFE2FcS/XhuwmIrLClL6KLUr2y8 7+gPH8KuyzYfP/dnKTJrbZafSqS/Qcb0c2RHvRFD3nUvk+ByrtMYBJvTOWI96KBC7v/O Egl2kPAjSV3RMnXbmT4IxarT/DHyKN4JOpbRUsDnlzQeo1dI9lcphVVS3EgOevVDaO31 kkYK9m61WIC3dObWvOVu9ppHP0q4X51rGu2oqTYxTH2AnBBfkku2Fxs0+JW0coLp5PG7 JQyg== 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=BGKg1tIZ8Pmm8o3jSUHHCrdxf28mb3+tuXvQyvyxP5g=; fh=vKL7DoExp4lE8whkmUTvP6IrGDB6wJ9Hzl8dHrUtro4=; b=fL731HVguJ7g7BOkw+vLaagUekT5FjlqdFSriNd1aOXsla5EafFuZ2nsnph9doOLrK A1PF+KdEGf5CSOt9CFcP3VaT8RMYSEGDNL6YIriFGgASGyKxiGgC7g++3qNwduawrAl8 6XyvMp6wDKUUYfacMvez6Y2rBdXNwQbk7TEnuWInsKzrFKjlvgo4BbiEOeORSqZgvQ7d 9F3Oj0dZ4uH2YLhWCL34m2g6akUaSdDRJ2Sgi4U9QLjMZ8oxXPFmy7o8R1TOxgxGfTUU oOcPRd/BI+aEFjh02KTpzJErGAuUP6jgt5dZtfMgDLVjw2YLOIURXFZZl8B1yRLZPIPU X02Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jk3oC2Bo; 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 v26-20020a05622a189a00b0042c765ddf7bsi1564279qtc.801.2024.02.15.06.47.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Feb 2024 06:47:11 -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=jk3oC2Bo; 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 1rad0k-0006oT-5x; Thu, 15 Feb 2024 09:46:50 -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 1rad0a-0006ic-Hc for qemu-devel@nongnu.org; Thu, 15 Feb 2024 09:46:46 -0500 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rad0Y-00072o-Vz for qemu-devel@nongnu.org; Thu, 15 Feb 2024 09:46:40 -0500 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a26ed1e05c7so131763966b.2 for ; Thu, 15 Feb 2024 06:46:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708008396; x=1708613196; 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=BGKg1tIZ8Pmm8o3jSUHHCrdxf28mb3+tuXvQyvyxP5g=; b=jk3oC2BoqEi3TVE0K21CLxMOIRISoUrqGSsg+JPjN0adh5acvfLqoDbyfbcFFQ7Xau eoDJ2CmBKaUFmbHIDLUvYWFV1T96Kifzl/eEaeX1KFxeiMosNLXS4dSq9TfNfOGr7tmn FQ4gojLgp5t+WAitV1M4W/VbiCdQd5yAiW4mrvBnONdc2vWFJTbcwWEoOab6N3nwmhBR pDk1gydyClX+aesiNdfnItNmnqpLfxFkcjUCu4+xRrwqscMnZUokV3/5bObN1bqaqDD8 i/28wMojHyDItpn7tSr3QINMLlO56EYIN1axtEEHihK2SP8rjgSXMDlnkgwpQwVkj0HS VkQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008396; x=1708613196; 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=BGKg1tIZ8Pmm8o3jSUHHCrdxf28mb3+tuXvQyvyxP5g=; b=bsfmxZlcudC4nzSWGwReetlznizH+5nVavcTuFc9Ti0MyCjMDYikKJl5Ljne/lcTIx qsrbpiHJugfTLyoj/hap3lh9zIxtKl2ZCWd9CpT7SpC0lyA+JzKNADKCIky+hFq+D06F cfScU3OD6ipkCEl/hfajecIQE49EhYegr0LawEM8tvVJKySvNazh4k6CxzXwNPBQJHPG EcNVmTJvbh66hSXckGacM+up81is/GWIWzFId+5gFoY6mdl+EAtHEBHx2V4ZS8vsv2zJ iKP8t4yEObM7ZeOzd+bCb21sXXzwc44ySEdJI5AaryL/gjVlF/t+vSKC/Bx2w3TSG8Dv XXlA== X-Gm-Message-State: AOJu0YzCxOaBeyGPT439I5TT9Rp4QNkCnatTSXdQxnRdDIGHxjqMGUZy kUw27lK5s0lCS80J3UPQFrIqZSqmvwZ7bLKS0Nrz4AxRBaCfTXA+wWKgnLas4VAKp++mFOX1qBg 3KIo= X-Received: by 2002:a17:906:370b:b0:a3d:254d:5aaa with SMTP id d11-20020a170906370b00b00a3d254d5aaamr1450284ejc.63.1708008396320; Thu, 15 Feb 2024 06:46:36 -0800 (PST) Received: from m1x-phil.lan ([176.187.193.50]) by smtp.gmail.com with ESMTPSA id qk9-20020a170906d9c900b00a3ce60b003asm630467ejb.176.2024.02.15.06.46.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 15 Feb 2024 06:46:35 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Cl=C3=A9ment_Chigot?= , Frederic Konrad , Mark Cave-Ayland , Artyom Tarasenko , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v5 2/3] hw/sparc/leon3: Pass DeviceState opaque argument to leon3_start_cpu() Date: Thu, 15 Feb 2024 15:46:21 +0100 Message-ID: <20240215144623.76233-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240215144623.76233-1-philmd@linaro.org> References: <20240215144623.76233-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=philmd@linaro.org; helo=mail-ej1-x633.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(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Mark Cave-Ayland --- hw/sparc/leon3.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index a15f90e142..44fca1487d 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -241,7 +241,8 @@ static void leon3_start_cpu_async_work(CPUState *cpu, run_on_cpu_data data) static void leon3_start_cpu(void *opaque, int n, int level) { - CPUState *cs = CPU(opaque); + DeviceState *cpu = opaque; + CPUState *cs = CPU(cpu); assert(level == 1); async_run_on_cpu(cs, leon3_start_cpu_async_work, RUN_ON_CPU_NULL); @@ -310,8 +311,7 @@ static void leon3_generic_hw_init(MachineState *machine) for (i = 0; i < machine->smp.cpus; i++) { cpu = reset_info->info[i].cpu; env = &cpu->env; - qdev_init_gpio_in_named_with_opaque(DEVICE(cpu), leon3_start_cpu, - cpu, "start_cpu", 1); + qdev_init_gpio_in_named(DEVICE(cpu), leon3_start_cpu, "start_cpu", 1); qdev_connect_gpio_out_named(irqmpdev, "grlib-start-cpu", i, qdev_get_gpio_in_named(DEVICE(cpu), "start_cpu", 0)); From patchwork Thu Feb 15 14:46:22 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: 772903 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp866675wre; Thu, 15 Feb 2024 06:47:31 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUxdaobuuzMJNkEycy1gbelHo2vJlLC/p95OMAmyHKJB5Pa9MyatmkctRlnV+rQomQnzotjHX0fEanNAdgq/rdV X-Google-Smtp-Source: AGHT+IGPH2SIfpf3zpZtAuFCs/lr346iTv8P8R6w9jcFZYq5syflkMCqLoclMio4f5dCXHdjMVRD X-Received: by 2002:a05:6808:146:b0:3bf:d127:b510 with SMTP id h6-20020a056808014600b003bfd127b510mr1870096oie.15.1708008451435; Thu, 15 Feb 2024 06:47:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708008451; cv=none; d=google.com; s=arc-20160816; b=hm85E35Ni9lTNqCj1tCLDN563GHmmLDDxFOtDdAJBUOJgWfiEfWObtQKcXsoyf8eC3 YIKiMvfWxG8ZNuPBLn9zGHmjAMSbSy4Cj5GSwI2vToRgljucBxinKizcdei9aUFu9RA4 wFf1KVgz4BqZm3G5aNPCsEjEeMchp+qJTFJK0wEW04oPeKVrhNhR6ihp5vcp7Nbjr7rK G2fCk1UNEY5TszScn98TtGN7nUVORTjK2pN3MRgu2f9in5EsayZOPK0qLkjDG2om+esi Ruod5geB/VEByGGEVIrKb5cxBjBT/aIJ+Uwcli/2qVEx8XNTHLpJZcAoI8L4bp7SAP2T NMaw== 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=zvJ+w++PMP9Jr9Dkgf+8l14WEtpiGiCahalhYRk1Dhg=; fh=ynAV7ttBa8EchdCXX53IDNmv4LTYSKSKJapiy8GLefI=; b=zcnhglj1EKA92xZqpR1NYMfphA8yamrMR3W+e+Oo29+Sq95JJOIdxV9szDF9nngAyX 3hZtVyhU9JndF1cwTwtm2btF9DhnV8HMUQbgg7e2E70ns7io7KWkjsAs57PKrVq5X73A bBqts6mvKSpRRfINcvdrZTM7dulR/d4o5Xefc/dmoAOpbd0mEyAVP7BCcOY6oyrObYNN 3ZuizByz5q6UFVNb/HfZnrsKxWr79EA0DaMphs92BjO+d6shVFYDGznKdk1s9zkSz4+X Wb2O/Kk0dGuomXeYzVcZvp6KdQDzg1bXZrWoVLWK7NVmFHuscvBV0Mlm7AtMAq7xMlGq rnFA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MXRQCJx1; 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 jr14-20020a05622a800e00b0042c73eda258si1452345qtb.72.2024.02.15.06.47.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Feb 2024 06:47:31 -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=MXRQCJx1; 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 1rad0i-0006oN-H9; Thu, 15 Feb 2024 09:46:48 -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 1rad0f-0006kn-K8 for qemu-devel@nongnu.org; Thu, 15 Feb 2024 09:46:47 -0500 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rad0e-00073W-2K for qemu-devel@nongnu.org; Thu, 15 Feb 2024 09:46:45 -0500 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a389ea940f1so122037166b.3 for ; Thu, 15 Feb 2024 06:46:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708008402; x=1708613202; 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=zvJ+w++PMP9Jr9Dkgf+8l14WEtpiGiCahalhYRk1Dhg=; b=MXRQCJx1CBNlpvlxY9SUSa2ItkHl0w8YmlS7WW+xTmE/yKfKx9FL0ubFTtROCfAyZb 9YBxfwD1gsXOIDHNSTwsGpnRMj+Yzx8sKiWk3AYvbi8bQLSXXzq2wKDCxzY9VkXHU9mB JBIn5Ay5yLvOMPytdk3rs0pmMI98e/YYR0pQzBEMbWV/oSabessMDXWMz9QnuTtpqXCO OsNx7PPgyKlkYCf+od7ebz2v5C/a/fdsmkijNtFqRX27xXTnN7v/gDMlcINL9/65MaHS njA1T/L+6qCh8wra+ijCjgQVa1K8WAEMc+u6yu8XDXZ+Ziuv27drbJbia8fpSI4OdH1t 5Szw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008402; x=1708613202; 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=zvJ+w++PMP9Jr9Dkgf+8l14WEtpiGiCahalhYRk1Dhg=; b=Fkl8DyEPfPuIAcb2tJXpHrXIWEp5t1xItsRLwkU0viddGRRKM6/zpUFnUAUqUqbMOK BKEL/2TReHCWrWherqx+0eI+o7xbpuerUqTZCQYYqMbWP7QZiLPYpEwF3zDbNLB6TlmD HBaeVVeltqfx8XmP/rfCOa70J7TIykfQzclIhpA6pvmrIYqW9AA0gPNuau/BfmRGFJ/z lwWKxy+Zlhdzeyc4OAtXBHvwLFpNxf01CY7qWI/31SV1UToYanBNy7bA7RLD/VDgIEVN x5A8xNLXz2KOYD6CeoLcAod1u6f5a+j9yvLiMcb8FFmhAott/ki8fA0XJMwMRB0FHmh2 ut6g== X-Gm-Message-State: AOJu0YwluocXAbtXSDepwzhLPs7BOmkCFAj5Gp+7EYKVzDUYMh9gP4SO msnO0g8npYo6pNj6RJvSce0XMGIDUOvp8F6j0SX/J48oYp1Zgp2OFL6FHPTYUPP18qFX9W7MP8t kMhE= X-Received: by 2002:a17:907:76d1:b0:a3d:9435:5805 with SMTP id kf17-20020a17090776d100b00a3d94355805mr1425473ejc.13.1708008401884; Thu, 15 Feb 2024 06:46:41 -0800 (PST) Received: from m1x-phil.lan ([176.187.193.50]) by smtp.gmail.com with ESMTPSA id rf14-20020a1709076a0e00b00a3daa068f76sm341597ejc.65.2024.02.15.06.46.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 15 Feb 2024 06:46:41 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Cl=C3=A9ment_Chigot?= , Frederic Konrad , Mark Cave-Ayland , Artyom Tarasenko , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Peter Maydell Subject: [PATCH v5 3/3] hw/sparc/leon3: Initialize GPIO before realizing CPU devices Date: Thu, 15 Feb 2024 15:46:22 +0100 Message-ID: <20240215144623.76233-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240215144623.76233-1-philmd@linaro.org> References: <20240215144623.76233-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=philmd@linaro.org; helo=mail-ej1-x635.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 Inline cpu_create() in order to call qdev_init_gpio_in_named() before the CPU is realized. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Reviewed-by: Mark Cave-Ayland --- hw/sparc/leon3.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index 44fca1487d..4873b59b6c 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -277,7 +277,10 @@ static void leon3_generic_hw_init(MachineState *machine) for (i = 0; i < machine->smp.cpus; i++) { /* Init CPU */ - cpu = SPARC_CPU(cpu_create(machine->cpu_type)); + cpu = SPARC_CPU(object_new(machine->cpu_type)); + qdev_init_gpio_in_named(DEVICE(cpu), leon3_start_cpu, "start_cpu", 1); + qdev_init_gpio_in_named(DEVICE(cpu), leon3_set_pil_in, "pil", 1); + qdev_realize(DEVICE(cpu), NULL, &error_fatal); env = &cpu->env; cpu_sparc_set_id(env, i); @@ -311,11 +314,9 @@ static void leon3_generic_hw_init(MachineState *machine) for (i = 0; i < machine->smp.cpus; i++) { cpu = reset_info->info[i].cpu; env = &cpu->env; - qdev_init_gpio_in_named(DEVICE(cpu), leon3_start_cpu, "start_cpu", 1); 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(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));