From nobody Thu Nov 14 07:11:00 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1704878035; cv=none; d=zohomail.com; s=zohoarc; b=QSL+bIVEJh78wZzb5p83RLdkINV78B/rebvdnMau2Vb15ndPgQd1gMFzJRqmbBae1k8FRCoghjcWR5dPwUJTosB8oJ6/lyze5i9jc8s+ngKtDGRVHAwgBRQRS9Ars7/SZofrBzlTESQGujDiQfjkKtfro0+cWjp37/xJaCRU8gs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704878035; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Or1TlzDZzvYJC7mgx0r6HVVhAJcAznATjZQQBfvyLmg=; b=HVWYs6WY71h9CsI/6yg45UPpwD3U+KGTGuZQLxdULUA6nrjmSJkaRU8Gkgnmzm1p4b5lKMdA8VyyqueJLV80DLxvgbWFLhw4UTv0wVpmQVXLMxWDv/mC2GOprkQULFZu+muymmNInWwYuOaqFLtMxe0RJIzRT6TjeHEI84HwyNk= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704878035714893.2801828250836; Wed, 10 Jan 2024 01:13:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNUQ7-0001vQ-LC; Wed, 10 Jan 2024 03:58:43 -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 1rNUQ6-0001us-AM for qemu-devel@nongnu.org; Wed, 10 Jan 2024 03:58:42 -0500 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNUQ4-0003gk-Dh for qemu-devel@nongnu.org; Wed, 10 Jan 2024 03:58:41 -0500 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6d9f94b9186so3312198b3a.0 for ; Wed, 10 Jan 2024 00:58:40 -0800 (PST) Received: from toolbox.alistair23.me (2403-580b-97e8-0-321-6fb2-58f1-a1b1.ip6.aussiebb.net. [2403:580b:97e8:0:321:6fb2:58f1:a1b1]) by smtp.gmail.com with ESMTPSA id t65-20020a628144000000b006d9879ba6besm3223814pfd.170.2024.01.10.00.58.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 00:58:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704877119; x=1705481919; 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=Or1TlzDZzvYJC7mgx0r6HVVhAJcAznATjZQQBfvyLmg=; b=Zvc2UFSJrYrj1+kyRlk18pU1V0VmpTauffwL9RXxrgGYDj58zJ4SY5wj0oTeYhhXPZ RpaiC1M1Ph3meydfSkLlp4AUz3SCSfq0PqU2MYklg9GwirhCT8SRseI8LCbU61jFLBqh /o8ZTQinyivMRphJLRw6Wc+cVp3R+90ulyTaabZtOsNWArs03YI2GJriKj/BAo5t2oWb 6x/UHBIAEF4K7P1u9iYb4BbY6jB+04OHUJLB8d25rAfpwe55G2D8b4vIJ8zL6SHhP8p7 6jyOgndVoEbxRV3Sfe8MNsHVlhpSFEWkkSrQ4E1//PiY87pJupg4JYDC0jVV8zjegqqQ TqYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704877119; x=1705481919; 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=Or1TlzDZzvYJC7mgx0r6HVVhAJcAznATjZQQBfvyLmg=; b=qVSPk3yhgCqcD8LeJrPdaRvGuJ+P0najxboE+HFGeBXBU9LsnKV/zgvP5PxErdBV/w pOvHRJC2N0oOAQkPDnhVN/h+fanUk39QYriQopmZVLUdCq4FwWGnBvqI1ioySf/C0gTG cdDHfuVL96GkZ8byfrRpZ4MFMSlGZgYjYAKYas41c2eEATPFv8Z8AO55+ua50Ds0tIYW 3bW/0dTXbHx8gvCnvPcwrDPijxjwfd36oc3PkYDptalrY6jDa/tyzlpJb6FUq8FOEE0j 6KjW7OuvuKPcPMZ7s5+SLzrO3acvttsoETF0Ao49gxDj8sEssAa0TB49QyiDCq9I7rV6 39Cg== X-Gm-Message-State: AOJu0YzwGVY9seCqMya6LMATDx7I+Lz4WdIjxfcm4UgiKI6jOrFeFALk WzzuSvR10jekBmC4WcuhiHiSWFaZQtmxdEYK X-Google-Smtp-Source: AGHT+IHnzNX3wGpd3l+EzSJBuVrkHoDePlxt6LvtGE6Jz/0sI/suGkx+46KEUVJqO86qAAm87bIHaQ== X-Received: by 2002:a05:6a00:1813:b0:6d9:9793:37c6 with SMTP id y19-20020a056a00181300b006d9979337c6mr1112969pfa.8.1704877118692; Wed, 10 Jan 2024 00:58:38 -0800 (PST) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Sunil V L , Daniel Henrique Barboza , Alistair Francis , Andrew Jones , "Michael S . Tsirkin" Subject: [PULL 15/65] hw/riscv: virt: Make few IMSIC macros and functions public Date: Wed, 10 Jan 2024 18:56:43 +1000 Message-ID: <20240110085733.1607526-16-alistair.francis@wdc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240110085733.1607526-1-alistair.francis@wdc.com> References: <20240110085733.1607526-1-alistair.francis@wdc.com> 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=2607:f8b0:4864:20::42b; envelope-from=alistair23@gmail.com; helo=mail-pf1-x42b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1704878036680100001 Content-Type: text/plain; charset="utf-8" From: Sunil V L Some macros and static function related to IMSIC are defined in virt.c. They are required in virt-acpi-build.c. So, make them public. Signed-off-by: Sunil V L Reviewed-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Reviewed-by: Andrew Jones Acked-by: Michael S. Tsirkin Message-ID: <20231218150247.466427-5-sunilvl@ventanamicro.com> Signed-off-by: Alistair Francis --- include/hw/riscv/virt.h | 25 +++++++++++++++++++++++++ hw/riscv/virt.c | 25 +------------------------ 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h index e5c474b26e..5b03575ed3 100644 --- a/include/hw/riscv/virt.h +++ b/include/hw/riscv/virt.h @@ -23,6 +23,7 @@ #include "hw/riscv/riscv_hart.h" #include "hw/sysbus.h" #include "hw/block/flash.h" +#include "hw/intc/riscv_imsic.h" =20 #define VIRT_CPUS_MAX_BITS 9 #define VIRT_CPUS_MAX (1 << VIRT_CPUS_MAX_BITS) @@ -127,4 +128,28 @@ enum { =20 bool virt_is_acpi_enabled(RISCVVirtState *s); void virt_acpi_setup(RISCVVirtState *vms); +uint32_t imsic_num_bits(uint32_t count); + +/* + * The virt machine physical address space used by some of the devices + * namely ACLINT, PLIC, APLIC, and IMSIC depend on number of Sockets, + * number of CPUs, and number of IMSIC guest files. + * + * Various limits defined by VIRT_SOCKETS_MAX_BITS, VIRT_CPUS_MAX_BITS, + * and VIRT_IRQCHIP_MAX_GUESTS_BITS are tuned for maximum utilization + * of virt machine physical address space. + */ + +#define VIRT_IMSIC_GROUP_MAX_SIZE (1U << IMSIC_MMIO_GROUP_MIN_SHIFT) +#if VIRT_IMSIC_GROUP_MAX_SIZE < \ + IMSIC_GROUP_SIZE(VIRT_CPUS_MAX_BITS, VIRT_IRQCHIP_MAX_GUESTS_BITS) +#error "Can't accomodate single IMSIC group in address space" +#endif + +#define VIRT_IMSIC_MAX_SIZE (VIRT_SOCKETS_MAX * \ + VIRT_IMSIC_GROUP_MAX_SIZE) +#if 0x4000000 < VIRT_IMSIC_MAX_SIZE +#error "Can't accomodate all IMSIC groups in address space" +#endif + #endif diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index d2eac24156..9e7629c51c 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -38,7 +38,6 @@ #include "kvm/kvm_riscv.h" #include "hw/intc/riscv_aclint.h" #include "hw/intc/riscv_aplic.h" -#include "hw/intc/riscv_imsic.h" #include "hw/intc/sifive_plic.h" #include "hw/misc/sifive_test.h" #include "hw/platform-bus.h" @@ -54,28 +53,6 @@ #include "hw/acpi/aml-build.h" #include "qapi/qapi-visit-common.h" =20 -/* - * The virt machine physical address space used by some of the devices - * namely ACLINT, PLIC, APLIC, and IMSIC depend on number of Sockets, - * number of CPUs, and number of IMSIC guest files. - * - * Various limits defined by VIRT_SOCKETS_MAX_BITS, VIRT_CPUS_MAX_BITS, - * and VIRT_IRQCHIP_MAX_GUESTS_BITS are tuned for maximum utilization - * of virt machine physical address space. - */ - -#define VIRT_IMSIC_GROUP_MAX_SIZE (1U << IMSIC_MMIO_GROUP_MIN_SHIFT) -#if VIRT_IMSIC_GROUP_MAX_SIZE < \ - IMSIC_GROUP_SIZE(VIRT_CPUS_MAX_BITS, VIRT_IRQCHIP_MAX_GUESTS_BITS) -#error "Can't accommodate single IMSIC group in address space" -#endif - -#define VIRT_IMSIC_MAX_SIZE (VIRT_SOCKETS_MAX * \ - VIRT_IMSIC_GROUP_MAX_SIZE) -#if 0x4000000 < VIRT_IMSIC_MAX_SIZE -#error "Can't accommodate all IMSIC groups in address space" -#endif - /* KVM AIA only supports APLIC MSI. APLIC Wired is always emulated by QEMU= . */ static bool virt_use_kvm_aia(RISCVVirtState *s) { @@ -512,7 +489,7 @@ static void create_fdt_socket_plic(RISCVVirtState *s, g_free(plic_cells); } =20 -static uint32_t imsic_num_bits(uint32_t count) +uint32_t imsic_num_bits(uint32_t count) { uint32_t ret =3D 0; =20 --=20 2.43.0