Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2228153/?format=api
{ "id": 2228153, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2228153/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260425131721.932250-7-joel@jms.id.au/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.1/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260425131721.932250-7-joel@jms.id.au>", "date": "2026-04-25T13:17:12", "name": "[v4,06/13] hw/riscv/aia: Provide number of irq sources", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "92f165e84ad24041a06a0044afdd6e7c9fa415ba", "submitter": { "id": 48628, "url": "http://patchwork.ozlabs.org/api/1.1/people/48628/?format=api", "name": "Joel Stanley", "email": "joel@jms.id.au" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260425131721.932250-7-joel@jms.id.au/mbox/", "series": [ { "id": 501439, "url": "http://patchwork.ozlabs.org/api/1.1/series/501439/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=501439", "date": "2026-04-25T13:17:08", "name": "hw/riscv: Add the Tenstorrent Atlantis machine", "version": 4, "mbox": "http://patchwork.ozlabs.org/series/501439/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2228153/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2228153/checks/", "tags": {}, "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=lcP7A2jS;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g2r9q2WQPz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 25 Apr 2026 23:23:11 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wGcuP-0007JM-17; Sat, 25 Apr 2026 09:18:57 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <joel.stan@gmail.com>)\n id 1wGcu5-00078W-3a\n for qemu-devel@nongnu.org; Sat, 25 Apr 2026 09:18:38 -0400", "from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <joel.stan@gmail.com>)\n id 1wGctz-00008H-8c\n for qemu-devel@nongnu.org; Sat, 25 Apr 2026 09:18:34 -0400", "by mail-pf1-x42d.google.com with SMTP id\n d2e1a72fcca58-82f8b60e485so3690026b3a.0\n for <qemu-devel@nongnu.org>; Sat, 25 Apr 2026 06:18:30 -0700 (PDT)", "from donnager-debian.. ([45.124.203.19])\n by smtp.gmail.com with ESMTPSA id\n d2e1a72fcca58-82f8e9f7735sm26898866b3a.21.2026.04.25.06.18.24\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sat, 25 Apr 2026 06:18:28 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1777123110; x=1777727910; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date\n :message-id:reply-to;\n bh=nW9ZH4U2QO4sH1DbhH2/N7/zNF6OnlzomtW8a7+btRo=;\n b=lcP7A2jSptj4nPJipTuMma198tOF5CCHGgS3Mb124dpt+Nr6TYcrqRGsXywHmib9h/\n c0lmxdpb2xydTHI6JsVSMCevvRNSA6DCLEYC3539VezmMBceGhHJqV+9oFDgS3Q9WudL\n S/YuL81zUsr4bnCZPSlLiJyCYD6rl0FmjPpLu1Cc7fm62rsgrLEFs0Rx51yFOWBU7utk\n DaFuYVqdhu5nQdwzlbiRXkwq5BnpM/Hnpr7KQFt1wN+dtGdew5AWWwYpSVpXOC6E77ci\n xzWA+MZn991bgZRE2vOeGvmJZ34Vsyx/89AJiXD9kAznzdgm0hUc6OctrpQG7cY79JdY\n 1ANA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777123110; x=1777727910;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:sender:x-gm-gg\n :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n bh=nW9ZH4U2QO4sH1DbhH2/N7/zNF6OnlzomtW8a7+btRo=;\n b=DwNFccTfJDO+aVol68IFa1MZCMzwG96Fu5IIiECYejTGcdqIyj8OZC4FKMNf27DvO7\n egi0Ai4Ed7HXJCids/BoCetng6NmGfcZwFCHaJrQnlkdsY36Fbwfwc8dBpR+4afooSAK\n BTtAK2uyi92zOMwvFxb5oZZuObthTdQzU9ERu9jwMRrlZckv61HkDYKYqf2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3a.17.1777123109845;\n Sat, 25 Apr 2026 06:18:29 -0700 (PDT)", "From": "Joel Stanley <joel@jms.id.au>", "To": "Alistair Francis <alistair.francis@wdc.com>,\n Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>", "Cc": "Chao Liu <chao.liu.zevorn@gmail.com>, Michael Ellerman <mpe@kernel.org>,\n Nicholas Piggin <npiggin@gmail.com>, Joel Stanley <jms@oss.tenstorrent.com>,\n Anirudh Srinivasan <asrinivasan@oss.tenstorrent.com>,\n Portia Stephens <portias@oss.tenstorrent.com>, qemu-riscv@nongnu.org,\n qemu-devel@nongnu.org, Nutty Liu <nutty.liu@hotmail.com>, =?utf-8?q?Philipp?=\n\t=?utf-8?q?e_Mathieu-Daud=C3=A9?= <philmd@linaro.org>", "Subject": "[PATCH v4 06/13] hw/riscv/aia: Provide number of irq sources", "Date": "Sat, 25 Apr 2026 23:17:12 +1000", "Message-ID": "<20260425131721.932250-7-joel@jms.id.au>", "X-Mailer": "git-send-email 2.47.3", "In-Reply-To": "<20260425131721.932250-1-joel@jms.id.au>", "References": "<20260425131721.932250-1-joel@jms.id.au>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=2607:f8b0:4864:20::42d;\n envelope-from=joel.stan@gmail.com; helo=mail-pf1-x42d.google.com", "X-Spam_score_int": "-16", "X-Spam_score": "-1.7", "X-Spam_bar": "-", "X-Spam_report": "(-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,\n FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=no autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "Instead of hard coding the number of IRQ sources used by the APLIC pass\nit in as a parameter. This allows other machines to configure this as\nrequired.\n\nThe maximum number of sources is 1023.\n\nReviewed-by: Nutty Liu <nutty.liu@hotmail.com>\nReviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>\nReviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>\nSigned-off-by: Joel Stanley <joel@jms.id.au>\n---\nv3: Add r-b\n---\n hw/riscv/aia.h | 3 +--\n include/hw/riscv/virt.h | 1 +\n hw/riscv/aia.c | 8 ++++++--\n hw/riscv/virt-acpi-build.c | 25 ++++++++++++++++---------\n hw/riscv/virt.c | 2 ++\n 5 files changed, 26 insertions(+), 13 deletions(-)", "diff": "diff --git a/hw/riscv/aia.h b/hw/riscv/aia.h\nindex dbb833340276..5ad0a902be0d 100644\n--- a/hw/riscv/aia.h\n+++ b/hw/riscv/aia.h\n@@ -11,11 +11,10 @@\n \n #include \"exec/hwaddr.h\"\n \n-#define VIRT_IRQCHIP_NUM_SOURCES 96\n-\n uint32_t imsic_num_bits(uint32_t count);\n \n DeviceState *riscv_create_aia(bool msimode, int aia_guests,\n+ uint16_t num_sources,\n const MemMapEntry *aplic_m,\n const MemMapEntry *aplic_s,\n const MemMapEntry *imsic_m,\ndiff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h\nindex ad858deb76ad..36a2def41096 100644\n--- a/include/hw/riscv/virt.h\n+++ b/include/hw/riscv/virt.h\n@@ -64,6 +64,7 @@ struct RISCVVirtState {\n struct GPEXHost *gpex_host;\n OnOffAuto iommu_sys;\n uint16_t pci_iommu_bdf;\n+ uint16_t num_sources;\n };\n \n enum {\ndiff --git a/hw/riscv/aia.c b/hw/riscv/aia.c\nindex c724612a50a5..82ea9d48ea75 100644\n--- a/hw/riscv/aia.c\n+++ b/hw/riscv/aia.c\n@@ -25,6 +25,7 @@ uint32_t imsic_num_bits(uint32_t count)\n }\n \n DeviceState *riscv_create_aia(bool msimode, int aia_guests,\n+ uint16_t num_sources,\n const MemMapEntry *aplic_m,\n const MemMapEntry *aplic_s,\n const MemMapEntry *imsic_m,\n@@ -38,6 +39,9 @@ DeviceState *riscv_create_aia(bool msimode, int aia_guests,\n DeviceState *aplic_s_dev = NULL;\n DeviceState *aplic_m_dev = NULL;\n \n+ /* The RISC-V Advanced Interrupt Architecture, Chapter 1.2. Limits */\n+ g_assert(num_sources <= 1023);\n+\n if (msimode) {\n if (!kvm_enabled()) {\n /* Per-socket M-level IMSICs */\n@@ -66,7 +70,7 @@ DeviceState *riscv_create_aia(bool msimode, int aia_guests,\n aplic_m->size,\n (msimode) ? 0 : base_hartid,\n (msimode) ? 0 : hart_count,\n- VIRT_IRQCHIP_NUM_SOURCES,\n+ num_sources,\n num_prio_bits,\n msimode, true, NULL);\n }\n@@ -77,7 +81,7 @@ DeviceState *riscv_create_aia(bool msimode, int aia_guests,\n aplic_s->size,\n (msimode) ? 0 : base_hartid,\n (msimode) ? 0 : hart_count,\n- VIRT_IRQCHIP_NUM_SOURCES,\n+ num_sources,\n num_prio_bits,\n msimode, false, aplic_m_dev);\n \ndiff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c\nindex 145f8d92ad69..9ef3ef842a28 100644\n--- a/hw/riscv/virt-acpi-build.c\n+++ b/hw/riscv/virt-acpi-build.c\n@@ -146,6 +146,7 @@ static void acpi_dsdt_add_cpus(Aml *scope, RISCVVirtState *s)\n }\n \n static void acpi_dsdt_add_plic_aplic(Aml *scope, uint8_t socket_count,\n+ uint16_t num_sources,\n uint64_t mmio_base, uint64_t mmio_size,\n const char *hid)\n {\n@@ -153,9 +154,12 @@ static void acpi_dsdt_add_plic_aplic(Aml *scope, uint8_t socket_count,\n uint32_t gsi_base;\n uint8_t socket;\n \n+ /* The RISC-V Advanced Interrupt Architecture, Chapter 1.2. Limits */\n+ g_assert(num_sources <= 1023);\n+\n for (socket = 0; socket < socket_count; socket++) {\n plic_aplic_addr = mmio_base + mmio_size * socket;\n- gsi_base = VIRT_IRQCHIP_NUM_SOURCES * socket;\n+ gsi_base = num_sources * socket;\n Aml *dev = aml_device(\"IC%.02X\", socket);\n aml_append(dev, aml_name_decl(\"_HID\", aml_string(\"%s\", hid)));\n aml_append(dev, aml_name_decl(\"_UID\", aml_int(socket)));\n@@ -474,10 +478,13 @@ static void build_dsdt(GArray *table_data,\n socket_count = riscv_socket_count(ms);\n \n if (s->aia_type == VIRT_AIA_TYPE_NONE) {\n- acpi_dsdt_add_plic_aplic(scope, socket_count, memmap[VIRT_PLIC].base,\n- memmap[VIRT_PLIC].size, \"RSCV0001\");\n+ acpi_dsdt_add_plic_aplic(scope, socket_count, s->num_sources,\n+ memmap[VIRT_PLIC].base,\n+ memmap[VIRT_PLIC].size,\n+ \"RSCV0001\");\n } else {\n- acpi_dsdt_add_plic_aplic(scope, socket_count, memmap[VIRT_APLIC_S].base,\n+ acpi_dsdt_add_plic_aplic(scope, socket_count, s->num_sources,\n+ memmap[VIRT_APLIC_S].base,\n memmap[VIRT_APLIC_S].size, \"RSCV0002\");\n }\n \n@@ -494,15 +501,15 @@ static void build_dsdt(GArray *table_data,\n } else if (socket_count == 2) {\n virtio_acpi_dsdt_add(scope, memmap[VIRT_VIRTIO].base,\n memmap[VIRT_VIRTIO].size,\n- VIRTIO_IRQ + VIRT_IRQCHIP_NUM_SOURCES, 0,\n+ VIRTIO_IRQ + s->num_sources, 0,\n VIRTIO_COUNT);\n- acpi_dsdt_add_gpex_host(scope, PCIE_IRQ + VIRT_IRQCHIP_NUM_SOURCES);\n+ acpi_dsdt_add_gpex_host(scope, PCIE_IRQ + s->num_sources);\n } else {\n virtio_acpi_dsdt_add(scope, memmap[VIRT_VIRTIO].base,\n memmap[VIRT_VIRTIO].size,\n- VIRTIO_IRQ + VIRT_IRQCHIP_NUM_SOURCES, 0,\n+ VIRTIO_IRQ + s->num_sources, 0,\n VIRTIO_COUNT);\n- acpi_dsdt_add_gpex_host(scope, PCIE_IRQ + VIRT_IRQCHIP_NUM_SOURCES * 2);\n+ acpi_dsdt_add_gpex_host(scope, PCIE_IRQ + s->num_sources * 2);\n }\n \n aml_append(dsdt, scope);\n@@ -581,7 +588,7 @@ static void build_madt(GArray *table_data,\n for (socket = 0; socket < riscv_socket_count(ms); socket++) {\n aplic_addr = s->memmap[VIRT_APLIC_S].base +\n s->memmap[VIRT_APLIC_S].size * socket;\n- gsi_base = VIRT_IRQCHIP_NUM_SOURCES * socket;\n+ gsi_base = s->num_sources * socket;\n build_append_int_noprefix(table_data, 0x1A, 1); /* Type */\n build_append_int_noprefix(table_data, 36, 1); /* Length */\n build_append_int_noprefix(table_data, 1, 1); /* Version */\ndiff --git a/hw/riscv/virt.c b/hw/riscv/virt.c\nindex ce0fd6f50c4a..6c5bcd43dc54 100644\n--- a/hw/riscv/virt.c\n+++ b/hw/riscv/virt.c\n@@ -1548,6 +1548,7 @@ static void virt_machine_init(MachineState *machine)\n } else {\n s->irqchip[i] = riscv_create_aia(s->aia_type == VIRT_AIA_TYPE_APLIC_IMSIC,\n s->aia_guests,\n+ s->num_sources,\n &s->memmap[VIRT_APLIC_M],\n &s->memmap[VIRT_APLIC_S],\n &s->memmap[VIRT_IMSIC_M],\n@@ -1691,6 +1692,7 @@ static void virt_machine_instance_init(Object *obj)\n s->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8);\n s->acpi = ON_OFF_AUTO_AUTO;\n s->iommu_sys = ON_OFF_AUTO_AUTO;\n+ s->num_sources = VIRT_IRQCHIP_NUM_SOURCES;\n }\n \n static char *virt_get_aia_guests(Object *obj, Error **errp)\n", "prefixes": [ "v4", "06/13" ] }