From nobody Wed Nov 27 13:46:20 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 ARC-Seal: i=1; a=rsa-sha256; t=1698672218; cv=none; d=zohomail.com; s=zohoarc; b=BqzSB/OgwtrK6DjrH7LTq3QXwu8DRkV3NGr+umvNMl2JzM4YlVzUlPm7il2s1azbw/VJMr2eAiPkW/vk8LOu/AyyXqURZVUuhayCzmvv3Qsp2vu5izGh4jHe0nwkYY5ifEkcCQsVgyxPtvBnm36xOeioMjEphYhSECRHGvVqBi4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698672218; 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=2ClCKii7oO8Jb+60noegclT3zC+MTWH46ePT9qOzRUs=; b=i00o2wamNaEPGjoQYW6Dx14IPzDtvY5KZ9+vxMDG2fTIZtagiSxIynJr4jOp/nGnt2++DbXkd9yrIaK54CWOOA5L2El7YQ4qCc37h9o/cAXg4mTVqbVavJh9CjekSvWsD80T1D/ByLsXgtm1q7kfkd/vlqFsLOtQV0p/lUiV3P8= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16986722187293.886584810462864; Mon, 30 Oct 2023 06:23:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qxSE0-0008Hz-DA; Mon, 30 Oct 2023 09:22:38 -0400 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 1qxSDw-0008Cx-QC for qemu-devel@nongnu.org; Mon, 30 Oct 2023 09:22:32 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qxSDu-00030D-6j for qemu-devel@nongnu.org; Mon, 30 Oct 2023 09:22:32 -0400 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-5b9a7357553so447837a12.0 for ; Mon, 30 Oct 2023 06:22:29 -0700 (PDT) Received: from sunil-pc.Dlink ([106.51.188.78]) by smtp.gmail.com with ESMTPSA id 15-20020a17090a000f00b0027ced921e80sm8122412pja.38.2023.10.30.06.22.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 06:22:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1698672148; x=1699276948; 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=2ClCKii7oO8Jb+60noegclT3zC+MTWH46ePT9qOzRUs=; b=GyD8UbEVtnHWcl34FzjTjFtpwzPHxjltG5eCHR15Hdw9scTjTTWJ0xIRPibLycIN6c iyeEJGjqqIQ6/DKuE2Imi4MMGRjZU8zkdyxs40eyxcx8WzyJOv3MQz9xeJanevbrJHWb BZJMJQT0jkQ+sfmJXMNhylk6cRKNtZJ9NyVMt3ApB6wUm6A3R86+DM7PRA6ystsQiUCv UdAfepUYbwMryN1JFKjVsTykw+veLOnhT4oDtOwhY2oaMJ7MZDAIAGSlO8x9vqkfuD8b owGc775gBIuvlRh0OcYbdGqW/VZcw6j864sOak0hFLZ8QENAQMhFTDkwe1V2b5eYJQnd Z4TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698672148; x=1699276948; 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=2ClCKii7oO8Jb+60noegclT3zC+MTWH46ePT9qOzRUs=; b=XE16CXH0E2JRd8cS+VqVAenmAZFP1e/n1QXnZJ7fxl7CO6I7bXiG28vqlOz2IKX1Ns hyWi65P56C1KLtEjMGhjoQT3twZL/rkQkgAk3ssDQaJ344P4YM8eQIugCOkmpu0smRBJ Rnnnh1BufvJCOugp1Nxo+uBP+y14BliWVpsGwshue3WJCeZ/iaGXOqUM8G86jVyjXu3s B0DXWqQIKtCZcfsKzSW/tJJ0pwF3tdze2c4OvbMi0qLk01YdXHBf5MLs+SQdOvDJ9bpU u9Xctr475v4uOJ04/tQYvPFOkVx5PXrHF0JjLjMy0M0DamTCDz4Zkq9q7niv+2Js/tvW czgA== X-Gm-Message-State: AOJu0YwY6uShGcTzFq5BQPAEHmDoOGBZ1toVFLQibKMEApu5FWYj4rLH CdE7PlPfMSXOGM+b6KjivuEeWA== X-Google-Smtp-Source: AGHT+IE/T5pPchMg4rrYme6dNCLANmpnRIQWfq5epYmbIaaULYZlnOd9qwpmiDSKziNkj9bvzQZiXg== X-Received: by 2002:a17:90a:ac09:b0:280:19b8:83a6 with SMTP id o9-20020a17090aac0900b0028019b883a6mr6525499pjq.13.1698672148053; Mon, 30 Oct 2023 06:22:28 -0700 (PDT) From: Sunil V L To: qemu-arm@nongnu.org, qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: Peter Maydell , Shannon Zhao , "Michael S . Tsirkin" , Igor Mammedov , Ani Sinha , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Anup Patel , Atish Kumar Patra , Haibo Xu , Sunil V L , Andrew Jones Subject: [PATCH v5 13/13] hw/riscv/virt-acpi-build.c: Add PLIC in MADT Date: Mon, 30 Oct 2023 18:50:58 +0530 Message-Id: <20231030132058.763556-14-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231030132058.763556-1-sunilvl@ventanamicro.com> References: <20231030132058.763556-1-sunilvl@ventanamicro.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::536; envelope-from=sunilvl@ventanamicro.com; helo=mail-pg1-x536.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.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 @ventanamicro.com) X-ZM-MESSAGEID: 1698672219964100001 Content-Type: text/plain; charset="utf-8" Add PLIC structures for each socket in the MADT when system is configured with PLIC as the external interrupt controller. Signed-off-by: Haibo Xu Signed-off-by: Sunil V L Reviewed-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones Acked-by: Alistair Francis --- hw/riscv/virt-acpi-build.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c index 4d03a27efd..d4a02579d6 100644 --- a/hw/riscv/virt-acpi-build.c +++ b/hw/riscv/virt-acpi-build.c @@ -94,6 +94,12 @@ static void riscv_acpi_madt_add_rintc(uint32_t uid, arch_ids->cpus[uid].props.node_id, local_cpu_id), 4); + } else if (s->aia_type =3D=3D VIRT_AIA_TYPE_NONE) { + build_append_int_noprefix(entry, + ACPI_BUILD_INTC_ID( + arch_ids->cpus[uid].props.node_id, + 2 * local_cpu_id + 1), + 4); } else { build_append_int_noprefix(entry, 0, 4); } @@ -494,6 +500,29 @@ static void build_madt(GArray *table_data, build_append_int_noprefix(table_data, s->memmap[VIRT_APLIC_S].size, 4); } + } else { + /* PLICs */ + for (socket =3D 0; socket < riscv_socket_count(ms); socket++) { + aplic_addr =3D s->memmap[VIRT_PLIC].base + + s->memmap[VIRT_PLIC].size * socket; + gsi_base =3D VIRT_IRQCHIP_NUM_SOURCES * socket; + build_append_int_noprefix(table_data, 0x1B, 1); /* Type */ + build_append_int_noprefix(table_data, 36, 1); /* Length */ + build_append_int_noprefix(table_data, 1, 1); /* Version */ + build_append_int_noprefix(table_data, socket, 1); /* PLIC ID */ + build_append_int_noprefix(table_data, 0, 8); /* Hardware = ID */ + /* Total External Interrupt Sources Supported */ + build_append_int_noprefix(table_data, + VIRT_IRQCHIP_NUM_SOURCES - 1, 2); + build_append_int_noprefix(table_data, 0, 2); /* Max Priori= ty */ + build_append_int_noprefix(table_data, 0, 4); /* Flags */ + /* PLIC Size */ + build_append_int_noprefix(table_data, s->memmap[VIRT_PLIC].siz= e, 4); + /* PLIC Address */ + build_append_int_noprefix(table_data, aplic_addr, 8); + /* Global System Interrupt Vector Base */ + build_append_int_noprefix(table_data, gsi_base, 4); + } } =20 acpi_table_end(linker, &table); --=20 2.39.2