From nobody Sun Nov 24 18:40:58 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=1721063584; cv=none; d=zohomail.com; s=zohoarc; b=GnCuz6EULQzRoQj6ZG/O1Ax2Vm4JN0Hh5rK9iT87BrKaBCyjqXLElibI3zCrRPceLw4ojn+2xghrAcCGsTwOnpuWgp007m+wU4jpTajsvKjqdy4b+1ol0a05xGo5QJ7RqTDmuOOi79ln8GZR/k0yb06eZtRRHv9yfjhYr+A8nh0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721063584; 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=mGZr15x0eRAM5JYBeNcxfmFVRpj6MMcjWS0cU8CYrYQ=; b=gXDLslu7SOpo6lh/EL7yGUgfpjx7fos7leaVyXEHc3gLDo9WEEVLZsIHuV6PfkJa4vljQOIR1xH2DezM/s5+9VuaLIHLcw6cZIiqq0FaysvQoUdaLH3J99mBWT9/TNTDkHzo4v2vkIenCBE4gv/M/36RskN7rtEEbWY0OIIuthw= 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 1721063584954190.68589920422414; Mon, 15 Jul 2024 10:13:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTPEq-0004vK-9x; Mon, 15 Jul 2024 13:11:48 -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 1sTPEn-0004qR-4Q for qemu-devel@nongnu.org; Mon, 15 Jul 2024 13:11:45 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTPEl-00078s-An for qemu-devel@nongnu.org; Mon, 15 Jul 2024 13:11:44 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-70af8062039so3002097b3a.0 for ; Mon, 15 Jul 2024 10:11:42 -0700 (PDT) Received: from sunil-pc.tail07344b.ts.net ([106.51.187.237]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eca85ccsm4752618b3a.178.2024.07.15.10.11.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jul 2024 10:11:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1721063500; x=1721668300; 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=mGZr15x0eRAM5JYBeNcxfmFVRpj6MMcjWS0cU8CYrYQ=; b=lRZgMpZyOjuhmPBMQfkpZ4nieiVD8DC18skRjMNS+MEQRDTeTvtkv4ibykx9IhISdL kgFE/l9A1DTOJxdBjDVVhRqjjCO7z+oJ7uU+NwnzLggXOMv+gdjPBKVExSDQeTf1pCub PUd4T6orQP+QJHmAWnflu+ca2dLgRPtjvdRI3EXvG58KQmLqcQkll6TxzJ2JFEFEMAFx 7mmAjLOKtJ8HNG838/gDmFBi8CerBRZL2/wUSfYPzU5wqDCDtJXtSVWY/2KqifS32bBK DkIm2r4nOMj9PCsYvNcaPvSJROLEQ5IYUEiauVEyGZQm3o71f6HfAu9WBrLxdbveS4QR 6GgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721063500; x=1721668300; 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=mGZr15x0eRAM5JYBeNcxfmFVRpj6MMcjWS0cU8CYrYQ=; b=P/DLrrFoG09GDspuSG4u4Vafbir2RNisbSnQuLGYMyxWupA8ph0+Tg8/WZBWG7p12k EvZlOOFVFEo1TMyR0OjvNYD6PaxWM6FEgcdnICje/Ls1c4/nNwlP4SFfglEXbhmVpLUA W5+Eqmhzzp3AAQy4LVxHK7qKaD1dVoIWa4VimnitDT9LKZa2jU3eSQ81K90P6UD7pCe9 HYKCVaJ4uOYN4E5t/Ai74bfNUH5RaHPomdKmSyVbZ5OHSsVcqzOniQLminqUo7Lk0KWd iVl8gEJwECyFW5hlRsaYHX/008A0nRzJgkAt3N4zFblRd0eL2xnCDwB6ABv3slbZDoW4 rK5A== X-Gm-Message-State: AOJu0Yxrp4XDQCIMGRCK0fMZ+WMl7tRq7jDDXCAE86bRUTpQT2szkXrG g+or9pGL8mGcHeilcam3zmZHaX/r1cnTn/gIdlbimIGpE0W33U9hMLqXPMm6DfPgucMFLwE6xXA mwyw= X-Google-Smtp-Source: AGHT+IGxYYaRmXTYc10KEUUk0yn+1pRB5m2cSkUgr7mVxhVkKfQ7V4xE91RWDHLTtMXAcJdFIiMuGA== X-Received: by 2002:a05:6a00:c89:b0:706:b10c:548a with SMTP id d2e1a72fcca58-70ba48c701cmr343513b3a.22.1721063499603; Mon, 15 Jul 2024 10:11:39 -0700 (PDT) From: Sunil V L To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , "Michael S . Tsirkin" , Igor Mammedov , Ani Sinha , Sunil V L Subject: [PATCH v3 1/9] hw/riscv/virt-acpi-build.c: Add namespace devices for PLIC and APLIC Date: Mon, 15 Jul 2024 22:41:21 +0530 Message-ID: <20240715171129.1168896-2-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240715171129.1168896-1-sunilvl@ventanamicro.com> References: <20240715171129.1168896-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::435; envelope-from=sunilvl@ventanamicro.com; helo=mail-pf1-x435.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=unavailable 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: 1721063586464116600 Content-Type: text/plain; charset="utf-8" As per the requirement ACPI_080 in the RISC-V Boot and Runtime Services (BRS) specification [1], PLIC and APLIC should be in namespace as well. So, add them using the defined HID. [1] - https://github.com/riscv-non-isa/riscv-brs/blob/main/acpi.adoc (commit : 241575b3189c5d9e60b5e55e78cf0443092713bf) Signed-off-by: Sunil V L Acked-by: Alistair Francis Acked-by: Igor Mammedov --- hw/riscv/virt-acpi-build.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c index 0925528160..5f5082a35b 100644 --- a/hw/riscv/virt-acpi-build.c +++ b/hw/riscv/virt-acpi-build.c @@ -141,6 +141,30 @@ static void acpi_dsdt_add_cpus(Aml *scope, RISCVVirtSt= ate *s) } } =20 +static void acpi_dsdt_add_plic_aplic(Aml *scope, uint8_t socket_count, + uint64_t mmio_base, uint64_t mmio_siz= e, + const char *hid) +{ + uint64_t plic_aplic_addr; + uint32_t gsi_base; + uint8_t socket; + + for (socket =3D 0; socket < socket_count; socket++) { + plic_aplic_addr =3D mmio_base + mmio_size * socket; + gsi_base =3D VIRT_IRQCHIP_NUM_SOURCES * socket; + Aml *dev =3D aml_device("IC%.02X", socket); + aml_append(dev, aml_name_decl("_HID", aml_string("%s", hid))); + aml_append(dev, aml_name_decl("_UID", aml_int(socket))); + aml_append(dev, aml_name_decl("_GSB", aml_int(gsi_base))); + + Aml *crs =3D aml_resource_template(); + aml_append(crs, aml_memory32_fixed(plic_aplic_addr, mmio_size, + AML_READ_WRITE)); + aml_append(dev, aml_name_decl("_CRS", crs)); + aml_append(scope, dev); + } +} + static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap, uint32_t uart_irq) @@ -411,6 +435,14 @@ static void build_dsdt(GArray *table_data, =20 socket_count =3D riscv_socket_count(ms); =20 + if (s->aia_type =3D=3D VIRT_AIA_TYPE_NONE) { + acpi_dsdt_add_plic_aplic(scope, socket_count, memmap[VIRT_PLIC].ba= se, + memmap[VIRT_PLIC].size, "RSCV0001"); + } else { + acpi_dsdt_add_plic_aplic(scope, socket_count, memmap[VIRT_APLIC_S]= .base, + memmap[VIRT_APLIC_S].size, "RSCV0002"); + } + acpi_dsdt_add_uart(scope, &memmap[VIRT_UART0], UART0_IRQ); =20 if (socket_count =3D=3D 1) { --=20 2.43.0