From patchwork Tue Feb 20 19:26:25 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: 774288 Delivered-To: patch@linaro.org Received: by 2002:a5d:4943:0:b0:33b:4db1:f5b3 with SMTP id r3csp1820384wrs; Tue, 20 Feb 2024 11:27:37 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWfVBElJJ4DPfuYYIh137l4wO2aPqntq7rd+XnFsEkZzCydCv5VjVzje7oH6i/20TWgouF/v28GTHbJmvZb+1r5 X-Google-Smtp-Source: AGHT+IGDrM0fUyr/XIQZL0GpAlOiBOiU2yn7fovVyMdOV3Tr2FMtS3yKpjT1pZHJ2B2FW6+F54Tv X-Received: by 2002:ac8:5314:0:b0:42c:6e6b:2d75 with SMTP id t20-20020ac85314000000b0042c6e6b2d75mr18741330qtn.44.1708457257210; Tue, 20 Feb 2024 11:27:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708457257; cv=none; d=google.com; s=arc-20160816; b=Oin8U2Dc5Vzdv6iIfI7XFEdCSXwXnDZQ9J6EifxADN8+fpkBU+zKx4YtM1MW9ZiEuv RJbGOhHvjI9EiIg93cakLWQmc/HQ2vF6c7juLfAtPJEGkCfSKLgGTYY9q9YgbqHgGDaP MqPLDp+qlRjDO7iu0cA/lvOce0VVJwFNia5hUbzSONRPh021jd0QwGWXjP53ngxq8WhG wThaFw0obx7otwIex4EEfZvH8X0NWYWm58bRg5L+nbmK3dY2AUaJhCj8Gas5rVqj0+XK ODTyHOLVOQnjJ7WDWCdzwXwGOPl7BmKhOh6sRif2c2hHLJtKpJRL4oTwy4GjpkGh86Ye 7pFA== 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=2hUt/YzOZmeP2AC1y1qRNyEeuFDCyV/aUnZ8Viy/DjY=; fh=gWdwvapFCBy64EEWQ3+1o3ppMDrs/UbMYMOdTfatJbY=; b=HLjjivEif2/bfc+rWMUd42XtvfSRjDonjZXT7ngU//axMHWUw8cUYjK979ymRvyTlT oJGESLjEielcYfvtFUvKOrNPoP2exWxPU2xH8Gl89pBsWEWic5KAhByosnrEjB0iplYN l3XDpgjhLC9S6eIYz9PioVTzq1H3DwY/HzV1iHGoN/DkYNTgxlIiw6Ye6q4s9W74Llzt XVVHpLhSuuLjkGVRJmNxx472Ham+uZc8YiIWU3dv+glMk6uzzjALUuAqXdrf34We77VB U4lgLEWwrU1oWCMQ2ZddFgXq0kDi8/CTOrjL+IExIUkrENaHqiuHBznp9aCZ/fUn6odf oSUw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OTkJS3+M; 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 t14-20020a05620a004e00b00787329ed625si8922259qkt.756.2024.02.20.11.27.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 20 Feb 2024 11:27:37 -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=OTkJS3+M; 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 1rcVlU-0006Yj-GK; Tue, 20 Feb 2024 14:26:52 -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 1rcVlP-0006XP-5a for qemu-devel@nongnu.org; Tue, 20 Feb 2024 14:26:49 -0500 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rcVlN-0006Z6-Jx for qemu-devel@nongnu.org; Tue, 20 Feb 2024 14:26:46 -0500 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2d228a132acso48085091fa.0 for ; Tue, 20 Feb 2024 11:26:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708457201; x=1709062001; 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=2hUt/YzOZmeP2AC1y1qRNyEeuFDCyV/aUnZ8Viy/DjY=; b=OTkJS3+M0Q0KRbMc7hAIOzKOU/B6vt8mFMLSG2IHRki3R/tJRa2kDNC2aLveL8xuxS 6ImbjdJVj4zU0j22gJHPriSmibS/ou+nCBJfHUuPJzOLLcjMh15Aa3w7mjK4MX+GJTpu hqQgblmNPKlKKy1jqBdYoTS2OQWBjItVGckvHSwQF3j+QoBGYEILQjyYio+KL4wApyKx Mp1NxHsaHWmHEMVKLfnWntB98vqABUFhE5+yulgtL/4dZry8TdNWkiFUUro+ZsA9DWLX VQn4PFST6TZimh2+87pYu1DRbe7rtZB3ax1UMTOGc1wyNTgQKxQyreaCK/bpqj6/oQpf a3pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708457201; x=1709062001; 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=2hUt/YzOZmeP2AC1y1qRNyEeuFDCyV/aUnZ8Viy/DjY=; b=RVF1qD93W4ftzWqBGx/qrytpBGTMosJO6d1mO7L60ShmDhN7avjgcyvzQuGPCE7vjp zJSeQRldM8kGcuJF2ebZy05Jc6hLMqpENuF2TVANmgV8kkD33NjJQj7nWLUzkPM/9zzA p01h2kx/8sisGHDuVv6Ki+7IILFCwYLdTM3zGK25VQWdmPhwaW6rPIFQ6tKHR/ynP4DH mMGfaMCpkWn6cV+Y5fKFHcEdjatcOgSCEIpiw6j/iMKKNIdoKC8Wzmlvcz/ww0GXT0Vy 3H/lx+/qlR/szBcNDZHpkWjQfJ18oM1QZZF7W7QFmqoUyL8t+Zb53J5mPjVisDh3Qptd pMWw== X-Gm-Message-State: AOJu0Yyn3Lq+m9CgplPvAHPJd+IRt7KD1GTDWKNbHq+W6mvkfwhACmcN rLbwqzbCWoSZEYen9Sf2XjWKb+KgDvjsgb3eJPihUk++efU/b/YBxgkZ/qZnulFAbVakbS0y9qs 8 X-Received: by 2002:a2e:8ec8:0:b0:2d2:2ee5:8212 with SMTP id e8-20020a2e8ec8000000b002d22ee58212mr6154400ljl.13.1708457200813; Tue, 20 Feb 2024 11:26:40 -0800 (PST) Received: from m1x-phil.lan (mek33-h02-176-184-23-7.dsl.sta.abo.bbox.fr. [176.184.23.7]) by smtp.gmail.com with ESMTPSA id m8-20020a05600c4f4800b00411fb769583sm15737715wmq.27.2024.02.20.11.26.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 20 Feb 2024 11:26:40 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?utf-8?q?Alex_Benn=C3=A9e?= , Mark Cave-Ayland , Bernhard Beschow , Richard Henderson , Markus Armbruster , Alexander Graf , Anton Johansson , Paolo Bonzini , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 2/2] hw/alpha/typhoon: Set CPU IRQs using QDev API Date: Tue, 20 Feb 2024 20:26:25 +0100 Message-ID: <20240220192625.17944-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240220192625.17944-1-philmd@linaro.org> References: <20240220192625.17944-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22b; envelope-from=philmd@linaro.org; helo=mail-lj1-x22b.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 Keep a reference of CPU IRQs in the TyphoonCchip state. Resolve them once in typhoon_init(), and access them with the qemu_irq API. Signed-off-by: Philippe Mathieu-Daudé --- hw/alpha/typhoon.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c index e8711ae16a..f038b6f000 100644 --- a/hw/alpha/typhoon.c +++ b/hw/alpha/typhoon.c @@ -26,6 +26,8 @@ typedef struct TyphoonCchip { uint64_t dim[4]; uint32_t iic[4]; AlphaCPU *cpu[4]; + qemu_irq cpu_tmr[4]; + qemu_irq cpu_smp[4]; } TyphoonCchip; typedef struct TyphoonWindow { @@ -343,17 +345,16 @@ static MemTxResult cchip_write(void *opaque, hwaddr addr, for (i = 0; i < 4; ++i) { AlphaCPU *cpu = s->cchip.cpu[i]; if (cpu != NULL) { - CPUState *cs = CPU(cpu); /* IPI can be either cleared or set by the write. */ if (newval & (1 << (i + 8))) { - cpu_interrupt(cs, CPU_INTERRUPT_SMP); + qemu_irq_raise(s->cchip.cpu_smp[i]); } else { - cpu_reset_interrupt(cs, CPU_INTERRUPT_SMP); + qemu_irq_lower(s->cchip.cpu_smp[i]); } /* ITI can only be cleared by the write. */ if ((newval & (1 << (i + 4))) == 0) { - cpu_reset_interrupt(cs, CPU_INTERRUPT_TIMER); + qemu_irq_lower(s->cchip.cpu_tmr[i]); } } } @@ -802,7 +803,7 @@ static void typhoon_set_timer_irq(void *opaque, int irq, int level) /* Set the ITI bit for this cpu. */ s->cchip.misc |= 1 << (i + 4); /* And signal the interrupt. */ - cpu_interrupt(CPU(cpu), CPU_INTERRUPT_TIMER); + qemu_irq_raise(s->cchip.cpu_tmr[i]); } } } @@ -815,7 +816,7 @@ static void typhoon_alarm_timer(void *opaque) /* Set the ITI bit for this cpu. */ s->cchip.misc |= 1 << (cpu + 4); - cpu_interrupt(CPU(s->cchip.cpu[cpu]), CPU_INTERRUPT_TIMER); + qemu_irq_raise(s->cchip.cpu_tmr[cpu]); } PCIBus *typhoon_init(MemoryRegion *ram, qemu_irq *p_isa_irq, @@ -845,6 +846,8 @@ PCIBus *typhoon_init(MemoryRegion *ram, qemu_irq *p_isa_irq, cpu->alarm_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, typhoon_alarm_timer, (void *)((uintptr_t)s + i)); + s->cchip.cpu_tmr[i] = qdev_get_gpio_in_named(DEVICE(cpu), "TMR", 0); + s->cchip.cpu_smp[i] = qdev_get_gpio_in_named(DEVICE(cpu), "SMP", 0); } }