From nobody Tue Feb 10 13:16:25 2026 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=1606517578; cv=none; d=zohomail.com; s=zohoarc; b=NWNiiXSLkARlsTVslr0NSsPzdxWvz9VL6BhExR12Sdpj1reLq8/xhxcc5NX5k15dnVo1ZdKT6GKMp+eSBcIHQebjbiUVD6dD/Wpz20d8aWIcmqWJ5uj6+RzM7EeVF0LirCb3LgyvT3Hk2UFzAtFrEGcI3AR5wC/cvfd6QN1fp8c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606517578; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3uZMzY6oF54xbyAFQYKRwpZtvEnzb9HX015RCXLfpWQ=; b=m+EpXx4o9BKcuKhO5LuI2lP+nh/m8JT9jb+SO5LZzLRc6rLjso2GFmxCWE+gepS3Q2y1ptXCpAzRrugFk5cFjGI9c7BwLBUvCC6G007qHTTmRMrdgH7C9q8lCjQLY1Vkflx3ArxM1YeglK2/DtlY2ApzBmKczN6ibjQsEpKThhU= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1606517578855169.85882468091563; Fri, 27 Nov 2020 14:52:58 -0800 (PST) Received: from localhost ([::1]:37780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kimbn-0002aA-9M for importer@patchew.org; Fri, 27 Nov 2020 17:52:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51162) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kimaW-0001hE-2E for qemu-devel@nongnu.org; Fri, 27 Nov 2020 17:51:36 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:34680) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kimaS-00058F-SN for qemu-devel@nongnu.org; Fri, 27 Nov 2020 17:51:35 -0500 Received: by mail-wr1-x442.google.com with SMTP id k14so7087789wrn.1 for ; Fri, 27 Nov 2020 14:51:32 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id q16sm17429756wrn.13.2020.11.27.14.51.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Nov 2020 14:51:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3uZMzY6oF54xbyAFQYKRwpZtvEnzb9HX015RCXLfpWQ=; b=pjVUY+14jFJUqdJgZAS0vDYpiuya/0xywop/R3q2NQVYRM/Ni426uAmoNWSzE6O4R7 UIVPmyz11JuIoIzjHA3jhNZElKAuuOfGWkrVxX5RD8qwaiE07DKaKfbZgUQHlKA/Nij9 jkmaGafUnUYJgxD7iP875NDm7+k5UgGR/O8jLU0LruVnEmA8PyCo2WYCditxhlFeB04x qWuCE3a/dVwYOQRUmd/QGiaCVD4/3mSEjZnWFTx8g6ALEDG8qNNgg9Bw9dxxpMgAxm7/ IOmB0GQ0vEL67khtI3mVFGIEdibV+Q+6vsYxC9ZzMQxZib7RSG87SAZHMze+7QNukJrr /B9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3uZMzY6oF54xbyAFQYKRwpZtvEnzb9HX015RCXLfpWQ=; b=MFgYQQeXwJli+FQd41f5IyEly4We4tyifeiFBtl/uq24yHLzfns/nfkI0OL71m+qVC 1pn4YfXRMmrX8bYDJ67Kqca11u8mGmjbG7khHqTfgCpCnhtD6BblHoM3bgRBzI94OY4O CQaP4AHSizHzYKmsrg9faqpyusF2qxNiGIQS7TMl4yS9EzycnvqrwmfhwqkAKFXenpKu Yu7bzE5n27fCaPKdU0JioPi0x23fXqDlUTmAO2pjkjK72B6raG5aXRH+VXYz31rbFH1L njt3MRhh9GQNRAhloR2a0vFxXARtHckCzR7Z3EjdGrwzzL4FBJjcjAVIQjSuVwMJvLcM XCDg== X-Gm-Message-State: AOAM533wvTjnh5ohbbiXFq1NchMgxlDos0JeDSywKY098a76YaNeIZua bksODPoFbDQLb5MqQhhRIkaHaPN+iBOhzg== X-Google-Smtp-Source: ABdhPJwG0+NWSdaIsrx6NgiJtvPXBQ9DVp2JFa5+9LRh7pYaA1eJxNDb2LWEUJYgAUJ5qENe8EW2ag== X-Received: by 2002:adf:f9c6:: with SMTP id w6mr13433437wrr.273.1606517490828; Fri, 27 Nov 2020 14:51:30 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH 1/3] hw/openrisc/openrisc_sim: Use IRQ splitter when connecting IRQ to multiple CPUs Date: Fri, 27 Nov 2020 22:51:25 +0000 Message-Id: <20201127225127.14770-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201127225127.14770-1-peter.maydell@linaro.org> References: <20201127225127.14770-1-peter.maydell@linaro.org> MIME-Version: 1.0 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::442; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x442.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=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stafford Horne , Jia Liu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" openrisc_sim_net_init() attempts to connect the IRQ line from the ethernet device to both CPUs in an SMP configuration by simply caling sysbus_connect_irq() for it twice. This doesn't work, because the second connection simply overrides the first. Fix this by creating a TYPE_SPLIT_IRQ to split the IRQ in the SMP case. Signed-off-by: Peter Maydell Reviewed-by: Stafford Horne --- hw/openrisc/openrisc_sim.c | 13 +++++++++++-- hw/openrisc/Kconfig | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c index d752282e675..a8adf6b70d7 100644 --- a/hw/openrisc/openrisc_sim.c +++ b/hw/openrisc/openrisc_sim.c @@ -34,6 +34,7 @@ #include "hw/sysbus.h" #include "sysemu/qtest.h" #include "sysemu/reset.h" +#include "hw/core/split-irq.h" =20 #define KERNEL_LOAD_ADDR 0x100 =20 @@ -64,8 +65,16 @@ static void openrisc_sim_net_init(hwaddr base, hwaddr de= scriptors, =20 s =3D SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(s, &error_fatal); - for (i =3D 0; i < num_cpus; i++) { - sysbus_connect_irq(s, 0, cpu_irqs[i][irq_pin]); + if (num_cpus > 1) { + DeviceState *splitter =3D qdev_new(TYPE_SPLIT_IRQ); + qdev_prop_set_uint32(splitter, "num-lines", num_cpus); + qdev_realize_and_unref(splitter, NULL, &error_fatal); + for (i =3D 0; i < num_cpus; i++) { + qdev_connect_gpio_out(splitter, i, cpu_irqs[i][irq_pin]); + } + sysbus_connect_irq(s, 0, qdev_get_gpio_in(splitter, 0)); + } else { + sysbus_connect_irq(s, 0, cpu_irqs[0][irq_pin]); } sysbus_mmio_map(s, 0, base); sysbus_mmio_map(s, 1, descriptors); diff --git a/hw/openrisc/Kconfig b/hw/openrisc/Kconfig index 6c1e86884e2..8f284f3ba04 100644 --- a/hw/openrisc/Kconfig +++ b/hw/openrisc/Kconfig @@ -3,3 +3,4 @@ config OR1K_SIM select SERIAL select OPENCORES_ETH select OMPIC + select SPLIT_IRQ --=20 2.20.1