From nobody Sat Sep 21 07:53:35 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=1704877211; cv=none; d=zohomail.com; s=zohoarc; b=f/RYd3lx5g8xok1ezEWMVFE1z8jr8AfPMdiguARaL6A2ZLzaVC4yEHkG8JSsfOF6krCu3tEl9ZZ3vdHjI3sz7Tup/6ppb5LOX94P9q4cz8HD1M4eTmm/KOxKP0ShgtwdN9ErYv2+6TMfGP64tH7sf48LR8xrAQIYxVNyisOELHA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704877211; 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=He34LkJl4AJd2A963fk475Yh9IYcKbrbCDrb1QCOhHs=; b=BqxGqHs1bBYDlLBxuXh1N/W0n8zbJtlwXawhdCHpXi/ZL57C3q2mSb5gL5W0L9gsydpKyCX1+jJLAYGDykwJ6v/YOz7GIYCF4TiTaGGGFNeSpBcoAnmUHMUtgohEvUuXCSmjU2FgGWzFzX+fcBcfQeJtaxS76kyE9gDr346Fpsw= 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 1704877211663137.52802236133664; Wed, 10 Jan 2024 01:00:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNUQG-0002Zk-GW; Wed, 10 Jan 2024 03:58: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 1rNUQE-0002Q1-VL for qemu-devel@nongnu.org; Wed, 10 Jan 2024 03:58:51 -0500 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNUQD-0003ln-31 for qemu-devel@nongnu.org; Wed, 10 Jan 2024 03:58:50 -0500 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6d9bee259c5so2355205b3a.1 for ; Wed, 10 Jan 2024 00:58:48 -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.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 00:58:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704877127; x=1705481927; 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=He34LkJl4AJd2A963fk475Yh9IYcKbrbCDrb1QCOhHs=; b=Lrz/yZJP2JHq4tE3A+YR0+rjbmMfj+j/k+G8BaLbXhn9dtoyzHUxhg/SPpS+9Wp8lT 1IHRTV70W2iVD51k18azhztWOoXIWduFPs6beWW0nyaMm4L+qHpfpwm3Q2Hcewrnmoyv wu9j3Gr52tI6ABTDFER4W2tX2T2Ia61GvzuPXpEqjp/2j7umrQDuKA68wf0TR8oTReWD qFlDOJqPbEveRUluP1KCwgIokhngWBP6vm7emIEq+/tQx/vG7J/tcZ+pz65liGlDRcji rXt6g7luuDAW8NIuwBTJ17YAAsU01tZJ+peWXng1mpsb0uXHcVVX+Eurijwag70lbrdP 4uaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704877127; x=1705481927; 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=He34LkJl4AJd2A963fk475Yh9IYcKbrbCDrb1QCOhHs=; b=pPqqmH8T5IVbS0t1J8rSVEbFdPgSWM69OSy2E8WZ0FAsLj/v72BiUPUKIuM0MJRUED emOy+9at26Z1SmAz8pDAU4DEPGPUHX6CWZdoD7C0DL9DuckdtHMk0dXe+WbxujRrzNiY CPbSr+nj95wSNe0iU3gkVQ4rjF+EMAvL1lNeTmQtnFW2DoP483S+d4nhcDnC3Wrl+YVJ XA/EzsLe0oa3gqBuEuTBVIauwg6xmlOCImAjmmsYfShTVMc7J2pJdN8ps+Z59oa4XMlo 16dJzzV/0ypF9Y+2UbG8XItXNWt8JeUJmaT9qLfgj43elVLbvVCl6/plO2HHdbadN45K Uagw== X-Gm-Message-State: AOJu0Yxo0Eb3wi1vwBET0eoQU/Y52a2EFbdMx6odb3i9TAB1wz114/YJ j6IWK2BiTzkcSim2TQwhyvhiwuPlijxyhmS3 X-Google-Smtp-Source: AGHT+IH1flwlqEs7ooe43RU5sPDl8Ksj96VTgoZ7PwmXD58QNAskj1DD/m10yTMwrY0NvITqhG77Sw== X-Received: by 2002:a62:e916:0:b0:6da:84ae:c209 with SMTP id j22-20020a62e916000000b006da84aec209mr553526pfh.45.1704877127336; Wed, 10 Jan 2024 00:58:47 -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 , Andrew Jones , Alistair Francis , "Michael S . Tsirkin" Subject: [PULL 17/65] hw/riscv/virt-acpi-build.c: Add IMSIC in the MADT Date: Wed, 10 Jan 2024 18:56:45 +1000 Message-ID: <20240110085733.1607526-18-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::433; envelope-from=alistair23@gmail.com; helo=mail-pf1-x433.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: 1704877212678100001 Content-Type: text/plain; charset="utf-8" From: Sunil V L Add IMSIC structure in MADT when IMSIC is configured. Signed-off-by: Sunil V L Reviewed-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones Acked-by: Alistair Francis Acked-by: Michael S. Tsirkin Message-ID: <20231218150247.466427-7-sunilvl@ventanamicro.com> Signed-off-by: Alistair Francis --- hw/riscv/virt-acpi-build.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c index 8f61fd63eb..32b5795f09 100644 --- a/hw/riscv/virt-acpi-build.c +++ b/hw/riscv/virt-acpi-build.c @@ -270,6 +270,19 @@ static void build_madt(GArray *table_data, MachineClass *mc =3D MACHINE_GET_CLASS(s); MachineState *ms =3D MACHINE(s); const CPUArchIdList *arch_ids =3D mc->possible_cpu_arch_ids(ms); + uint8_t group_index_bits =3D imsic_num_bits(riscv_socket_count(ms)); + uint8_t guest_index_bits =3D imsic_num_bits(s->aia_guests + 1); + uint16_t imsic_max_hart_per_socket =3D 0; + uint8_t hart_index_bits; + uint8_t socket; + + for (socket =3D 0; socket < riscv_socket_count(ms); socket++) { + if (imsic_max_hart_per_socket < s->soc[socket].num_harts) { + imsic_max_hart_per_socket =3D s->soc[socket].num_harts; + } + } + + hart_index_bits =3D imsic_num_bits(imsic_max_hart_per_socket); =20 AcpiTable table =3D { .sig =3D "APIC", .rev =3D 6, .oem_id =3D s->oem_= id, .oem_table_id =3D s->oem_table_id }; @@ -284,6 +297,28 @@ static void build_madt(GArray *table_data, riscv_acpi_madt_add_rintc(i, arch_ids, table_data, s); } =20 + /* IMSIC */ + if (s->aia_type =3D=3D VIRT_AIA_TYPE_APLIC_IMSIC) { + /* IMSIC */ + build_append_int_noprefix(table_data, 0x19, 1); /* Type */ + build_append_int_noprefix(table_data, 16, 1); /* Length */ + build_append_int_noprefix(table_data, 1, 1); /* Version */ + build_append_int_noprefix(table_data, 0, 1); /* Reserved */ + build_append_int_noprefix(table_data, 0, 4); /* Flags */ + /* Number of supervisor mode Interrupt Identities */ + build_append_int_noprefix(table_data, VIRT_IRQCHIP_NUM_MSIS, 2); + /* Number of guest mode Interrupt Identities */ + build_append_int_noprefix(table_data, VIRT_IRQCHIP_NUM_MSIS, 2); + /* Guest Index Bits */ + build_append_int_noprefix(table_data, guest_index_bits, 1); + /* Hart Index Bits */ + build_append_int_noprefix(table_data, hart_index_bits, 1); + /* Group Index Bits */ + build_append_int_noprefix(table_data, group_index_bits, 1); + /* Group Index Shift */ + build_append_int_noprefix(table_data, IMSIC_MMIO_GROUP_MIN_SHIFT, = 1); + } + acpi_table_end(linker, &table); } =20 --=20 2.43.0