From patchwork Thu Feb 16 18:20:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143630 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2ABE1C61DA4 for ; Thu, 16 Feb 2023 18:21:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=H6jI65sLt9a0PPYiSTvqbkwrB8WdDSJYf0WaTDnbgq4=; b=wY03fo5fGY/nxB JI70n2WmadXTlWds9gTsS7gPpOIrB4j4i90AUFjkTU80CuvBNd7gkYJ24zmwZOouYufxBaz/D0R+J 7zmuEquyg/I35KoY2qJL3xQQubmNnFqnhXhn/lsHE99HtTKq8bHb0tP1cE3F9p8d8J+qJKJ2gy8rC bJS0Xo664oSpk+y1IvEG6NO8G7SvafmJnMAG2fcF5OJ5ABv94RSnxjDIk7Hmd7xPs4IkB76Xn0KR/ TYQ7SeqtBsv80FsluocuADTDbcq2Lc/PRbnvBeqxq4RlqO1eN/L1Uw4A08mQlho/JvlkJ3j8RF8R5 +gBlT8JgX+msp/B41AKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSisQ-00BTOM-Hj; Thu, 16 Feb 2023 18:21:02 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSisN-00BTMS-I5 for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:21:00 +0000 Received: by mail-pj1-x102e.google.com with SMTP id nh19-20020a17090b365300b00233ceae8407so2960973pjb.3 for ; Thu, 16 Feb 2023 10:20:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=zt5AKTEcwHiFDwLgavojOfY1pFXS3U3JrowEB907ryU=; b=hh3s2OimS73QDs15kWCc2k+lI5tdH7x4xpQgd7UXBzADhjqkPdoP9zDNLKlvXIcB3j WhapBBPx3FQ50Ef9UATRHacKSfPD51PY94qt/38FAuRex3S4rktbxTUVWewRc4eTYN40 JzddLtS9xtnca0cYhHjA8PPX+Fg2/plv2OigHAVwz7TcxcFWTyONo/Iy/ttkziIKqRJE 7gyNPrVRvfy1tgsW3pJO7dUBOd018tUx1cmCfyC7+4Q7P/xXrxcqGYWDpBJXntex4zNG tNdkvuY106SjtLM/sh3J66oTgx61nmV0t4JUqJc+AhDSIrDtCm3S9H4csLsaqCx/DFi6 CrtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=zt5AKTEcwHiFDwLgavojOfY1pFXS3U3JrowEB907ryU=; b=lw0skcOZKi2KstGptYNOAGkSaAwCJsKxdkLp1UoEJcU7Q05v+CSvf4/Sl0A5YFKU3E q+Wtq7QzZFLP/MufqR3KQ5s2jTVUs3YpAPTW+GS0JZkuIKCXmQEEup/7KEYDUlctr0qb faetlZo9MEzzsAy43QztEHy62mo3Kr1BALCloNxw6qauLWW+Sxz2ctUfGzqKajbGRors AvtGmRsKqSsRY2u9jC94TtimRYcxlMy5frUhl69L+B9P9OtuRndb8rIVsLMYPfiF+LkR o3cb0L/kiAB9OpjGs5DmQRs1m/ame4y19Tb1h7gja6rZQRdQXKRWHzlubiwLlFNBFkJv uong== X-Gm-Message-State: AO0yUKVRzVp08bJmbv965D2jPYbMc6S4DlPdqQKiXWPhVdzBmaX5TSlJ VaRUmO/Ehm6uzZTiwuVwNS4J5g== X-Google-Smtp-Source: AK7set+9ugdYQXsd9nFuZ0RuwmCqqGWgTItMCKqMDeOgGO/BOe4S+YBcFoIYg1vQdLiP3+Rlf9qHHA== X-Received: by 2002:a05:6a21:9814:b0:be:c217:9580 with SMTP id ue20-20020a056a21981400b000bec2179580mr5065551pzb.49.1676571656477; Thu, 16 Feb 2023 10:20:56 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.20.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:20:56 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Cc: linux-riscv@lists.infradead.org, linux-acpi@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Conor Dooley , Andrew Jones , Anup Patel , Atish Patra , Jisheng Zhang , Anup Patel Subject: [PATCH V2 01/21] riscv: move sbi_init() earlier before jump_label_init() Date: Thu, 16 Feb 2023 23:50:23 +0530 Message-Id: <20230216182043.1946553-2-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102059_638058_2732CED9 X-CRM114-Status: GOOD ( 11.97 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Jisheng Zhang We call jump_label_init() in setup_arch() is to use static key mechanism earlier, but riscv jump label relies on the sbi functions, If we enable static key before sbi_init(), the code path looks like: static_branch_enable() .. arch_jump_label_transform() patch_text_nosync() flush_icache_range() flush_icache_all() sbi_remote_fence_i() for CONFIG_RISCV_SBI case __sbi_rfence() Since sbi isn't initialized, so NULL deference! Here is a typical panic log: [ 0.000000] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 [ 0.000000] Oops [#1] [ 0.000000] Modules linked in: [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 5.18.0-rc7+ #79 [ 0.000000] Hardware name: riscv-virtio,qemu (DT) [ 0.000000] epc : 0x0 [ 0.000000] ra : sbi_remote_fence_i+0x1e/0x26 [ 0.000000] epc : 0000000000000000 ra : ffffffff80005826 sp : ffffffff80c03d50 [ 0.000000] gp : ffffffff80ca6178 tp : ffffffff80c0ad80 t0 : 6200000000000000 [ 0.000000] t1 : 0000000000000000 t2 : 62203a6b746e6972 s0 : ffffffff80c03d60 [ 0.000000] s1 : ffffffff80001af6 a0 : 0000000000000000 a1 : 0000000000000000 [ 0.000000] a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000000 [ 0.000000] a5 : 0000000000000000 a6 : 0000000000000000 a7 : 0000000000080200 [ 0.000000] s2 : ffffffff808b3e48 s3 : ffffffff808bf698 s4 : ffffffff80cb2818 [ 0.000000] s5 : 0000000000000001 s6 : ffffffff80c9c345 s7 : ffffffff80895aa0 [ 0.000000] s8 : 0000000000000001 s9 : 000000000000007f s10: 0000000000000000 [ 0.000000] s11: 0000000000000000 t3 : ffffffff80824d08 t4 : 0000000000000022 [ 0.000000] t5 : 000000000000003d t6 : 0000000000000000 [ 0.000000] status: 0000000000000100 badaddr: 0000000000000000 cause: 000000000000000c [ 0.000000] ---[ end trace 0000000000000000 ]--- [ 0.000000] Kernel panic - not syncing: Attempted to kill the idle task! [ 0.000000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]--- Fix this issue by moving sbi_init() earlier before jump_label_init() Signed-off-by: Jisheng Zhang Reviewed-by: Anup Patel Reviewed-by: Atish Patra --- arch/riscv/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index 86acd690d529..4335f08ffaf2 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -270,6 +270,7 @@ void __init setup_arch(char **cmdline_p) *cmdline_p = boot_command_line; early_ioremap_setup(); + sbi_init(); jump_label_init(); parse_early_param(); @@ -287,7 +288,6 @@ void __init setup_arch(char **cmdline_p) misc_mem_init(); init_resources(); - sbi_init(); #ifdef CONFIG_KASAN kasan_init(); From patchwork Thu Feb 16 18:20:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143631 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8E844C636D7 for ; Thu, 16 Feb 2023 18:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Kak9EHll09kOhbhiPyDGRSSOtqIQVyBjPBkloSLePJ8=; b=PydLPNoMo7MSm1 PPYG9UBJ+vY46x9++nTrPcz28Obwl7f7JF6Qj4D8n+q1ben+nTVUAhbKLVoVazm/BKIqJ5CL1gZfQ hxFsDUJvJaUyrL7d3LhaqViolLOQiF1XMMYYmziGwYtUCloUhhCxI87Gw0i/6ZRjOZKpFKeluWaND dzvcO7mJY5uyzzCyXvqUkUI5oytTmz28Vrep2/NS8i6JMy4TDv2RpHlskY6fQ4E1X+51tEQxp8yJj N5Fo5nrB/XpYtHN6iO9gehv6t4vTu8lPriGRLPmh53UENEinLkpX9hxsvKU/5GuBJqwLhVCYuxon2 mMjHTIIfRNRt75v2Uc6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSisV-00BTQm-NR; Thu, 16 Feb 2023 18:21:07 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSisS-00BTOI-Kp for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:21:06 +0000 Received: by mail-pl1-x636.google.com with SMTP id r8so2953701pls.2 for ; Thu, 16 Feb 2023 10:21:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=3T/9WMqfcgE40kVyTz05I09P0F9v/Zdvsnucdf4/Z5g=; b=MBRj07iUrgHWwP/PL9m6AtLW+qb8U18eyO6/36bns9c6UoAOz2OzMnR2e4Cdh6Kv4c 5U3H0CPnIrADmR9yLkbugn1hcLCwwqX07zxNNUuoWIr+c6fZODCF7wT2aZuT+AzlLvOa Q1ROw/0yRUOXRLx+2eqd2dsbqX+/BhpdhlpB5hqPlV9ELFw9Sc/nDaT/FlGczY596ewa V3OBgDoq6t1w7RJfsd72MzeoWGcwoO9R7yCsPe0OdQTxO/2T1f/tTd9iv2nhXTZPKIzc 3dZUhwf3Fr6ueWe9wpMBUEMC2rqOMV0kbLLOHPkBfH84LyRg+JVQuMaOop0ElzXAP9ut jG5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=3T/9WMqfcgE40kVyTz05I09P0F9v/Zdvsnucdf4/Z5g=; b=3nfGo6EewDUhvz8Y7VJW6iM7p9ky/qN/lhS1Lp/fSLVT4FwXTJkogR6rkVlLgDO7x4 F4HF7Oq62/VsWr94Viyyzinl7/hr0l6xivSNqrq4J66uaqwsfxGAGqXDjZpzCe1V9qy5 cc+XZvFIU1ezLH6H/Vvr/uK0P/yDELtoqrxhhNcho48NKrvy79unKOqOC+sSwE5YHzj1 tLhN4Nq+sdnb3WYa+LTjwSFve16VXgtMKHeAG1thb0CkqtZXFF8TL4odtsK9EWJnAnUG UGtX2cZxawveYq9E7hDt23EjDsgKP++ihp/ireZhjtzFlbxhPPXiy3O1tJw7GOe4dSxe rtEg== X-Gm-Message-State: AO0yUKVHfI+CU8l3VmZL7mFh3DJq10qWDGni3FYtSfyiRM19XcgOo8Cn qr2umM4SAmrzUxLjpVELsBABqw== X-Google-Smtp-Source: AK7set8o22c6x1/057iVtVepqFXyS1Iug9Z7IPjx7jh1+w4cPpbGWJMNy8wLXDEg7dW4snHpwIby/Q== X-Received: by 2002:a05:6a20:8f07:b0:bc:7bdd:551b with SMTP id b7-20020a056a208f0700b000bc7bdd551bmr9022499pzk.45.1676571661568; Thu, 16 Feb 2023 10:21:01 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.20.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:21:01 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 02/21] ACPICA: MADT: Add RISC-V INTC interrupt controller Date: Thu, 16 Feb 2023 23:50:24 +0530 Message-Id: <20230216182043.1946553-3-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102104_702606_26BA6177 X-CRM114-Status: GOOD ( 10.79 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, Robert Moore , linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, acpica-devel@lists.linuxfoundation.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The ECR to add RISC-V INTC interrupt controller is approved by the UEFI forum and will be available in the next revision of the ACPI specification. This patch is not yet merged in ACPICA but a PR is raised. ACPICA PR: https://github.com/acpica/acpica/pull/804 Reference: Mantis ID: 2348 Cc: Robert Moore Cc: acpica-devel@lists.linuxfoundation.org Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki --- include/acpi/actbl2.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index b2973dbe37ee..abb700d246df 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h @@ -891,7 +891,8 @@ enum acpi_madt_type { ACPI_MADT_TYPE_MSI_PIC = 21, ACPI_MADT_TYPE_BIO_PIC = 22, ACPI_MADT_TYPE_LPC_PIC = 23, - ACPI_MADT_TYPE_RESERVED = 24, /* 24 to 0x7F are reserved */ + ACPI_MADT_TYPE_RINTC = 24, + ACPI_MADT_TYPE_RESERVED = 25, /* 25 to 0x7F are reserved */ ACPI_MADT_TYPE_OEM_RESERVED = 0x80 /* 0x80 to 0xFF are reserved for OEM use */ }; @@ -1250,6 +1251,24 @@ enum acpi_madt_lpc_pic_version { ACPI_MADT_LPC_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */ }; +/* 24: RISC-V INTC */ +struct acpi_madt_rintc { + struct acpi_subtable_header header; + u8 version; + u8 reserved; + u32 flags; + u64 hart_id; + u32 uid; /* ACPI processor UID */ +}; + +/* Values for RISC-V INTC Version field above */ + +enum acpi_madt_rintc_version { + ACPI_MADT_RINTC_VERSION_NONE = 0, + ACPI_MADT_RINTC_VERSION_V1 = 1, + ACPI_MADT_RINTC_VERSION_RESERVED = 2 /* 2 and greater are reserved */ +}; + /* 80: OEM data */ struct acpi_madt_oem_data { From patchwork Thu Feb 16 18:20:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143632 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 07673C636CC for ; Thu, 16 Feb 2023 18:21:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2MoGNRjelKrQBwH0aIpbh4cIlJB9sgCglx9NFBtPs6Q=; b=wylg0CD2kL/L2k i6oDedk48WpHtTYvxS2TQQIhLldXMKM1tSGC//noK61av9qNS9OLghqYdmHO2oPTZsyYl5DM6oBIk 5Vlr5s6R4gUIft20jIGAHIFEpI0+PWZ3K97G8huYJiZ8lhUcfRWoyKJ5sIyi5ClSZkWBKeynRF1eU gIz+L1wnb7vswZAr9swhB6HAmzHCPsFUcCLqfTHkNhvXTLNqqueNSCkXjgZ4cQg6FZW7pItC33waH SpuN9aR76LVqNSErJ6EsgRYMVuqwc+pEca90SyAnXXD+SplaSpu4yjcbZe3laJ5J+Rl4DValDskf+ rABp5bugCi2Kr+k2Ey/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSisa-00BTTV-UE; Thu, 16 Feb 2023 18:21:12 +0000 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSisX-00BTQM-S9 for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:21:11 +0000 Received: by mail-pj1-x1035.google.com with SMTP id fu4-20020a17090ad18400b002341fadc370so6733971pjb.1 for ; Thu, 16 Feb 2023 10:21:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=pfyzZGOgFR8JpdppLMBGRahWign1okVbjuzaxShQLj4=; b=UUpqTB6AUMM+Rdx7uT+Js1SJiUxUEqdBUlVRwfmgNPvgDY5tG85Wxm3Gwp/IEKUHuZ ENhr7womW2HoZ2BMwxNaM80t9Mvqr8Up6T/0VnSGLxjBCRKnZWmt4kPZ7ak3QDJZv38W qJ3Eq+45h+1FPXzR2jouMZbuuDxkDkqWPQU7lF74NAfc9C2Llq3uqjKOOiXVLcP+8X6z vlBl/lo7NfD/254ux+cQuNFC7vQUjHKUORmYpITy0o+zFBNrvthGinJGsCd+7+5jXJMq vbkDxrrOWBj6Rv701fRDlfv0umCjx8f2ReLN9OtGGlcJq8i+Fm+1hQ53vTXUZ91JcZDU 4sLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=pfyzZGOgFR8JpdppLMBGRahWign1okVbjuzaxShQLj4=; b=SWkR/PVCCvSpBay6R8e8hmPDdbSX5/piFIoIX1d0564LAl9gCO7sBeUIo1IrZMF9jk S7aE+rr9+uXwSO2w4jjbBP117TXwuWgj8qimg4/ZrBOuUJW1NxnOhi2WWK4sE20HyCVl pMhyJ9KGpK1NUAQkjOji2IJRvmNFTzv4XmyAEeQ7lq4/ELCcRshJ26iCy2f0UXbLC4H9 iGpDX2oZk0UQ8U3x36MOvXm8JX5mKVWzJn0HpK26ta3Vbj81gnOnICjSXqmahTW9FdKO Dp97gul+bvMi1YuuzBxz+DUPG8C8wb3SLsjr34KDxhFueEdrpsUIyffw9WcBWAZ7fDmK IaWA== X-Gm-Message-State: AO0yUKUa8IuzvTrmmKjEZDMptuHQvA7WrWMLURr2cASaYfzace/cJlBh jRpU7gCcppUPmRg5y8e7k/DA/Q== X-Google-Smtp-Source: AK7set8JpufQhWdcRJ+BEmmVhZstiF26E90Ef0t3jfC9+K2OuXgwMWuOeImG6W7vD/tbgaaMq/DBCQ== X-Received: by 2002:a05:6a21:6d88:b0:c7:20d8:dc1e with SMTP id wl8-20020a056a216d8800b000c720d8dc1emr3483559pzb.27.1676571666717; Thu, 16 Feb 2023 10:21:06 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.21.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:21:06 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 03/21] ACPICA: Add structure definitions for RISC-V RHCT Date: Thu, 16 Feb 2023 23:50:25 +0530 Message-Id: <20230216182043.1946553-4-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102109_939730_2F854B65 X-CRM114-Status: GOOD ( 11.55 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, Robert Moore , linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, acpica-devel@lists.linuxfoundation.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org RISC-V Hart Capabilities Table (RHCT) is a new static table. The ECR to add RHCT is approved by the UEFI forum and will be available in the next version of the ACPI spec. This patch is not yet merged in ACPICA but a PR is raised. ACPICA PR: https://github.com/acpica/acpica/pull/804 Reference: Mantis: 2349 Cc: Robert Moore Cc: acpica-devel@lists.linuxfoundation.org Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki --- include/acpi/actbl2.h | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index abb700d246df..0715e937a453 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h @@ -47,6 +47,7 @@ #define ACPI_SIG_PRMT "PRMT" /* Platform Runtime Mechanism Table */ #define ACPI_SIG_RASF "RASF" /* RAS Feature table */ #define ACPI_SIG_RGRT "RGRT" /* Regulatory Graphics Resource Table */ +#define ACPI_SIG_RHCT "RHCT" /* RISC-V Hart Capabilities Table */ #define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ #define ACPI_SIG_SDEI "SDEI" /* Software Delegated Exception Interface Table */ #define ACPI_SIG_SDEV "SDEV" /* Secure Devices table */ @@ -2606,6 +2607,52 @@ enum acpi_rgrt_image_type { /******************************************************************************* * + * RHCT - RISC-V Hart Capabilities Table + * Version 1 + * + ******************************************************************************/ + +struct acpi_table_rhct { + struct acpi_table_header header; /* Common ACPI table header */ + u32 reserved; + u64 time_base_freq; + u32 node_count; + u32 node_offset; +}; + +/* + * RHCT subtables + */ +struct acpi_rhct_node_header { + u16 type; + u16 length; + u16 revision; +}; + +/* Values for RHCT subtable Type above */ + +enum acpi_rhct_node_type { + ACPI_RHCT_NODE_TYPE_ISA_STRING = 0x0000, + ACPI_RHCT_NODE_TYPE_HART_INFO = 0xFFFF, +}; + +/* + * RHCT node specific subtables + */ + +/* ISA string node structure */ +struct acpi_rhct_isa_string { + u16 isa_length; + char isa[]; +}; + +/* Hart Info node structure */ +struct acpi_rhct_hart_info { + u16 num_offsets; + u32 uid; /* ACPI processor UID */ +}; + +/******************************************************************************* * SBST - Smart Battery Specification Table * Version 1 * From patchwork Thu Feb 16 18:20:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143633 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 96922C61DA4 for ; Thu, 16 Feb 2023 18:21:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qne/IKBsuGtZiWXzFtqvxTi7f7cBXXQwdpWCypMjcXg=; b=RmJCC4lRX+iizK tb9OqbmODyifmM8RxO9witDRm8NYea3CoS1qlEEXbNfH2LZMQ4Ce6vr+6QPNSbYxmPDqrWu9v8kTU ArJDuye00nOFDJCvp1mozT4vfbt0PuD+sN/FRuI3uCUogBt2gfXx1Y1pt/l2BSK9Y5dBJYTAdLUpp 9PlH0ktLpjxfQLO1uze8+/CRESsGYPSqiORbQpCt1L9FlDhBrLh5BEib3CV4tvmujt4h70b/g0BWG u7b978GD4eJ2OEoirRsE2dRRJKYM0EilwzHYKddT5KLy1A4ikvSX7vA4K4OhwEebLaU1NE3jCD11i E9e+mXkt6tTmG7Rrr1QQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSisd-00BTUv-An; Thu, 16 Feb 2023 18:21:15 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSisa-00BTOI-Ow for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:21:14 +0000 Received: by mail-pl1-x636.google.com with SMTP id r8so2954307pls.2 for ; Thu, 16 Feb 2023 10:21:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=yWquo8X215yUxlcuMVI51NmUYIJJYyh2AH39DTzBzA0=; b=Y/uNQfauyNwP1IebYIQnlrUvDZZmMoA/yun6sqqObhrrmiVowECJlHh8IDwLwV6Mrs MjS//bPzSDjS9aQqAvZYuPwYcBFXD/WKKP12nV6ruoSWOybXib04rUTACCOh8K+yF7w3 z8b4XUnhO+8LxWp/iyPecQcHqNkdQYH8UNVz7ndvMGv62gbahohUlDOgfsoGAxMCRC5H aDVpYVp+KXwC27ZIHotI/AbjsnKL9OYUF78nrwsdf32A0KZk1BpkDo0RODVnzm4q6gEd 5OyE7L6NhGwfXlNfVZZL7vCzosH0KzahtK60qK5vQeHopoWXAvKpE+jw48MKjYmEyq54 nLXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=yWquo8X215yUxlcuMVI51NmUYIJJYyh2AH39DTzBzA0=; b=t17ACAly4qZ0MvTnByxLQGyYedjbzac7HRpihV0vSxLl34JbnBO9xkAreYd89ZzFU9 YHVQ7SxsYtCWPcb95scNimuoJlQeO/xVISOdF8Hjc22OqL1jcDiL0uEmZbGwCTN4xFL6 AaJvXuaI+RwflcwxXa0QczDPpQ0nyw0Oz4GtIR81D4hp1fn2DSRkIzgox4kCjsyqVVFZ SpntYIYwkIfZJ7Mh5SySf5vQ188wb4+pKhnVeuL6rW4GuVFLDc3+uLi9uTH502YXnoOC 2JUFO7JLa55i8k0x3TBLvHn10C0WauY9aZIuQzKs+r4l15zih+hVzrExC9RdKgr1ZQTZ E/6A== X-Gm-Message-State: AO0yUKX7zrLGf90adV4xgkw62o/+vOURczDal1vVlSEb3vgsg0ZAWLDa pyBhQAO0L86PjUBGzv1w76oTxg== X-Google-Smtp-Source: AK7set91n5anNcToKIHo1nCNsdSUc/vn6DLL7/0cepiYJORH2Nk7E/8pcd4AT/BFiFSlkmtsonqO4w== X-Received: by 2002:a05:6a20:a10c:b0:b6:40ae:823e with SMTP id q12-20020a056a20a10c00b000b640ae823emr7326203pzk.5.1676571672339; Thu, 16 Feb 2023 10:21:12 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.21.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:21:11 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 04/21] RISC-V: Add support to build the ACPI core Date: Thu, 16 Feb 2023 23:50:26 +0530 Message-Id: <20230216182043.1946553-5-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102112_830838_5794DFF6 X-CRM114-Status: GOOD ( 20.20 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Enable ACPI core for RISC-V after adding architecture-specific interfaces and header files required to build the ACPI core. 1) Couple of header files are required unconditionally by the ACPI core. Add empty acenv.h and cpu.h header files. 2) If CONFIG_PCI is enabled, a few PCI related interfaces need to be provided by the architecture. Define dummy interfaces for now so that build succeeds. Actual implementation will be added when PCI support is added for ACPI along with external interrupt controller support. 3) A few globals and memory mapping related functions specific to the architecture need to be provided. Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki Reviewed-by: Andrew Jones --- arch/riscv/Kconfig | 5 +++ arch/riscv/include/asm/acenv.h | 11 +++++ arch/riscv/include/asm/acpi.h | 60 +++++++++++++++++++++++++ arch/riscv/include/asm/cpu.h | 8 ++++ arch/riscv/kernel/Makefile | 2 + arch/riscv/kernel/acpi.c | 80 ++++++++++++++++++++++++++++++++++ 6 files changed, 166 insertions(+) create mode 100644 arch/riscv/include/asm/acenv.h create mode 100644 arch/riscv/include/asm/acpi.h create mode 100644 arch/riscv/include/asm/cpu.h create mode 100644 arch/riscv/kernel/acpi.c diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index d153e1cd890b..3ba701b26389 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -12,6 +12,8 @@ config 32BIT config RISCV def_bool y + select ACPI_GENERIC_GSI if ACPI + select ACPI_REDUCED_HARDWARE_ONLY if ACPI select ARCH_CLOCKSOURCE_INIT select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2 @@ -598,6 +600,7 @@ config EFI_STUB config EFI bool "UEFI runtime support" depends on OF && !XIP_KERNEL + select ARCH_SUPPORTS_ACPI if 64BIT select LIBFDT select UCS2_STRING select EFI_PARAMS_FROM_FDT @@ -703,3 +706,5 @@ source "drivers/cpufreq/Kconfig" endmenu # "CPU Power Management" source "arch/riscv/kvm/Kconfig" + +source "drivers/acpi/Kconfig" diff --git a/arch/riscv/include/asm/acenv.h b/arch/riscv/include/asm/acenv.h new file mode 100644 index 000000000000..22123c5a4883 --- /dev/null +++ b/arch/riscv/include/asm/acenv.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * RISC-V specific ACPICA environments and implementation + */ + +#ifndef _ASM_ACENV_H +#define _ASM_ACENV_H + +/* It is required unconditionally by ACPI core */ + +#endif /* _ASM_ACENV_H */ diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h new file mode 100644 index 000000000000..7f9dce3c39d0 --- /dev/null +++ b/arch/riscv/include/asm/acpi.h @@ -0,0 +1,60 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2013-2014, Linaro Ltd. + * Author: Al Stone + * Author: Graeme Gregory + * Author: Hanjun Guo + * + * Copyright (C) 2021-2023, Ventana Micro Systems Inc. + * Author: Sunil V L + */ + +#ifndef _ASM_ACPI_H +#define _ASM_ACPI_H + +/* Basic configuration for ACPI */ +#ifdef CONFIG_ACPI + +/* ACPI table mapping after acpi_permanent_mmap is set */ +void *acpi_os_ioremap(acpi_physical_address phys, acpi_size size); +#define acpi_os_ioremap acpi_os_ioremap + +#define acpi_strict 1 /* No out-of-spec workarounds on RISC-V */ +extern int acpi_disabled; +extern int acpi_noirq; +extern int acpi_pci_disabled; +static inline void disable_acpi(void) +{ + acpi_disabled = 1; + acpi_pci_disabled = 1; + acpi_noirq = 1; +} + +static inline void enable_acpi(void) +{ + acpi_disabled = 0; + acpi_pci_disabled = 0; + acpi_noirq = 0; +} + +/* + * The ACPI processor driver for ACPI core code needs this macro + * to find out this cpu was already mapped (mapping from CPU hardware + * ID to CPU logical ID) or not. + */ +#define cpu_physical_id(cpu) cpuid_to_hartid_map(cpu) + +/* + * Since MADT must provide at least one RINTC structure, the + * CPU will be always available in MADT on RISC-V. + */ +static inline bool acpi_has_cpu_in_madt(void) +{ + return true; +} + +static inline void arch_fix_phys_package_id(int num, u32 slot) { } + +#endif /* CONFIG_ACPI */ + +#endif /*_ASM_ACPI_H*/ diff --git a/arch/riscv/include/asm/cpu.h b/arch/riscv/include/asm/cpu.h new file mode 100644 index 000000000000..ea1a88b3d5f2 --- /dev/null +++ b/arch/riscv/include/asm/cpu.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef _ASM_CPU_H +#define _ASM_CPU_H + +/* It is required unconditionally by ACPI core */ + +#endif /* _ASM_CPU_H */ diff --git a/arch/riscv/kernel/Makefile b/arch/riscv/kernel/Makefile index 67f542be1bea..f979dc8cf47d 100644 --- a/arch/riscv/kernel/Makefile +++ b/arch/riscv/kernel/Makefile @@ -90,3 +90,5 @@ obj-$(CONFIG_EFI) += efi.o obj-$(CONFIG_COMPAT) += compat_syscall_table.o obj-$(CONFIG_COMPAT) += compat_signal.o obj-$(CONFIG_COMPAT) += compat_vdso/ + +obj-$(CONFIG_ACPI) += acpi.o diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c new file mode 100644 index 000000000000..81d448c41714 --- /dev/null +++ b/arch/riscv/kernel/acpi.c @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * RISC-V Specific Low-Level ACPI Boot Support + * + * Copyright (C) 2013-2014, Linaro Ltd. + * Author: Al Stone + * Author: Graeme Gregory + * Author: Hanjun Guo + * Author: Tomasz Nowicki + * Author: Naresh Bhat + * + * Copyright (C) 2021-2023, Ventana Micro Systems Inc. + * Author: Sunil V L + */ + +#include +#include +#include + +int acpi_noirq = 1; /* skip ACPI IRQ initialization */ +int acpi_disabled = 1; +EXPORT_SYMBOL(acpi_disabled); + +int acpi_pci_disabled = 1; /* skip ACPI PCI scan and IRQ initialization */ +EXPORT_SYMBOL(acpi_pci_disabled); + +/* + * __acpi_map_table() will be called before paging_init(), so early_ioremap() + * or early_memremap() should be called here to for ACPI table mapping. + */ +void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size) +{ + if (!size) + return NULL; + + return early_memremap(phys, size); +} + +void __init __acpi_unmap_table(void __iomem *map, unsigned long size) +{ + if (!map || !size) + return; + + early_memunmap(map, size); +} + +void *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) +{ + return memremap(phys, size, MEMREMAP_WB); +} + +#ifdef CONFIG_PCI + +/* + * These interfaces are defined just to enable building ACPI core. + * TODO: Update it with actual implementation when external interrupt + * controller support is added in RISC-V ACPI. + */ +int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn, + int reg, int len, u32 *val) +{ + return PCIBIOS_DEVICE_NOT_FOUND; +} + +int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, + int reg, int len, u32 val) +{ + return PCIBIOS_DEVICE_NOT_FOUND; +} + +int acpi_pci_bus_find_domain_nr(struct pci_bus *bus) +{ + return -1; +} + +struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) +{ + return NULL; +} +#endif /* CONFIG_PCI */ From patchwork Thu Feb 16 18:20:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143634 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 76056C636CC for ; Thu, 16 Feb 2023 18:21:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9GgoAzC0hdYui/fx8WMn8RqJS8Ox7Ed7ss2+SCCIeWY=; b=3I0iN7QFT8soYY t2RMLdQ0FwYMSyqal7UsYtcfEcJbpWZGbec2BadZCIZFqYCcvjL69NzBU7hTfQM/j/EZlE5P1zRt3 AMFoNZZKMyQhG/68B93/mQCxweYqvlmFdYlzfmV/wX50oHRnDl3rFd4f10fV0wpcQ0jxB6CE9Dz5C XRirkP2XKK9HJ9771amydjKSA2VnqgWW+cv+jynnqeUqWZsoJGjTU35cpeH6gsbvX5UUlKn3wl9yg IwRjlpfgJ7UmSWi1+SF8k/Md7z8ght+rXnsfVrbh8o5+beh1hISM9d9cf2yNkFkRUvpGSCAqG57mT n7q6ehkiqW00MrGn6j/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSish-00BTYB-Lv; Thu, 16 Feb 2023 18:21:19 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSisf-00BTWS-ES for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:21:18 +0000 Received: by mail-pl1-x630.google.com with SMTP id ja21so2897153plb.13 for ; Thu, 16 Feb 2023 10:21:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=IRX9Rh9lefADAfWYEbY0yIAAiynI9MZaTYH+yetjREM=; b=IaeR6uCOYqxkxcPO2OyZK+7eC6B5XWUpETzkV429cXcAgdslHLazNahirlmg6GJ8nt ZxrE9y/gCeS9R3rDQdwL6ajjbBDd26jf7ah+E/ozJpUScU2Hs+caXXwpejxxCR18bBU5 QNKpQffB0OL67KNEN3pFW1lBC/gH9rY9bKHvtpm6/Plg4D4UklunHYOF9ee3xh/FJ8fg YWtE0U1o4BV11Ioa48QOdk/Y5DLLCGTR9ZcNpwCOm0D6MtRbodmOEuxChDMNlSDPHFN5 VLFqJLp/kX3fdGCWO4vPoek08/oItOINvIreIDT7iodgxsdmmImQdjNXsthZ5FVMYJ15 EWaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=IRX9Rh9lefADAfWYEbY0yIAAiynI9MZaTYH+yetjREM=; b=AnQt3XYfA+bm+UPftQ7CjpbwKtmi+iPSIajnegD5zg34qVkIg8u0YZpMNXV81naCcK v8S2uHbaP2qyX71eGlPw+eT9sW+Q+Bfbl7lQ7b263XQ//fyol87ITfoKmWSkAUzc1vWu chDcpk872LNJDB1JwmExVlzt66zxaDrD8WJ12cih1os5O2QU7S1uM2OPSj0QaIAjTSFG uyoC7m5gvygLI2sIQczkOR7whFXIuVH8XYTyHyGgikJ6gsswZhC6jZUE+waCC3/LphMQ OxHRnWVAWUCq5ivvXIIE1AL1n89OOmCqZYWB24m2C9H7RYqnPYjYDtfpMvEeTFcNhXHc 20Yg== X-Gm-Message-State: AO0yUKVBTb/FaUXOrVVdc1E6ywmMErzzdZNN8ZL3fLHgxpKNaJPw70HU KRZdvK+fhKHpkIvBU5cdqgonuQ== X-Google-Smtp-Source: AK7set8xLrx+1PXJVXcHl9Dg9zSUmVDJVoqpG5XSTjL+yDDVADutOhkLtType5mYRLOojwQIa6F3zw== X-Received: by 2002:a05:6a20:3d0c:b0:bc:61d5:7bf2 with SMTP id y12-20020a056a203d0c00b000bc61d57bf2mr7783217pzi.34.1676571676972; Thu, 16 Feb 2023 10:21:16 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.21.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:21:16 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 05/21] ACPI: Kconfig: Enable ACPI_PROCESSOR for RISC-V Date: Thu, 16 Feb 2023 23:50:27 +0530 Message-Id: <20230216182043.1946553-6-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102117_509263_4191EB5C X-CRM114-Status: UNSURE ( 9.87 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Enable the ACPI processor driver for RISC-V. Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki --- drivers/acpi/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index ccbeab9500ec..b44ac8e55b54 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -281,7 +281,7 @@ config ACPI_CPPC_LIB config ACPI_PROCESSOR tristate "Processor" - depends on X86 || IA64 || ARM64 || LOONGARCH + depends on X86 || IA64 || ARM64 || LOONGARCH || RISCV select ACPI_PROCESSOR_IDLE select ACPI_CPU_FREQ_PSS if X86 || IA64 || LOONGARCH select THERMAL From patchwork Thu Feb 16 18:20:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED4C0C61DA4 for ; Thu, 16 Feb 2023 18:21:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CxcR/zLSiEZMgfC86wbIVeqbQCJSjVF9LZXELUKz7fU=; b=IKt3I+0FyrqWIt bNfuqFl5cRGzXn+vhvB2seal1ArmiarJLp4IgDoUsV+y2eiO3nbY8IZw2wISA0wyrZ9FYIKvz2lyR yvYdIBx4l7q8wmFYjkmvrV3HbfYVFJqUMuvntSyM2IQcBxyHDU1q9laej/Pq+PXfeSxcwl7BwbAN/ JfKVI3yVOxGMWobQ65eLD0dgGm5592h71GjQrqSHlA3vEcZQYMe3M5n98gOjeA3NGfUIxj1vtG+J9 kp/Dc8myZcooBhnxHCrxxvTNSPBvtwNUrD20dJAUZqYzgaK/MWm9tt/sUi2b952FUUOfEhtAuajjM e/hGlbnNOtNfVERMdzWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSisq-00BTdx-2M; Thu, 16 Feb 2023 18:21:28 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSism-00BTZq-MJ for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:21:25 +0000 Received: by mail-pj1-x102d.google.com with SMTP id kk7-20020a17090b4a0700b00234463de251so6706608pjb.3 for ; Thu, 16 Feb 2023 10:21:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=g9sxg5LZ/1sJSiDItv56ESM72UWoohRRXZed1vK0StQ=; b=I5b4VocraQIzy74N6/WkUSoEflR7yik4OQfTnlBnTTAhyc9/7L7kZrDieGxf5g+3nm 8jov6jOgh5KiNaZd5Eaa7Vfd+keKgSYotzhC6UN9lRBO7zglAi7u1MIu4JtEtffb1qC4 dtXduPqacGJKwS4he3LX/xaSnKLvpeDfpeAtrCDtAUe5w4SXN4V3liCjE7jYSJxAhPp8 DASKy2oFicLS4SBOSKLvGzogHewOZG+O+NkMXBohSjcp/cq1irt5j+D1lDQxPVx9M2Ni dBAbL6WViE6T6Vldp2yhiqPJLShLBhApPxCeMBFjOnsg9MH8T1AV3a3db480pdXDA4YB xymw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=g9sxg5LZ/1sJSiDItv56ESM72UWoohRRXZed1vK0StQ=; b=upa62R/e9wKp9//E8dXASQwghJJVysAbR1hT5UoZjj9y+HXQ9QkfFeEFxNfDcKYyak lPjI/IHSmZ2aKUWO8zSasJ20ClOMBL75Uy7PthalL/HlEw9vz70mm5vqFLA87Z+CcVxu 1kXWCF7WdstJV58Qanh8twyRfGKEUh2q9Qq3fkAt3mC2nSc37jG3i/lr13XS8AtitlLX 6RoRkCUuMJ13S4rAaEsoWYwpw1RNSXPoD8UspaeJ43Nr/wpjmk/TGUP8KglP7hsB1IM5 QgA5kGx0sgyhuiHkJwZIYIT+b6Je4xCyfE7v/wne1qKAKtDq+j559k84U1XOZaKQVrDD JOfQ== X-Gm-Message-State: AO0yUKV0yfJ0XCCBSCw71NCB8D45hhuCA2OeU3KYhv+JrQsFx7YRAFVV ZjiI4FGdFn0lh/22yN13sykHVw== X-Google-Smtp-Source: AK7set+LkiYEtVszqIim+13FtoK1iDZchye9bkxcSiZhQvPVVkT3nRpoNkcezYVva1ZFDzq4Dzm6XA== X-Received: by 2002:a17:902:c943:b0:199:1f42:8bed with SMTP id i3-20020a170902c94300b001991f428bedmr3110483pla.12.1676571681615; Thu, 16 Feb 2023 10:21:21 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.21.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:21:21 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 06/21] ACPI: OSL: Make should_use_kmap() 0 for RISC-V. Date: Thu, 16 Feb 2023 23:50:28 +0530 Message-Id: <20230216182043.1946553-7-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102124_744069_012B1B59 X-CRM114-Status: UNSURE ( 8.89 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Without this, if the tables are larger than 4K, acpi_map() will fail. Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki --- drivers/acpi/osl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 3269a888fb7a..f725813d0cce 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -276,7 +276,7 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size) return NULL; } -#if defined(CONFIG_IA64) || defined(CONFIG_ARM64) +#if defined(CONFIG_IA64) || defined(CONFIG_ARM64) || defined(CONFIG_RISCV) /* ioremap will take care of cache attributes */ #define should_use_kmap(pfn) 0 #else From patchwork Thu Feb 16 18:20:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143636 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1B286C636CC for ; Thu, 16 Feb 2023 18:21:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lFbHauLpPwdoNvcChxkc1GObu0479eyLIXYOpL+P90Y=; b=wwxtiaXbk/VKKd gmF1DEI4hiquR8diqwjlwBcF5MowUeczmBYZDHvOqWnCCK2bcFW5I43oyGq62zkH+lAQvqA/2xGtC w2Uz0FxgPllYryJndEIeubK9MIyIGz14HHrGb6bFQiksRQYRn941qr0mLuRjo7meKkDUE9WJr/lgW aeda2OmzRWPrLKDznGsJQXv2agZRpDVc8cOGDDClK7WMHefTLg6hH37Tevn00XbXzQDK+4J+O1tZC PLktkpVL4N9yEvQTs/AyTKewwooEjsjFWcTnxaIxwTvreoye90G2xg98WQ3Hu4PAHHw7davJ4XROH 5eo85ENazEsjSSSHbjQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSist-00BTgI-9F; Thu, 16 Feb 2023 18:21:31 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSisr-00BTd1-Ft for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:21:30 +0000 Received: by mail-pl1-x62a.google.com with SMTP id be8so2926210plb.7 for ; Thu, 16 Feb 2023 10:21:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=BcT4AtxywBaHPbxQbaGHDpYZBRDu3wCeHMqaXv1EYt0=; b=DBvjTCZIk+vcPUW8htmerk0xAsi1O8tw5BcDSym3jNNFaZhhj3sFESEoaQ0Yhv+703 j8AYTC/u7Z/JO44B/X+ZAXpYgAeZo6CliuHuUiaI2SCgIHy08Vso71L7TFcQ5jrXVdXU +8DDEuVrWcKm2wX9Z65//j6ETTkMzUIUCeacXa28ze6Z91EQ+V9RcPVlcirQdwLHMQ7L Tb3icHXPx7r/fuy+GHWyv6oMBMJ0RbQNMBQT1CGYvHYJA9xXnvOHefF7BG38Ka/VjJj6 dzyVpCKn22c8RKIuz91QYGwKHayKz4n9RlwrYMCMj1lzUiRCr7SMicUmQQmj7eXcCd2B 6kkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=BcT4AtxywBaHPbxQbaGHDpYZBRDu3wCeHMqaXv1EYt0=; b=ZC5YRzlJP5EjXx28sqCE3FRpYHxJXs7UZRP6/zavFom7M0UVB3jW3ySpORw1ZX4fjS WkhTAfcWSeo2+42eZWCxDzyhH7FEOUetrNjAhNxfMsxYTssu3b14d9/rB6WiI3XRwBi+ L+lhvvMzp66Mn4VDa+p1Tq1smOE60hm4bkLGwvqm7lT4nYUVHQgh6FDgcKl+zt2dCt+k rTTVcD09Elx5jjR4bcjmxqUFljZ8mBqU3/u58oHGizsV5QALcR4E3P2CjzSGQ7a0y7f7 kxrL26POPCfcPMBXCrGIyyTIVxzkwlxBTqXYKS4vQTIkt214usZnJ+oHHXt6BbuL6dSB l5zg== X-Gm-Message-State: AO0yUKWGDmkXfITM5RQM9Se7r2uSuXSuwNG/+koSkxC24EU/t9TokM3A 4sj+dxQFXcR6E8//eyLYdO3KBg== X-Google-Smtp-Source: AK7set/AV2KvpGFqrQGHQJmsjVHVKIBcpK63WtqcfvUGKzjHaIsSSBk+G/PwqwPeXhCn+qXzFNe57w== X-Received: by 2002:a17:902:f312:b0:19a:a647:1880 with SMTP id c18-20020a170902f31200b0019aa6471880mr5075210ple.24.1676571686430; Thu, 16 Feb 2023 10:21:26 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.21.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:21:26 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 07/21] ACPI: processor_core: RISC-V: Enable mapping processor to the hartid Date: Thu, 16 Feb 2023 23:50:29 +0530 Message-Id: <20230216182043.1946553-8-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102129_551294_9D054475 X-CRM114-Status: GOOD ( 13.90 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org processor_core needs arch-specific functions to map the ACPI ID to the physical ID. In RISC-V platforms, hartid is the physical id and RINTC structure in MADT provides this mapping. Add arch-specific function to get this mapping from RINTC. Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki Reviewed-by: Andrew Jones --- arch/riscv/include/asm/acpi.h | 3 +++ drivers/acpi/processor_core.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h index 7f9dce3c39d0..4a3622b38159 100644 --- a/arch/riscv/include/asm/acpi.h +++ b/arch/riscv/include/asm/acpi.h @@ -15,6 +15,9 @@ /* Basic configuration for ACPI */ #ifdef CONFIG_ACPI +typedef u64 phys_cpuid_t; +#define PHYS_CPUID_INVALID INVALID_HARTID + /* ACPI table mapping after acpi_permanent_mmap is set */ void *acpi_os_ioremap(acpi_physical_address phys, acpi_size size); #define acpi_os_ioremap acpi_os_ioremap diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 2ac48cda5b20..d6606a9f2da6 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -106,6 +106,32 @@ static int map_gicc_mpidr(struct acpi_subtable_header *entry, return -EINVAL; } +/* + * Retrieve the RISC-V hartid for the processor + */ +static int map_rintc_hartid(struct acpi_subtable_header *entry, + int device_declaration, u32 acpi_id, + phys_cpuid_t *hartid) +{ + struct acpi_madt_rintc *rintc = + container_of(entry, struct acpi_madt_rintc, header); + + if (!(rintc->flags & ACPI_MADT_ENABLED)) + return -ENODEV; + + /* device_declaration means Device object in DSDT, in the + * RISC-V, logical processors are required to + * have a Processor Device object in the DSDT, so we should + * check device_declaration here + */ + if (device_declaration && rintc->uid == acpi_id) { + *hartid = rintc->hart_id; + return 0; + } + + return -EINVAL; +} + static phys_cpuid_t map_madt_entry(struct acpi_table_madt *madt, int type, u32 acpi_id) { @@ -136,6 +162,9 @@ static phys_cpuid_t map_madt_entry(struct acpi_table_madt *madt, } else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT) { if (!map_gicc_mpidr(header, type, acpi_id, &phys_id)) break; + } else if (header->type == ACPI_MADT_TYPE_RINTC) { + if (!map_rintc_hartid(header, type, acpi_id, &phys_id)) + break; } entry += header->length; } From patchwork Thu Feb 16 18:20:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143637 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D8600C636CC for ; Thu, 16 Feb 2023 18:21:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7mWEHSR8FYpN1WhVDIpFs1HIPTgHJ12uTNvSdVRkszk=; b=KmExBALrjzdUxD ZeY8PAsAFhapke7oc5qd0tF8TaijjGuBCifs/Cn+r0GBvIRqRN9FNVyqG0W9s8tt1yUqZi9lfjH1f HS/Z3QhCG8Tc/pRpeXZ7vHZG4OEP71Qo0La+DJ1sU7okwus56zbZIkqt9xFU+gzj6gAqpQwo0LANk X8G/VkKHqnnDGIVpV79WfLymfzWmQnKmozxU51Qrn2riYUELxP0kEpIZHYtpNkSAHBSuTRVNxTPUo kzx6QzqLy4SFb8ZZFDc/CpGmBLYpjeaM1YH540DbSDXsYFRzBZv+xaFRp1LQsFOLnAbHel8mvBVOC t0JHZNQfPewd7PEV2A3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSisy-00BTkO-Io; Thu, 16 Feb 2023 18:21:36 +0000 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSisw-00BTgY-74 for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:21:35 +0000 Received: by mail-pj1-x102b.google.com with SMTP id w20-20020a17090a8a1400b00233d7314c1cso6702992pjn.5 for ; Thu, 16 Feb 2023 10:21:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=DbqUdM0Np7Pk7D6Eh4B7c+w7Zw8p8e1vDp1GKV/olkQ=; b=Cxq4zjw6jiDo0nQwfwBieSzkX5YKjnoBEYHQiqtfjZyMdT4h+ntnTqUCdo5Wqdqta0 ioZNZDx7RU8k2x6nUSYhWooOIkqR54fOtPJeGxRsVBAa2ZZhRP7TZhrr9owiZz2GGBHB WAJQzXBVDEFvJeqrn3TzwwT/s+EK3ralTgIMJ0mUMgjQLJLLfRkOGru9dJWPcJltXLjk LEOXzMqeDhuBiJAagG3w6+jB/nEB0QtgvXnzpPFKnRGFFfuF3aUeByZJIwKRfL+S7u02 /+D1ANFIH2qVAGIRGe1SiPpvpVsX95nacHF8qpOzjqVvk+TuwDzE2mPhUyhw7eSnGm6q UGHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=DbqUdM0Np7Pk7D6Eh4B7c+w7Zw8p8e1vDp1GKV/olkQ=; b=gKiJ//xKNiy/w8XmMX+Y8v9f0j2LP/gu4/Se2odTDgIdVQg7AXseFGvv/PnV3GVz5J 1EsDglF89h5TFVdVsAhcmQW41R+OMMh87Yz1gzIfSaye9oynNfHaMHMa62ui8RXI9Die aL8FdilVjazLg/JoPYDM8Lsaq9apEOTbpju+2s8hkUQK5gY743deL+4yKObdltlB9lh9 ByKt0JnDkhomcx9md3D/jJdkohuIqiZmi3679+9sx2KBYBTreCQcXukJAofi6xXElm/F eKtbOy35HtC+AaI5GRMHDZtA/3UHcvFXD0sNAXED6+pdHzA+KhvkBwSkkQB5J60KePkq UW8Q== X-Gm-Message-State: AO0yUKWEzc5/3TWVkkuc+LFEokP5czHyReyVFf6cGR4I4noyfn819Dgh QrVLWc49B1Tn8Gje0YQEjBZPAg== X-Google-Smtp-Source: AK7set92zVfUHWrg1/Q0sW3fQ8AVEVUXiUYMgvdI1LbFQ5T6RfJCH71VvejNUnOObpioR2uotsiGjw== X-Received: by 2002:a05:6a20:4287:b0:c6:d742:681d with SMTP id o7-20020a056a20428700b000c6d742681dmr3527284pzj.12.1676571691092; Thu, 16 Feb 2023 10:21:31 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.21.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:21:30 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 08/21] drivers/acpi: RISC-V: Add RHCT related code Date: Thu, 16 Feb 2023 23:50:30 +0530 Message-Id: <20230216182043.1946553-9-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102134_276050_C4741838 X-CRM114-Status: GOOD ( 21.99 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org RHCT is a new table defined for RISC-V to communicate the features of the CPU to the OS. Create a new architecture folder in drivers/acpi and add RHCT parsing code. Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki Reviewed-by: Andrew Jones --- arch/riscv/include/asm/acpi.h | 9 ++++ drivers/acpi/Makefile | 2 + drivers/acpi/riscv/Makefile | 2 + drivers/acpi/riscv/rhct.c | 92 +++++++++++++++++++++++++++++++++++ 4 files changed, 105 insertions(+) create mode 100644 drivers/acpi/riscv/Makefile create mode 100644 drivers/acpi/riscv/rhct.c diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h index 4a3622b38159..7bc49f65c86b 100644 --- a/arch/riscv/include/asm/acpi.h +++ b/arch/riscv/include/asm/acpi.h @@ -58,6 +58,15 @@ static inline bool acpi_has_cpu_in_madt(void) static inline void arch_fix_phys_package_id(int num, u32 slot) { } +int acpi_get_riscv_isa(struct acpi_table_header *table, + unsigned int cpu, const char **isa); +#else +static inline int acpi_get_riscv_isa(struct acpi_table_header *table, + unsigned int cpu, const char **isa) +{ + return -EINVAL; +} + #endif /* CONFIG_ACPI */ #endif /*_ASM_ACPI_H*/ diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index feb36c0b9446..3fc5a0d54f6e 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -131,3 +131,5 @@ obj-y += dptf/ obj-$(CONFIG_ARM64) += arm64/ obj-$(CONFIG_ACPI_VIOT) += viot.o + +obj-$(CONFIG_RISCV) += riscv/ diff --git a/drivers/acpi/riscv/Makefile b/drivers/acpi/riscv/Makefile new file mode 100644 index 000000000000..8b3b126e0b94 --- /dev/null +++ b/drivers/acpi/riscv/Makefile @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +obj-y += rhct.o diff --git a/drivers/acpi/riscv/rhct.c b/drivers/acpi/riscv/rhct.c new file mode 100644 index 000000000000..5bafc236d627 --- /dev/null +++ b/drivers/acpi/riscv/rhct.c @@ -0,0 +1,92 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2022-2023, Ventana Micro Systems Inc + * Author: Sunil V L + * + */ + +#define pr_fmt(fmt) "ACPI: RHCT: " fmt + +#include + +static void acpi_rhct_warn_missing(void) +{ + pr_warn_once("No RHCT table found\n"); +} + +static struct acpi_table_header *acpi_get_rhct(void) +{ + static struct acpi_table_header *rhct; + acpi_status status; + + /* + * RHCT will be used at runtime on every CPU, so we + * don't need to call acpi_put_table() to release the table mapping. + */ + if (!rhct) { + status = acpi_get_table(ACPI_SIG_RHCT, 0, &rhct); + if (ACPI_FAILURE(status)) + acpi_rhct_warn_missing(); + } + + return rhct; +} + +/* + * During early boot, the caller should call acpi_get_table() and pass its pointer to + * these functions(and free up later). At run time, since this table can be used + * multiple times, pass NULL so that the table remains in memory + */ +int acpi_get_riscv_isa(struct acpi_table_header *table, unsigned int acpi_cpu_id, const char **isa) +{ + struct acpi_rhct_node_header *node, *ref_node, *end; + struct acpi_table_rhct *rhct; + struct acpi_rhct_hart_info *hart_info; + struct acpi_rhct_isa_string *isa_node; + u32 *hart_info_node_offset; + int i, j; + u32 size_hdr = sizeof(struct acpi_rhct_node_header); + u32 size_hartinfo = sizeof(struct acpi_rhct_hart_info); + + if (acpi_disabled) { + pr_debug("%s: acpi is disabled\n", __func__); + return -1; + } + + if (!table) { + rhct = (struct acpi_table_rhct *)acpi_get_rhct(); + if (!rhct) + return -ENOENT; + } else { + rhct = (struct acpi_table_rhct *)table; + } + + node = ACPI_ADD_PTR(struct acpi_rhct_node_header, rhct, rhct->node_offset); + end = ACPI_ADD_PTR(struct acpi_rhct_node_header, rhct, rhct->header.length); + + for (i = 0; i < rhct->node_count; i++) { + if (node >= end) + break; + switch (node->type) { + case ACPI_RHCT_NODE_TYPE_HART_INFO: + hart_info = ACPI_ADD_PTR(struct acpi_rhct_hart_info, node, size_hdr); + hart_info_node_offset = ACPI_ADD_PTR(u32, hart_info, size_hartinfo); + if (acpi_cpu_id != hart_info->uid) + break; + for (j = 0; j < hart_info->num_offsets; j++) { + ref_node = ACPI_ADD_PTR(struct acpi_rhct_node_header, + rhct, hart_info_node_offset[j]); + if (ref_node->type == ACPI_RHCT_NODE_TYPE_ISA_STRING) { + isa_node = ACPI_ADD_PTR(struct acpi_rhct_isa_string, + ref_node, size_hdr); + *isa = isa_node->isa; + return 0; + } + } + break; + } + node = ACPI_ADD_PTR(struct acpi_rhct_node_header, node, node->length); + } + + return -1; +} From patchwork Thu Feb 16 18:20:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143638 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8A472C61DA4 for ; Thu, 16 Feb 2023 18:21:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yXNiCi927UI767K50XD7zb6dNlMrJGGipdIqCiE3oF4=; b=lhQ0XYlSVnjRaU 8mojEsTOuZBAr1DoeUzBLeDxdRy1VRA1nL397S3N385eslmAF8WH7tP6NRv4pZhmKnl4piHrDo2KA SrX+KHY0xw0/XHPc4DizhWvzJ9f15EYT7lYTY0xJV2AQ7dKVR8ee5cFB3eK5sVRdcdF29SuFTDSXd M8WEZFg783gmYw3MYzihUkxG20sO5NuR1JT5MlDmyunSBLbjKTpbVxGcdOhvfLOBynyOp5j56kLbO nuDCgFABcgSWsLRbg0uz5KzYxkWS30ZPzRAuLXSxf/ok2N33nzf7lJkuFmnA4C0b0y3/+cY6Jrsxs wJhRJ4jbpkbT3Gzg0Qrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSit4-00BToc-3M; Thu, 16 Feb 2023 18:21:42 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSit1-00BTk6-2e for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:21:40 +0000 Received: by mail-pj1-x1029.google.com with SMTP id bx22so2712018pjb.3 for ; Thu, 16 Feb 2023 10:21:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=1TvuJr54uYfZYo8HSlRmVGPkAT+/kE+f0Y+wFUBrfiQ=; b=T8ZVYzQ363zfTHRmFc9Jj62v2RoZaVNJV/KSLrEC3vZXuFiM0hJTn+RLJkF6ILJA7J GArJJR5zxRlWWcUdo50vWXdvsthFhIsuTgkdCKDo47kU8XsBJ29b1FymHg2Js835U/mo CEtDFau+/1jI1mXWRLBnP1SKWAduXmIY1avdHCWj+//ufeIXUlnRmWt1M/tHVZ49S1X8 BGwXlXGsaHbjRi8enrhc7NwEq9AKnN2ZUDIvySSMJNmYsbmn1beDmvNsglEV0svadKar 6ptrElsOtU4YSa/V+Mxs9dnfeRU17fORaYp3yaFy6yiycz8YTqNd/lGtv2t/s6LLgUXB GrcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=1TvuJr54uYfZYo8HSlRmVGPkAT+/kE+f0Y+wFUBrfiQ=; b=yBEqPAx2gh8VOpy2aiy89y1LZFdU/SV6WqEW1TlKIbTKVQJJVc/pYTMdUq5qGp30WI /5I9I4W2x7e7tt4YuL+p+8dqAJMGn9boMYT1L0f8hAGeEeopCyARm8NCzM2l3uttEfIa H3tJdhsSQ0AIxyDFgpmc+Nu04YahmfwBduto6pLHBjurl/STi48yKE+/elhu5k11qv7b SKEo1ZGLDxfOeZLr84Kby0/MyM1dE0pFk3tcgjI7jUXzFhqhX3tophmLFObF1ic8dF9H LxziWhubGsZ/3hhYyLWwApgYNpxLwiTV703ZAWZa8ckH7lo0+qm5limtj/ziwaKoNnQH dxmw== X-Gm-Message-State: AO0yUKX2DT1jCdriPRceF9v+6YDlXiENNeQ6237zH40bJJfihfaoeWET 5+f5gnLUSVLR0u3F6P3xd/mV1g== X-Google-Smtp-Source: AK7set9+BdbKgkpHzRAqTpNzOousZHvPUaa1x+OuyfWcWse1hD2JwD3lY47+FfAaFO3tCGLWbbQP9w== X-Received: by 2002:a05:6a20:7f92:b0:c7:1bd0:c575 with SMTP id d18-20020a056a207f9200b000c71bd0c575mr4133361pzj.19.1676571695888; Thu, 16 Feb 2023 10:21:35 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.21.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:21:35 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 09/21] RISC-V: smpboot: Create wrapper smp_setup() Date: Thu, 16 Feb 2023 23:50:31 +0530 Message-Id: <20230216182043.1946553-10-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102139_149632_EAA0E483 X-CRM114-Status: UNSURE ( 9.62 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org smp_setup() currently assumes DT-based platforms. To enable ACPI, first make this a wrapper function and move existing code to a separate DT-specific function. Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki Reviewed-by: Conor Dooley Reviewed-by: Andrew Jones --- arch/riscv/kernel/smpboot.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index 00b53913d4c6..26214ddefaa4 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -70,7 +70,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) } } -void __init setup_smp(void) +static void __init of_parse_and_init_cpus(void) { struct device_node *dn; unsigned long hart; @@ -116,6 +116,11 @@ void __init setup_smp(void) } } +void __init setup_smp(void) +{ + of_parse_and_init_cpus(); +} + static int start_secondary_cpu(int cpu, struct task_struct *tidle) { if (cpu_ops[cpu]->cpu_start) From patchwork Thu Feb 16 18:20:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143639 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 72786C636D7 for ; Thu, 16 Feb 2023 18:21:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4u4nP6Dy+xQ3eF5wfG1irLJItWMrIwCjPj/9unHhzv4=; b=dDh0nWXEWy3hzW OVR3Weg4zY38TXSDR6WAaOUB33BInDlz1qY3QMDute1swfL7S/wXsziCCq0Jwr7uqqeRwoSav8hFS 6LD6nz5Vu2k9QBxjf0HlfRU/wuKe4JzWMS0pxjdPnbh98Cm93+KY4/uzfVbud37c84VspPXhv+FIf M4jbJCB1bDMu87ya7RD/EnhQ6Q8yOOo7MSrWYo+DESzj15sncXRuaJP7cfUNSKjaf9E7k2zztQqzi LTCvqrOm5lDmVYYdApmh6iWxJqTlY8xv8JWwLcK5qDcjwlzgEzmAux3IwT9CaJ4MBGpjgA8PgNi/Q NCgqoQsohfkXZDm45uww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSit7-00BTrB-Fq; Thu, 16 Feb 2023 18:21:45 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSit5-00BTnu-2e for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:21:44 +0000 Received: by mail-pj1-x1031.google.com with SMTP id d13-20020a17090ad3cd00b0023127b2d602so2977389pjw.2 for ; Thu, 16 Feb 2023 10:21:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=s8gLVy86DoWbnyaOmwt3yk4bIOk4obRTX8YOySNU6bM=; b=VpdtjEii+t5cvC5ibTSbTwjU4Vx3GiWKkzTOXqXjUr0YDKlzh2RTmRhrfafw6GTtsc YTQqnR6kqj6GRIgl9yX/vR6IHxTBJo7vdDNEj8DswgI7MPqnnTKk6CnOzErmcN5CCH2b ZwMNZtNf6oZbN7d+YG/54CFyPCKr7rLx8eQKziHq+F0+XPYQXsrOqlge5KMGhUXVQVMo nT8fZ/aoGGnmZ86ZY/5kHh7e+61wbBNj1IkEy+Sk4r9srBbf2euRVlaJls3S5LTMegLN dC+DQ9pSlYuPW3W5SR4Zgw/zMM7vqJOQ/chaI5xf2TMznWD+BoyMvGkFM9XtER5brYcS 3B8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=s8gLVy86DoWbnyaOmwt3yk4bIOk4obRTX8YOySNU6bM=; b=0pMKOOCRMlAIeqTjSbulY0SLVTvjl0M2AMcm3Yl+isL+PjgHTTD82LgvAEKsWlMVVq a4NewZlIbUC1Qu45Ai3RPq3OnzkJkBZsmj0AIqCNq8w9gDoa6ulHXdLjbAwF2PbVwfbc 8ALd3xEC0Ok0YkLQvorYJjvD5sv7zIGW9QmdQci1HziX0sydy8/A92ETJLLW5zIVSmht 1o6YJQUkZ0Og2Fn1xKAfwvnyqnQK2e4yVVoDWrYRLWGhlO2sIAeZL+72NEXrlHQuWg8W 6LPO4yS+g4CV1WtKLSxVf8MgHIZML22AvRoXM9HY5kWmGRXmf0RfbklcOK62QQ73KL0S 7dbA== X-Gm-Message-State: AO0yUKXqMFz64q5v81uqsZPCjbFBOTRW4NV43FootU8jjxNUo7Y+U6O5 Sk139bRBsrRh0aC1x/hFYVVeBQ== X-Google-Smtp-Source: AK7set82OpBoXgv7SeiV1Z4RhXl7WcwMoJmnfTKXKVRwepNnMNF/4KU9sf9ovobJziBAs+uVZziTXQ== X-Received: by 2002:a17:90b:1d87:b0:233:d4fd:38a3 with SMTP id pf7-20020a17090b1d8700b00233d4fd38a3mr7710027pjb.41.1676571700518; Thu, 16 Feb 2023 10:21:40 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.21.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:21:40 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 10/21] RISC-V: smpboot: Add ACPI support in smp_setup() Date: Thu, 16 Feb 2023 23:50:32 +0530 Message-Id: <20230216182043.1946553-11-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102143_145584_D48F18A9 X-CRM114-Status: GOOD ( 19.10 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Enable SMP boot on ACPI based platforms by using the RINTC structures in the MADT table. Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki Reviewed-by: Conor Dooley --- arch/riscv/include/asm/acpi.h | 7 ++++ arch/riscv/kernel/smpboot.c | 70 ++++++++++++++++++++++++++++++++++- 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h index 7bc49f65c86b..3c3a8ac3b37a 100644 --- a/arch/riscv/include/asm/acpi.h +++ b/arch/riscv/include/asm/acpi.h @@ -60,6 +60,13 @@ static inline void arch_fix_phys_package_id(int num, u32 slot) { } int acpi_get_riscv_isa(struct acpi_table_header *table, unsigned int cpu, const char **isa); + +#ifdef CONFIG_ACPI_NUMA +int acpi_numa_get_nid(unsigned int cpu); +#else +static inline int acpi_numa_get_nid(unsigned int cpu) { return NUMA_NO_NODE; } +#endif /* CONFIG_ACPI_NUMA */ + #else static inline int acpi_get_riscv_isa(struct acpi_table_header *table, unsigned int cpu, const char **isa) diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index 26214ddefaa4..77630f8ed12b 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -8,6 +8,7 @@ * Copyright (C) 2017 SiFive */ +#include #include #include #include @@ -70,6 +71,70 @@ void __init smp_prepare_cpus(unsigned int max_cpus) } } +#ifdef CONFIG_ACPI +static unsigned int cpu_count = 1; + +static int __init acpi_parse_rintc(union acpi_subtable_headers *header, const unsigned long end) +{ + unsigned long hart; + bool found_boot_cpu = false; + struct acpi_madt_rintc *processor = (struct acpi_madt_rintc *)header; + + /* + * Each RINTC structure in MADT will have a flag. If ACPI_MADT_ENABLED + * bit in the flag is not enabled, it means OS should not try to enable + * the cpu to which RINTC belongs. + */ + if (!(processor->flags & ACPI_MADT_ENABLED)) + return 0; + + hart = processor->hart_id; + if (hart < 0) + return 0; + if (hart == cpuid_to_hartid_map(0)) { + BUG_ON(found_boot_cpu); + found_boot_cpu = true; + early_map_cpu_to_node(0, acpi_numa_get_nid(cpu_count)); + return 0; + } + + if (cpu_count >= NR_CPUS) { + pr_warn("Invalid cpuid [%d] for hartid [%lu]\n", + cpu_count, hart); + return 0; + } + + cpuid_to_hartid_map(cpu_count) = hart; + early_map_cpu_to_node(cpu_count, acpi_numa_get_nid(cpu_count)); + cpu_count++; + + return 0; +} + +static void __init acpi_parse_and_init_cpus(void) +{ + int cpuid; + + cpu_set_ops(0); + + /* + * do a walk of MADT to determine how many CPUs + * we have including disabled CPUs, and get information + * we need for SMP init. + */ + acpi_table_parse_madt(ACPI_MADT_TYPE_RINTC, acpi_parse_rintc, 0); + + for (cpuid = 1; cpuid < nr_cpu_ids; cpuid++) { + if (cpuid_to_hartid_map(cpuid) != INVALID_HARTID) { + cpu_set_ops(cpuid); + set_cpu_possible(cpuid, true); + } + } +} +#else +#define acpi_parse_and_init_cpus(...) do { } while (0) +#endif + static void __init of_parse_and_init_cpus(void) { struct device_node *dn; @@ -118,7 +183,10 @@ static void __init of_parse_and_init_cpus(void) void __init setup_smp(void) { - of_parse_and_init_cpus(); + if (acpi_disabled) + of_parse_and_init_cpus(); + else + acpi_parse_and_init_cpus(); } static int start_secondary_cpu(int cpu, struct task_struct *tidle) From patchwork Thu Feb 16 18:20:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143640 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4C97BC61DA4 for ; Thu, 16 Feb 2023 18:21:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EJTtsTR/mEaD+4owORK3iaV+wc897VMS4hIbO/pIDcM=; b=jhBognrmlfk2Cw jn+L2TXXwHTXiDoz9Aymo8WXbZrlDWAOLUcjas57b/NIWS/mrf63LHYJOnCm009+oEfeXksB5aSJm titgWShNwX1i/d2PEJOKTyX0+EdAS9nk9XvxusLatfoe0IcOaeihBIk2/ZZS6f53OqO6Hat3oFEZq flJ5j6hHGAJq9SheSwN72ZTzl/uXHlTY7X+a2omQ2I82FkgICjSSi0/cMJpS01A0qpw895B9Us0Eo LK68VBG3zw5472AgGT3aKWWzvecPI/ari0whtBQy5rNhgf5GOawxb1bo2U+o+EjBwca9oTjRb0Ol2 pzfavuqxTlPdxiio2K4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSitB-00BTuG-6H; Thu, 16 Feb 2023 18:21:49 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSit7-00BTrU-U9 for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:21:47 +0000 Received: by mail-pj1-x102e.google.com with SMTP id d2so2703456pjd.5 for ; Thu, 16 Feb 2023 10:21:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=GipxeDCOyjMj8YF40M4Hg7LI5rDefQ4n1sWRXQ5Wf4A=; b=eEFXo/GfQ56r4rtPgsxzNpFtJ23EjjcqYMMKhNbgLjE2Uuuy6P1bpuyH7mca/UbFYP aBNx3N2EIanq/lyuvYX2QMPg6Z1XipqO6QH1D/VjXzNzHfwBixUTZ/HkyjgfC9haFo78 Y12zsDunSkOjC4xURoqcxMZVCuD9ZLuBo70InXbPD6zU79CNTJXTYKIqcnJ1InzY+flJ //f7yL3N67uDxSS8o5mkf0Pe86BtKQRee5sbU4av6NbYmLZowEkxCR9khQ3johCdCu8S KY1xIiFS6em7YokS3n0jAZZwM4ZAuhjIaWBjjPllKiungJ3uK7QAE9DuaATKsqxVIfyc phdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=GipxeDCOyjMj8YF40M4Hg7LI5rDefQ4n1sWRXQ5Wf4A=; b=ymvQp3vWAz/0xRSdJRzIH/bWusQout3CmfVjnsZQvw3lsC2j63DicM7Nyx3LxE3ObX lTR03pmjZmizi7z2Wbb8elCPumsN43zsIxXpBm6alx1mMnOIZH55YFQ8hlp4cUQBqwkq aZIttC9Y8m7QzuxRDMbZ7bU9/fNvgCXyN7D6VfEbWqPgCrzMQAKm9OXSQgceAkJzbuJH wPkZpsl6bdHVMGKsFAUCaOnLwg/hI2nwP6ZrXbVXwmr7DkRNJhmDdh36CTG1mV6e2e8w uDQi1E+fx1XOYVDc9nZ194R6qEmdOIfkDoINHjIe57SCSmv+i/2dQ+9krY7w3jDJINZw k3tQ== X-Gm-Message-State: AO0yUKX4UKL7qKmaStWR+1pEkzrlo41nL9Q0edfYMfRY25z1GvUj+i+c E/70EsemKlDjl9LQV3WR0FIFjQ== X-Google-Smtp-Source: AK7set9k9++/QzvIRe1B3IRDZ869l6XRxNCvE+UR28XP1HGqhzjPmFL0xkUQqSpERzooLyWBhEFXjg== X-Received: by 2002:a05:6a20:6a0c:b0:9f:3197:bfa1 with SMTP id p12-20020a056a206a0c00b0009f3197bfa1mr7989098pzk.7.1676571705447; Thu, 16 Feb 2023 10:21:45 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.21.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:21:45 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 11/21] RISC-V: ACPI: Add a function to retrieve the hartid Date: Thu, 16 Feb 2023 23:50:33 +0530 Message-Id: <20230216182043.1946553-12-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102146_009662_F626EB9B X-CRM114-Status: GOOD ( 15.00 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The hartid is in the RINTC structure of the MADT table. Instead of parsing the ACPI table every time, cache it and provide a function to read it. Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki --- arch/riscv/include/asm/acpi.h | 8 +++++ arch/riscv/kernel/acpi.c | 55 +++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h index 3c3a8ac3b37a..b9d7b713fb43 100644 --- a/arch/riscv/include/asm/acpi.h +++ b/arch/riscv/include/asm/acpi.h @@ -67,6 +67,9 @@ int acpi_numa_get_nid(unsigned int cpu); static inline int acpi_numa_get_nid(unsigned int cpu) { return NUMA_NO_NODE; } #endif /* CONFIG_ACPI_NUMA */ +struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu); + +u32 get_acpi_id_for_cpu(int cpu); #else static inline int acpi_get_riscv_isa(struct acpi_table_header *table, unsigned int cpu, const char **isa) @@ -74,6 +77,11 @@ static inline int acpi_get_riscv_isa(struct acpi_table_header *table, return -EINVAL; } +static inline u32 get_acpi_id_for_cpu(int cpu) +{ + return -1; +} + #endif /* CONFIG_ACPI */ #endif /*_ASM_ACPI_H*/ diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c index 81d448c41714..13b26c87c136 100644 --- a/arch/riscv/kernel/acpi.c +++ b/arch/riscv/kernel/acpi.c @@ -24,6 +24,61 @@ EXPORT_SYMBOL(acpi_disabled); int acpi_pci_disabled = 1; /* skip ACPI PCI scan and IRQ initialization */ EXPORT_SYMBOL(acpi_pci_disabled); +static unsigned int intc_count; +static struct acpi_madt_rintc cpu_madt_rintc[NR_CPUS]; + +static int acpi_parse_madt_rintc(union acpi_subtable_headers *header, const unsigned long end) +{ + struct acpi_madt_rintc *rintc = (struct acpi_madt_rintc *)header; + + if (!(rintc->flags & ACPI_MADT_ENABLED)) + return 0; + + cpu_madt_rintc[intc_count++] = *rintc; + + return 0; +} + +static int acpi_init_rintc_array(void) +{ + if (acpi_table_parse_madt(ACPI_MADT_TYPE_RINTC, acpi_parse_madt_rintc, 0) > 0) + return 0; + + pr_info("No valid RINTC entries exist\n"); + return -ENODEV; +} + +struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu) +{ + static bool rintc_init_done; + unsigned int i; + + if (!rintc_init_done) { + if (acpi_init_rintc_array()) { + pr_err("Failed to initialize RINTC array\n"); + return NULL; + } + rintc_init_done = true; + } + + for (i = 0; i < intc_count; i++) { + if (cpu_madt_rintc[i].hart_id == cpuid_to_hartid_map(cpu)) + return &cpu_madt_rintc[i]; + } + + return NULL; +} + +u32 get_acpi_id_for_cpu(int cpu) +{ + struct acpi_madt_rintc *rintc = acpi_cpu_get_madt_rintc(cpu); + + if (!rintc) + return -1; + + return rintc->uid; +} + /* * __acpi_map_table() will be called before paging_init(), so early_ioremap() * or early_memremap() should be called here to for ACPI table mapping. From patchwork Thu Feb 16 18:20:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143641 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AFDA7C61DA4 for ; Thu, 16 Feb 2023 18:22:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iDF2ioizATTO/2oAWGljm5ucN5rDD1hWaiboVxh7noU=; b=qBmumP97loXdW0 7pL86DNuwt7uWOBoxoNYekVsYgEZcnyKOQygLqS66kRx7X0IpAVy4IPev5YpTHr2rwsy+RrKOc3Fb UkpDlxdYyxpQkkIwEbCwGJveZ5CjI1RxWwpW2xVb/mIlM1nhMKlMWsiJNByxds4bOfvuYqeUmjw/d E9iqIhAgo7mksSMd/LKyun5VxQDAY/qcXYIhVyvvEAHcBfBbprGiZ0xLskaG4BG9S/FeiEMcY05bo 1f8Bpxa1GguTIFiHwP8ANCrRODX041LTsMa51w4KdUZEKk7wueMCQAFsepcOcsEtj3W3yI36fCkVZ U/WQR1CqMNklfnY+ZgoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSitH-00BTz6-OG; Thu, 16 Feb 2023 18:21:55 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSitF-00BTvS-9d for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:21:54 +0000 Received: by mail-pj1-x1030.google.com with SMTP id x4-20020a17090a388400b002349a303ca5so2450999pjb.4 for ; Thu, 16 Feb 2023 10:21:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=oVlhq9jJF5fkqCwNhAPs1olNplFdF6B5WclRLPqFQkc=; b=Ih5cdvHUc+6binLwjpr9QH0EbQBhTLyXOn/RYXvnmLofBP2hcHPkdG0+7hRgOIc02B 5GjCVp29i00cLIPLwY831s+ehgLGUY5ccr/5K8Ey+Q9UIFlTzXxleMG/mmV+zz0rmfxx EeCcij3QYpom+JUlpOhqSPVU14ZW5Q01dfQ9xD0heAmdGyuYsIbPcwN2dc6YsfWyPYvh liTNxl3kFNv75Su6bUJ37zkzS0WxwE7ZOgsJ4PWqf/bMl4qPijkYC+2QM6Y2e1gJ/1DG szGLGMguiud/r0MyWRTMx0xryUd8EIMUNOEcamcLUNJP+REakrD9PxQOyILiHtEZ2zJ+ im/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=oVlhq9jJF5fkqCwNhAPs1olNplFdF6B5WclRLPqFQkc=; b=EyDdhAIyFDdF/H/sI2eUS8ZhMocMAcEX4n8FxKoe24OgO4exJrzIb+uug8iwBY3aB1 fSmhys5mRM9dt7BsjPkiT+0My7fqPR9BixhiFaTFrCu9qI4JH22/9FEXGpDo+7kkWKh8 IF2Qjye+CQB2tvmVZ8TudJb4MiMnffVgJs2xFwlNg5EEIkfGHNhIOdBMA4LL9b8PDPu0 UHnwXFzpKudIGxzuwmY/yHeawd22f3bZkDxhdK+dFZB7yUg+3LoxzOl2FOSGn4KYKkau rmhwdQ5c9BCfs9HFxhi6VpLIiWKi70R6LIOYIgX7DFAUCRYOLKDaNoI7wKbd6a+0PidK +VAA== X-Gm-Message-State: AO0yUKUxdObkSFqTSKWaFB/mb/gKSxaQNgX7OumdHFQlZF48FPi43H0a qWQ1XmcHrJRP5DXFrTKg5OCwBQ== X-Google-Smtp-Source: AK7set+h7vf0LoZNkAGb2ghe6awEhCUdpqK+4V6FZ+wNFpKTON2Ckkza6yhNBDRyc7g3pDb0ZFspUg== X-Received: by 2002:a05:6a21:7899:b0:c7:6664:1e07 with SMTP id bf25-20020a056a21789900b000c766641e07mr202270pzc.28.1676571710197; Thu, 16 Feb 2023 10:21:50 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.21.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:21:49 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 12/21] RISC-V: cpufeature: Add ACPI support in riscv_fill_hwcap() Date: Thu, 16 Feb 2023 23:50:34 +0530 Message-Id: <20230216182043.1946553-13-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102153_356739_455E0444 X-CRM114-Status: GOOD ( 13.94 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On ACPI based systems, the information about the hart like ISA is provided by the RISC-V Hart Capabilities Table (RHCT). Enable filling up hwcap structure based on the information in RHCT. Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki --- arch/riscv/kernel/cpufeature.c | 41 ++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 93e45560af30..cb67d3fcbb56 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -6,12 +6,15 @@ * Copyright (C) 2017 SiFive */ +#include #include #include #include #include #include #include +#include +#include #include #include #include @@ -93,7 +96,10 @@ void __init riscv_fill_hwcap(void) char print_str[NUM_ALPHA_EXTS + 1]; int i, j, rc; unsigned long isa2hwcap[26] = {0}; + struct acpi_table_header *rhct; + acpi_status status; unsigned long hartid; + unsigned int cpu; isa2hwcap['i' - 'a'] = COMPAT_HWCAP_ISA_I; isa2hwcap['m' - 'a'] = COMPAT_HWCAP_ISA_M; @@ -106,18 +112,36 @@ void __init riscv_fill_hwcap(void) bitmap_zero(riscv_isa, RISCV_ISA_EXT_MAX); - for_each_of_cpu_node(node) { + if (!acpi_disabled) { + status = acpi_get_table(ACPI_SIG_RHCT, 0, &rhct); + if (ACPI_FAILURE(status)) + return; + } + + for_each_possible_cpu(cpu) { unsigned long this_hwcap = 0; DECLARE_BITMAP(this_isa, RISCV_ISA_EXT_MAX); const char *temp; - rc = riscv_of_processor_hartid(node, &hartid); - if (rc < 0) - continue; + if (acpi_disabled) { + node = of_cpu_device_node_get(cpu); + if (node) { + rc = riscv_of_processor_hartid(node, &hartid); + if (rc < 0) + continue; - if (of_property_read_string(node, "riscv,isa", &isa)) { - pr_warn("Unable to find \"riscv,isa\" devicetree entry\n"); - continue; + if (of_property_read_string(node, "riscv,isa", &isa)) { + pr_warn("Unable to find \"riscv,isa\" devicetree entry\n"); + continue; + } + of_node_put(node); + } + } else { + rc = acpi_get_riscv_isa(rhct, get_acpi_id_for_cpu(cpu), &isa); + if (rc < 0) { + pr_warn("Unable to get ISA for the hart - %d\n", cpu); + continue; + } } temp = isa; @@ -248,6 +272,9 @@ void __init riscv_fill_hwcap(void) bitmap_and(riscv_isa, riscv_isa, this_isa, RISCV_ISA_EXT_MAX); } + if (!acpi_disabled) + acpi_put_table((struct acpi_table_header *)rhct); + /* We don't support systems with F but without D, so mask those out * here. */ if ((elf_hwcap & COMPAT_HWCAP_ISA_F) && !(elf_hwcap & COMPAT_HWCAP_ISA_D)) { From patchwork Thu Feb 16 18:20:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143642 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8240DC636D7 for ; Thu, 16 Feb 2023 18:22:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LX4qXplkVQLryxYDAGE4mRYAfQwMVcz9U4k3dlOx3mU=; b=3scZHOJrr38MQK SWaLMcLrxmbcCDOnfsBknMLSAcu8WhOVCCjYaDv2RN/FwRqNEn95cDh2+bIPba0ekuUZSBdETDFH6 DGPPS2avAUT1JzM74eXmSWovJELPxQ+jbC1/Qih8rx/DNRiM0LUhduNDSo+T5HsohxdX70aO217aD mx7bMW0a+3WbV5wZB8pNumQdnk+Wd6j/WO2XFoyn9BWXaCkKwxxnXDB/njpo9tXWMk4aoCggUXMz2 sZ15T8N/a8JTBHlOW4DrV0WOctdu00GtZTQxIcD6jNjA6Jh7U0Gi3hW1G0+fnD8h7f+OC9hqU4zAT M0duSEFW+I+TfVGqeHng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSitL-00BU1u-2k; Thu, 16 Feb 2023 18:21:59 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSitH-00BTz2-MT for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:21:57 +0000 Received: by mail-pj1-x1030.google.com with SMTP id r9-20020a17090a2e8900b00233ba727724so6449355pjd.1 for ; Thu, 16 Feb 2023 10:21:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=Y/B7oU0oZMzvSlnZ6Slk2M4LeGqm6SOf/DwHx2JHpN8=; b=JhzKrMk2y0c0UJJY9R3LAeDqup2Vy26n7fKJF2EJ8p9IKFWGnI1YedBoBhqO8F3LkM tVZ+fGNaffll2OfDmYRq+19mu8tuigJ54kj92JxCQHc1ux9gKkHGlD6/60HYZK/ZNGTo M3kerTUxSK6phuUl/DKNjGQyHWtPG5QMv4mHhe3+juD7WJQynDSgsNO+hKRxoKLPXcyg fk5/451Gdasyf10nauCTje7081IndfdWP2CXIZbgriIouer1UlPFOB6pBqXuYsTQcSO9 xbPXfLEPHK2SFHFpnQZA7O6nt+QPejZjwMal7uNgk+Hakcw4VJJ7MArqKBxLJzJHHUF0 L2nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Y/B7oU0oZMzvSlnZ6Slk2M4LeGqm6SOf/DwHx2JHpN8=; b=hqgrlXEm2F6MTGqnCHZTt0dUWXC2pN0h4qJpAlysq4HW6baDvAXtMyc9KOOSiHqzJP ZzRtoxyUn9x7dnondkAy7pAdkfwHUHRmXjHtbwK6cg1ZzGTPhSorWMhopfpbhTTKCME0 +WRtC0wSPAO0KbwIlv7Jvjm0X8x9h9BYKawud1eTLl9tE1BV8HhjkCWmb03wQaBiBYrY Js2C1aAlnyk9jocYjcTyShWlHqS4fF9RolEOhPh9S1TmyE6gq7AzyeBIUfF0Yy696cuD C3lLr5QKumKMO47IkKLUaQGoHcV3jay1jGubA77AXWL6rORsWJJqI1Flx1eY3Za+BUXJ I25A== X-Gm-Message-State: AO0yUKVBxCpUkBfAKQmLbSrOyaAkDy/UR+rcwMDo5WeA96yAPTocBbTN QT1+sXRs00TcyybLwC+4wEY9wKWEEFiyrG8k X-Google-Smtp-Source: AK7set+UGGwky0KcCyPjol1FGoQkgy43ytFVLWD+NpcOvsVqZI0SmSkUdXxAOwokXN5tYcdCUF81Bw== X-Received: by 2002:a05:6a20:8e16:b0:c6:dfe3:8663 with SMTP id y22-20020a056a208e1600b000c6dfe38663mr6729908pzj.9.1676571715195; Thu, 16 Feb 2023 10:21:55 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.21.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:21:54 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 13/21] RISC-V: cpu: Enable cpuinfo for ACPI systems Date: Thu, 16 Feb 2023 23:50:35 +0530 Message-Id: <20230216182043.1946553-14-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102155_763272_800B6233 X-CRM114-Status: GOOD ( 11.65 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On ACPI based platforms, few details like ISA need to be read from the ACPI table. Enable cpuinfo on ACPI based systems. Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki --- arch/riscv/kernel/cpu.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c index 1b9a5a66e55a..a227c0661b19 100644 --- a/arch/riscv/kernel/cpu.c +++ b/arch/riscv/kernel/cpu.c @@ -3,10 +3,12 @@ * Copyright (C) 2012 Regents of the University of California */ +#include #include #include #include #include +#include #include #include #include @@ -256,26 +258,41 @@ static void c_stop(struct seq_file *m, void *v) { } +static void acpi_print_hart_info(struct seq_file *m, unsigned long cpu) +{ + const char *isa; + + if (!acpi_get_riscv_isa(NULL, get_acpi_id_for_cpu(cpu), &isa)) + print_isa(m, isa); +} + static int c_show(struct seq_file *m, void *v) { unsigned long cpu_id = (unsigned long)v - 1; - struct device_node *node = of_get_cpu_node(cpu_id, NULL); struct riscv_cpuinfo *ci = per_cpu_ptr(&riscv_cpuinfo, cpu_id); + struct device_node *node; const char *compat, *isa; seq_printf(m, "processor\t: %lu\n", cpu_id); seq_printf(m, "hart\t\t: %lu\n", cpuid_to_hartid_map(cpu_id)); - if (!of_property_read_string(node, "riscv,isa", &isa)) - print_isa(m, isa); + + if (acpi_disabled) { + node = of_get_cpu_node(cpu_id, NULL); + if (!of_property_read_string(node, "riscv,isa", &isa)) + print_isa(m, isa); + if (!of_property_read_string(node, "compatible", &compat) && + strcmp(compat, "riscv")) + seq_printf(m, "uarch\t\t: %s\n", compat); + of_node_put(node); + } else { + acpi_print_hart_info(m, cpu_id); + } + print_mmu(m); - if (!of_property_read_string(node, "compatible", &compat) - && strcmp(compat, "riscv")) - seq_printf(m, "uarch\t\t: %s\n", compat); seq_printf(m, "mvendorid\t: 0x%lx\n", ci->mvendorid); seq_printf(m, "marchid\t\t: 0x%lx\n", ci->marchid); seq_printf(m, "mimpid\t\t: 0x%lx\n", ci->mimpid); seq_puts(m, "\n"); - of_node_put(node); return 0; } From patchwork Thu Feb 16 18:20:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143643 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3D4ABC636D7 for ; Thu, 16 Feb 2023 18:22:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FnxruBTBx0e6ETK3CKPtS/DGKEJmCFd62OsmTFnX5CM=; b=wRIE85lQTQacdb hQ0NGKFUrzYMzewyWln1pKoPKlLz+VjWtTRK93VywIKcYHkaPJZkvVp4HrCzs5zCd/zz6HEIaPc6Z dlT+1TkvgcMhqH/Fk6G3VoweKb2lHC6CZYm37QYTJD7nKkzqLvejWhtxzpDhP3fwrn+n3lH9jpufC sVbXHm44nE+nPToUYm+vXVu89/5SvDTOXj0Bne1P8wBvhalanYsGZgGXr/oIvsh2zWbltlh3bjv5d ra0Gd0PrgqMhJDiqO5tkAhZgv3YOWH4WtWZUSjFWBRmGAayY1Gx28ZesqUjGfqtjG5M8BkE8VfBIt a+npvpnjjAeALNkTP0ZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSitR-00BU7h-WE; Thu, 16 Feb 2023 18:22:06 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSitP-00BU33-0M for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:22:04 +0000 Received: by mail-pl1-x62c.google.com with SMTP id m2so2944839plg.4 for ; Thu, 16 Feb 2023 10:22:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=8+mNmph7z+0hgeAPhfRjYNKRnC89i/LR46jyYpJ0Apo=; b=l+E/4mGvkIJFMOx3vpketHl6w+OVgKH1DxDQBosv+JiXnn3EnFIE5kJx5+YzS6lLiS 0rYHRmZl+afg6HhbnviJ+eKMj5yIjob50D2ExCAbohUNkrRvegMgK53TL+DatL6okNB1 f+4FlaxZq63X6ZwMSDhpiwE6X2KLXp7s5x+yRBbSxUoHZgSQtI87+UVq0Z2HgJ9Ay/Zd yif3+oeSS9ykcKUaZq3ZNvy7s4zFmSY3VYzDbAcXZ0n7WsSQoMo4LXuYcp5xcp9ruJdm 7QGg+T1xe2cQhLpXyD5XCOSgPN0bqnBE7qZdpVxAexRvSprB2mokXcWga7rVPXqE1fX0 d8Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=8+mNmph7z+0hgeAPhfRjYNKRnC89i/LR46jyYpJ0Apo=; b=COQqg4euDLZa8YthYVleOJTqpVdgW6mP8gpFyY4tlDWXTwQ04TRJcjZhMC/JvtjUcl HieRfp01WVXaX6md4y9LfqFr3dFltY0pwdZksATWTmpQm01R+3o2sYHWNFtaRYzWc9VZ CP9lwdABCwKyRgsbDZk+nFq/LXGiURGoc5fqgwdbU/eq9aQMRpENJJ91PW+j2rCyjkiz tIREeQiBoCEpfLY2QmLAKzCa7/4F8bjb0KOuFM4rcquTY97S6AvrDDsrRzE3BXIZ5q6k 4/CTXix9faaPNTUW7sdF7VDf7Gl+q70mHrrhRzUd/rl2zxcDTaoGx9A1NnyxUg7FlRhT tV1g== X-Gm-Message-State: AO0yUKWGcWJtAFZmLcIOBwQ41t4e0hbtZxA3b8wcj9LFhXtZO0lqUtAP cU0stE6VdVEmdpd3hw9GGAe+Zw== X-Google-Smtp-Source: AK7set940eocbZJrVpFGvstTalckFPNlTIQlDCA11v5kbvJbNDaml4O2OhjVpI7zpc+dOhk9Rjo3Bg== X-Received: by 2002:a17:90a:1ca:b0:234:106a:34b7 with SMTP id 10-20020a17090a01ca00b00234106a34b7mr7684245pjd.46.1676571719882; Thu, 16 Feb 2023 10:21:59 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.21.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:21:59 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 14/21] irqchip/riscv-intc: Add ACPI support Date: Thu, 16 Feb 2023 23:50:36 +0530 Message-Id: <20230216182043.1946553-15-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102203_069792_9639C432 X-CRM114-Status: GOOD ( 14.69 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add support for initializing the RISC-V INTC driver on ACPI platforms. Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki Reviewed-by: Andrew Jones --- drivers/irqchip/irq-riscv-intc.c | 78 +++++++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 12 deletions(-) diff --git a/drivers/irqchip/irq-riscv-intc.c b/drivers/irqchip/irq-riscv-intc.c index f229e3e66387..97a8db0fbc6c 100644 --- a/drivers/irqchip/irq-riscv-intc.c +++ b/drivers/irqchip/irq-riscv-intc.c @@ -6,6 +6,7 @@ */ #define pr_fmt(fmt) "riscv-intc: " fmt +#include #include #include #include @@ -112,6 +113,30 @@ static struct fwnode_handle *riscv_intc_hwnode(void) return intc_domain->fwnode; } +static int __init riscv_intc_init_common(struct fwnode_handle *fn) +{ + int rc; + + intc_domain = irq_domain_create_linear(fn, BITS_PER_LONG, + &riscv_intc_domain_ops, NULL); + if (!intc_domain) { + pr_err("unable to add IRQ domain\n"); + return -ENXIO; + } + + rc = set_handle_irq(&riscv_intc_irq); + if (rc) { + pr_err("failed to set irq handler\n"); + return rc; + } + + riscv_set_intc_hwnode_fn(riscv_intc_hwnode); + + pr_info("%d local interrupts mapped\n", BITS_PER_LONG); + + return 0; +} + static int __init riscv_intc_init(struct device_node *node, struct device_node *parent) { @@ -133,24 +158,53 @@ static int __init riscv_intc_init(struct device_node *node, if (riscv_hartid_to_cpuid(hartid) != smp_processor_id()) return 0; - intc_domain = irq_domain_add_linear(node, BITS_PER_LONG, - &riscv_intc_domain_ops, NULL); - if (!intc_domain) { - pr_err("unable to add IRQ domain\n"); - return -ENXIO; - } - - rc = set_handle_irq(&riscv_intc_irq); + rc = riscv_intc_init_common(of_node_to_fwnode(node)); if (rc) { - pr_err("failed to set irq handler\n"); + pr_err("failed to initialize INTC\n"); return rc; } - riscv_set_intc_hwnode_fn(riscv_intc_hwnode); + return 0; +} - pr_info("%d local interrupts mapped\n", BITS_PER_LONG); +IRQCHIP_DECLARE(riscv, "riscv,cpu-intc", riscv_intc_init); + +#ifdef CONFIG_ACPI + +static int __init +riscv_intc_acpi_init(union acpi_subtable_headers *header, + const unsigned long end) +{ + int rc; + struct fwnode_handle *fn; + struct acpi_madt_rintc *rintc; + + rintc = (struct acpi_madt_rintc *)header; + + /* + * The ACPI MADT will have one INTC for each CPU (or HART) + * so riscv_intc_acpi_init() function will be called once + * for each INTC. We only do INTC initialization + * for the INTC belonging to the boot CPU (or boot HART). + */ + if (riscv_hartid_to_cpuid(rintc->hart_id) != smp_processor_id()) + return 0; + + fn = irq_domain_alloc_named_fwnode("RISCV-INTC"); + if (!fn) { + pr_err("unable to allocate INTC FW node\n"); + return -ENOMEM; + } + + rc = riscv_intc_init_common(fn); + if (rc) { + pr_err("failed to initialize INTC\n"); + return rc; + } return 0; } -IRQCHIP_DECLARE(riscv, "riscv,cpu-intc", riscv_intc_init); +IRQCHIP_ACPI_DECLARE(riscv_intc, ACPI_MADT_TYPE_RINTC, NULL, + ACPI_MADT_RINTC_VERSION_V1, riscv_intc_acpi_init); +#endif From patchwork Thu Feb 16 18:20:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143644 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F03F4C61DA4 for ; Thu, 16 Feb 2023 18:22:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3aCDt2HaXmkV2Ux2n8MMM5aSH/zSLOA0KKPH9JQbafE=; b=LOLgXF+alcgpSP cQLeL+NMya/XbI/yZLvctwELMA00OqGkI5SnJFkorNMQWFHR+hZ4iFA9s2z7WlTN5lOk3sdAYaTSy 6jr03ETZGPjQvObx5wj2WVJO+rwsXzMu2VOtz4YVkBTHk922SAElx2r29vradf7IHLDq9IiMKQi75 f7bFEPmGTcv0GQ5cPljFQWGQilDPIhTONldP2BiCEG3SHMwP4oGeVlIUTWG+2zhrnbI6fCZzsB5bm RE2lNLXF3nlu0mF3Vwb1feWqGfrJyEE/8nTZc98hd3cckam1XRdIFR4Dl44RTGLgkwx+nJPeVzV0z Zd8DUMGIl/MeDncujHhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSitW-00BUAv-AF; Thu, 16 Feb 2023 18:22:10 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSitT-00BU6y-Nu for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:22:09 +0000 Received: by mail-pl1-x633.google.com with SMTP id i15so137803plr.8 for ; Thu, 16 Feb 2023 10:22:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=4phaq6quaw8OEd5i/LKAI0eg66LQgH0oflAjuJIR3hM=; b=assdfSn79vHm0/djewQo2bAQqyjoTdSiGlBucWz/vkwhlh0gcU4AzKvvNGpbvajSzo pyLddLDI91C5MOJAqpvr+uIMgruD0aMCS5ZkzhicFmN14+x8C7nDK2QPkEwxAZY0cHrN njQ2zJIhkyPA0oCk8owapfaEaiAVm/jFqJqZHUtqhNpdOsJj6oyEzlmxzG7BmxRHGnTl 010zIM+wIuONTlBkSYFy/AXiy57JLHaoy1nGIKW/GgvturAOhwh37d7TDfwp1XJZOcol NymKVNVqiyDZoXLOoFLIZsBv8PZxexq/CRxJGVCU0XPdAsT0x8D1+iC3ghJYaXGI5Q0c l0hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=4phaq6quaw8OEd5i/LKAI0eg66LQgH0oflAjuJIR3hM=; b=FF3PuyaDWwgkQoHSE3GrAXNKwwQ3iawcFe2DjyKjNAETy3ElhI17618BUsU5H4tKWp PoFGAHdOQaaNCCVLZgqApcatbdEWism/aUTzCPo3pZfDwhFmBinYSEdP+xeKD6cEd8R4 Q7mTQyK9ki+P48yobKDXFl8MKapbsILV3Cq53XdibqW/uZDHXZ1qIpn2nWXkUe2ZeZNc kPm3g++iJZNBrZo/7+VptZwfSVJOp1PQcfpQySOXiOhW8k9alsRc0P4Rkr+6Mj2X6Mw0 VgbCp6AlG4D98D0HV7oO+91SlQ1NeVtGhkgSJgLXbkLA5/n7ppyeWf7T2r36rGFPx4Tt 3yPA== X-Gm-Message-State: AO0yUKXBatfLNC8mDp4ljTbebcNyEUZsoYKe2ZEmi2cYVCALgjj4z1FX 55f95aV+G5JPj8srlwEtiRG41w== X-Google-Smtp-Source: AK7set8C1pCi1Yn5xatlevccbWobHFbDGG2iAF9QZ/ZGlbvVWblYYzDHJ0Lrj8g7Jn58dLz+YVQtEQ== X-Received: by 2002:a05:6a20:7350:b0:bc:80bd:462d with SMTP id v16-20020a056a20735000b000bc80bd462dmr8512373pzc.46.1676571724598; Thu, 16 Feb 2023 10:22:04 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.22.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:22:04 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 15/21] clocksource/timer-riscv: Refactor riscv_timer_init_dt() Date: Thu, 16 Feb 2023 23:50:37 +0530 Message-Id: <20230216182043.1946553-16-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102207_803132_2149A3E7 X-CRM114-Status: GOOD ( 14.15 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Refactor the timer init function such that few things can be shared by both DT and ACPI based platforms. Co-developed-by: Anup Patel Signed-off-by: Anup Patel Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki Reviewed-by: Andrew Jones --- drivers/clocksource/timer-riscv.c | 82 +++++++++++++++---------------- 1 file changed, 40 insertions(+), 42 deletions(-) diff --git a/drivers/clocksource/timer-riscv.c b/drivers/clocksource/timer-riscv.c index 1b4b36df5484..2ae8e300d303 100644 --- a/drivers/clocksource/timer-riscv.c +++ b/drivers/clocksource/timer-riscv.c @@ -119,61 +119,28 @@ static irqreturn_t riscv_timer_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static int __init riscv_timer_init_dt(struct device_node *n) +static int __init riscv_timer_init_common(void) { - int cpuid, error; - unsigned long hartid; - struct device_node *child; - struct irq_domain *domain; + int error; + struct irq_domain *domain = NULL; + struct fwnode_handle *intc_fwnode = riscv_get_intc_hwnode(); - error = riscv_of_processor_hartid(n, &hartid); - if (error < 0) { - pr_warn("Not valid hartid for node [%pOF] error = [%lu]\n", - n, hartid); - return error; - } - - cpuid = riscv_hartid_to_cpuid(hartid); - if (cpuid < 0) { - pr_warn("Invalid cpuid for hartid [%lu]\n", hartid); - return cpuid; - } - - if (cpuid != smp_processor_id()) - return 0; - - child = of_find_compatible_node(NULL, NULL, "riscv,timer"); - if (child) { - riscv_timer_cannot_wake_cpu = of_property_read_bool(child, - "riscv,timer-cannot-wake-cpu"); - of_node_put(child); - } - - domain = NULL; - child = of_get_compatible_child(n, "riscv,cpu-intc"); - if (!child) { - pr_err("Failed to find INTC node [%pOF]\n", n); - return -ENODEV; - } - domain = irq_find_host(child); - of_node_put(child); + domain = irq_find_matching_fwnode(intc_fwnode, DOMAIN_BUS_ANY); if (!domain) { - pr_err("Failed to find IRQ domain for node [%pOF]\n", n); + pr_err("Failed to find irq_domain for INTC node [%pfwP]\n", + intc_fwnode); return -ENODEV; } riscv_clock_event_irq = irq_create_mapping(domain, RV_IRQ_TIMER); if (!riscv_clock_event_irq) { - pr_err("Failed to map timer interrupt for node [%pOF]\n", n); + pr_err("Failed to map timer interrupt for node [%pfwP]\n", intc_fwnode); return -ENODEV; } - pr_info("%s: Registering clocksource cpuid [%d] hartid [%lu]\n", - __func__, cpuid, hartid); error = clocksource_register_hz(&riscv_clocksource, riscv_timebase); if (error) { - pr_err("RISCV timer register failed [%d] for cpu = [%d]\n", - error, cpuid); + pr_err("RISCV timer registration failed [%d]\n", error); return error; } @@ -202,4 +169,35 @@ static int __init riscv_timer_init_dt(struct device_node *n) return error; } +static int __init riscv_timer_init_dt(struct device_node *n) +{ + int cpuid, error; + unsigned long hartid; + struct device_node *child; + + error = riscv_of_processor_hartid(n, &hartid); + if (error < 0) { + pr_warn("Invalid hartid for node [%pOF] error = [%lu]\n", + n, hartid); + return error; + } + + cpuid = riscv_hartid_to_cpuid(hartid); + if (cpuid < 0) { + pr_warn("Invalid cpuid for hartid [%lu]\n", hartid); + return cpuid; + } + + if (cpuid != smp_processor_id()) + return 0; + + child = of_find_compatible_node(NULL, NULL, "riscv,timer"); + if (child) { + riscv_timer_cannot_wake_cpu = of_property_read_bool(child, + "riscv,timer-cannot-wake-cpu"); + of_node_put(child); + } + return riscv_timer_init_common(); +} + TIMER_OF_DECLARE(riscv_timer, "riscv", riscv_timer_init_dt); From patchwork Thu Feb 16 18:20:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143645 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E3FDC61DA4 for ; Thu, 16 Feb 2023 18:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=b2tPIDpe2yZslqVJCe1on4Hpv90p/6jqVJMdysEy+qQ=; b=g2sSN2zrkmgECQ C3nuTtUk0hF6Bnmxb6ONWhqQqs57lOk9cP0fS/iwSaLRplgJXD0hS4mTUUbRnOTfpSchAdwL3iddM MviDVQ2l+DvJCJj8X8JNrFD9JOPJdpHzFxtIW3PDpZZbsAXRrjkiqgUG+QtWwgSlOamUdLnIQt0Ce yopUmr0QDF3ZpQctWkYisRMuQETxk2dpHky5TUwq2Q9IGbRHSXDkUo8QPMDpB3NUox9NfY+pahk+U ylhYDI0O/TUWIkXQoeJdxKP+X7DhTFY9TAbdC6o5ubO4zlqq7A0anZi+WJCDXNyUff7bairie1RXR Dkxxe0UYvtg/otW2GrCw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSitb-00BUGA-0Z; Thu, 16 Feb 2023 18:22:15 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSitY-00BUAo-OM for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:22:14 +0000 Received: by mail-pj1-x1032.google.com with SMTP id f16-20020a17090a9b1000b0023058bbd7b2so3021618pjp.0 for ; Thu, 16 Feb 2023 10:22:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=vv/SJn971dfjdTrZfssRImVac3G99NBb7ONmt1Vsq2I=; b=myJLNPbRJLi/wYDYC+up98t51CDSvleQNl+jgG0GytS3WhARAlv6QffJ1MZuDRuhyU 8nx+Iqk3/0KdzmA3KZj7nwInkmfGs4j8tDN+L8Vu+X478ausemy9Wu5+S7F96/g0/aP4 6SJcqu0eqxByONPkPg6XnsFYBAkhdoWdSfHoNJetFsAg24XKyXXc6ALuunxuhMjGApeS 3RJQ1bIyZZJRcBM/v640JXSPpA8mjzq5s2a72ChX7W0uTYD2fOAIchRGYp/4yOEjIl5D tDnC5SXkZ9P0rYtWqNgSCJ5fpvmDvMwd9aOziTUVR0hXElPSBVuov+zz6/eecwNO7wHJ xDmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=vv/SJn971dfjdTrZfssRImVac3G99NBb7ONmt1Vsq2I=; b=AioxFJ1hf/IpNQSiZXeg4IZqD6KE4I2vW+b1lt38A8Je/SjIsQmV8HVMngHWXdtJH8 zcsxoMYUVv1miaGPDOHu8Q+c3wecJaL0iNOCO2hsblqT13iBijKuyUaE+i6d8vj2kyC6 1egJxuAzNgb7T1yScUn6m5MiLqIb5CnP4YEfxpBVVqMoeqMv7XCopMh9KTzDn5+ytlWq rFl3o3V983V12O0dKqxaXwsqRT5HvgCGsCaXXe+zvwPngDd86HDuHYu2vieG2thzirIy kn8wh+8vsMfpSBCeC7KDpSXm4MXSc+3H+rncG7r05RCyfT+et2DzagkcmM95W1KQUXE/ fZhA== X-Gm-Message-State: AO0yUKU8glhwEmQ2pQ4YkIsEgzPF8lg3bLZMrxbuzEr2mZgU3XET4758 Lymne+9+4PyyxwY8Pd1fUoCx8g== X-Google-Smtp-Source: AK7set+NBRmM54Hgp3O9CpS/Jfakh9iB+b7vBRwhQtSjUmCXjPcQd5RBQeVnlUJ0IOn5iswQgx12sA== X-Received: by 2002:a05:6a21:338c:b0:bc:b1ec:89f3 with SMTP id yy12-20020a056a21338c00b000bcb1ec89f3mr7638758pzb.50.1676571729309; Thu, 16 Feb 2023 10:22:09 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:22:08 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 16/21] clocksource/timer-riscv: Add ACPI support Date: Thu, 16 Feb 2023 23:50:38 +0530 Message-Id: <20230216182043.1946553-17-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102212_822190_576999AD X-CRM114-Status: UNSURE ( 8.85 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Initialize the timer driver based on RHCT table on ACPI based platforms. Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki Reviewed-by: Andrew Jones --- drivers/clocksource/timer-riscv.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/clocksource/timer-riscv.c b/drivers/clocksource/timer-riscv.c index 2ae8e300d303..5fb0eac52bdd 100644 --- a/drivers/clocksource/timer-riscv.c +++ b/drivers/clocksource/timer-riscv.c @@ -10,6 +10,7 @@ #define pr_fmt(fmt) "riscv-timer: " fmt +#include #include #include #include @@ -201,3 +202,13 @@ static int __init riscv_timer_init_dt(struct device_node *n) } TIMER_OF_DECLARE(riscv_timer, "riscv", riscv_timer_init_dt); + +#ifdef CONFIG_ACPI +static int __init riscv_timer_acpi_init(struct acpi_table_header *table) +{ + return riscv_timer_init_common(); +} + +TIMER_ACPI_DECLARE(aclint_mtimer, ACPI_SIG_RHCT, riscv_timer_acpi_init); + +#endif From patchwork Thu Feb 16 18:20:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143646 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0BBC2C636CC for ; Thu, 16 Feb 2023 18:22:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KjjVZdq0RhImMLo70MsAME1bw8j2km9mjZzwkFD4P8I=; b=jlpKFIE6FMAgu0 En+7okLaT+RG8GbVB4LfzyX3pZrQOfX0RDnSrCCqKQ8WNhZGpXk/CWgT8ks8mBAa2fN8+U5ALYhiu O6WT+XMCVlSjH/TD3Yu3/Ihp0WrvXzUUd0M6luzsTOj2xF8mJoI1Vb0TVlUPTIMSOANk+nvbzZzw0 ra5b7rPq1hspn2N847PtNLfXCooi9eXs0esJwoR/uq+1wXNzvO21YxtdwGcjapn5Pxsro1rO1eiF6 BixYOXxMrav7BoNdjS4aZJBoNyOv12PbkH9Z5vmxcdtTeFlBAl9AshhBPBXZRmzyEFVCzKnyW9yfc sQmChmNIuArEvVqse2Jw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSite-00BUIl-9D; Thu, 16 Feb 2023 18:22:18 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSita-00BU6y-9r for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:22:15 +0000 Received: by mail-pl1-x633.google.com with SMTP id i15so138295plr.8 for ; Thu, 16 Feb 2023 10:22:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=JjXwYmjlb4qLXAQKk4p+crKVMVgfMLiURDuGCOAQBXo=; b=V1EWcSn7s/zB5yoo0RZlAv/kS8CPk7pGWmyW8MmvfWwyIqESMo1MjwuqWg/GrXiycT IRlhq2vH4TRPjqX7MhEUvuxf2HAMFxTno3nTwzqLN7Hys2vkxT4VnLIRWoCjpgFE0OGJ eZNi5pce+I9VZkznd7sJnnhv14NvLcNNVkclgh3iyop6uIXFFD2lUYXuJWfNeZ2TEHfF lCb0ifNzr28mTfFrREt2B20mnaE0wHeFTC18v0zervqlQypET2v2Y6LCXohFYiPAjlyX CjBcMaogRlRp7aF3LrWJxWmuaT3vZhVsKyUcOAkehGm6q4i6NVgluPC6KGFe+nedMJnn 9I5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=JjXwYmjlb4qLXAQKk4p+crKVMVgfMLiURDuGCOAQBXo=; b=60nKRf6gnHZZ7GN9mWUZBny7NM7IQrLDAKGyQAblP55/lSALNeBLHAb3K/NYGmjYjN 7zdO6R7ilBMLXJHZQFgCjOVR9WZDW4yeyPcxsuemW+61wQV+PscvYR19P5XvgKDfS3Ya Z3jxkXm6oaCaNpz2a5xpHGpYp/O+oYKvivrWA6o2opYYtFgsfc1rEE2s11q5G4oxv4vs e1Stlf2/WhJPogTUptTmGqsYJHVUuvW27aul4eJR/ZDs+J7vK3zKJ+g/tDNcPdBnMBu9 sDVh0A5r0LQUpjyHatJ+FweCfMWbkc4Q64XoUWyP99W9YMq8SoKOZaPDoYXax/5f/OlJ ScDg== X-Gm-Message-State: AO0yUKWwtK+dejo1nyiv4YPbW0nNYOtyGUVctbdU4AoyFLMhTV4jnXmr eDvOkvOEz8z9NXfO6ndTFhZkAA== X-Google-Smtp-Source: AK7set9LxgFkAVbnm8jngPBu3SiXgJ9hu19zG34UJQxj6MufVqIhqHqG5LXGm9234ApK0t9Yz/YDOQ== X-Received: by 2002:a17:90b:3852:b0:234:7ccf:3c7c with SMTP id nl18-20020a17090b385200b002347ccf3c7cmr3048070pjb.9.1676571733991; Thu, 16 Feb 2023 10:22:13 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.22.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:22:13 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 17/21] RISC-V: time.c: Add ACPI support for time_init() Date: Thu, 16 Feb 2023 23:50:39 +0530 Message-Id: <20230216182043.1946553-18-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102214_386685_6F4A69F6 X-CRM114-Status: GOOD ( 11.79 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On ACPI based platforms, timer related information is available in RHCT. Add ACPI based probe support to the timer initialization. Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki Reviewed-by: Andrew Jones --- arch/riscv/kernel/time.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/arch/riscv/kernel/time.c b/arch/riscv/kernel/time.c index 1cf21db4fcc7..e49b897fc657 100644 --- a/arch/riscv/kernel/time.c +++ b/arch/riscv/kernel/time.c @@ -4,6 +4,7 @@ * Copyright (C) 2017 SiFive */ +#include #include #include #include @@ -18,17 +19,29 @@ EXPORT_SYMBOL_GPL(riscv_timebase); void __init time_init(void) { struct device_node *cpu; + struct acpi_table_rhct *rhct; + acpi_status status; u32 prop; - cpu = of_find_node_by_path("/cpus"); - if (!cpu || of_property_read_u32(cpu, "timebase-frequency", &prop)) - panic(KERN_WARNING "RISC-V system with no 'timebase-frequency' in DTS\n"); - of_node_put(cpu); - riscv_timebase = prop; + if (acpi_disabled) { + cpu = of_find_node_by_path("/cpus"); + if (!cpu || of_property_read_u32(cpu, "timebase-frequency", &prop)) + panic("RISC-V system with no 'timebase-frequency' in DTS\n"); + of_node_put(cpu); + riscv_timebase = prop; + } else { + status = acpi_get_table(ACPI_SIG_RHCT, 0, (struct acpi_table_header **)&rhct); + if (ACPI_FAILURE(status)) + panic("RISC-V ACPI system with no RHCT table\n"); + riscv_timebase = rhct->time_base_freq; + acpi_put_table((struct acpi_table_header *)rhct); + } lpj_fine = riscv_timebase / HZ; - of_clk_init(NULL); + if (acpi_disabled) + of_clk_init(NULL); + timer_probe(); tick_setup_hrtimer_broadcast(); From patchwork Thu Feb 16 18:20:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143647 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7676AC636CC for ; Thu, 16 Feb 2023 18:22:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SEhRGKzm3DMLBjLH5WcrpavEitTehsMfO1Un1cuuLg4=; b=RuEAwV265s6lt6 SfLFooU26nr61odkE/FUVVgmpocdDatZLOMNzvr6GEAVNjUqvb02GASeQToQVMBVBYopmEDRbJKNT aNF/CZ8zP6hNnHRzsKd+7yjYm6G3VH+FYs8Fl0yLzpog4RQvpEqpyafg4T7O2tmy0KwU4XBKntRxk n/h9nzMpvaINnrS7UifFdlSF54hQ/f5ED0M9LaYrRJkoR2NjZk5d7zBxR31yPEMRmEN5VZJKIh9Bx TIZv5II1AOhZtM2azN8sMUDMDlnUbsaW/gLlt/UyFT+g4FZ2d1A+H7v01jywNSfFlyeDTaXBwaJ9L 2cgY2myQo4TgTl7JMj/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSitl-00BUPh-1o; Thu, 16 Feb 2023 18:22:25 +0000 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSith-00BUJr-QT for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:22:23 +0000 Received: by mail-pj1-x1036.google.com with SMTP id gd1so2739769pjb.1 for ; Thu, 16 Feb 2023 10:22:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=6k9kFgHhGrniFtz38iNTmjHDIue+Ed5Mfkw3G0DBXLc=; b=kK5aVj5XXgADplAjlm4YI2+at0WD39rzqE/oIyTucqgfAxPxz7s7VY0dLKzFQG5tS9 ohX9Fg8TbtfoL8ktTHsnWOfizVCmB8RTZWvbpQ3KV+LgYLfvrtpdXcpHf793sUDvzNMg lrBMnAjwcfhd9iQm5CeiEPB3lza3dy4hn9W8Tsx6uN7FO+cuhc1xO65+BQY6JS50/PmX ak8JWUQbkP69ZNG5odZ2HxxwPL4oirSxHRqb9SJ1QeT06nvilKmAjBuqESK7HvhO7Oss K77HkI2Oy23RBT+GMy9TTpF9xWGTHgx/4UNeOUZ28D/80kgEFkadRcIz47s4KDKFKP6k svHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=6k9kFgHhGrniFtz38iNTmjHDIue+Ed5Mfkw3G0DBXLc=; b=qwvHzkkmemqBlXZbSQud+DhRFFwHVnB6t5iBepGSWV5omN6TBEIYPGR1ECWe7MGpmY 1XvhjIwEHMaVYUTu7MT346BGwFUopuwKan4XQ+xHNyGqYEwfFZCpFgGzoQVTm0hud+J4 SfmkFlPb4/exwTzMtV2GfOS6SfsmUzYCfVKm+W+0xlbvJ4BGzatz1SY++DSov4SDSX45 G6fQRfV56zfFUt6TubYM24W3EP6NK9WqeUQSvtlOisX+Be/hJBolC3Nt7AO6zKOXo6hP l2h8wo6plt3ieSypOnL3CvU3SzrttXic3DSl7BL8xXElyjnu03LArzyiyZKeuot+VvMs NRHw== X-Gm-Message-State: AO0yUKX70M3cYHYNQd7UKWifQ7642dTiVYzF5J8FclNprb7DGs+ifr/R 56mHvmhxxOJ3tIFLxHYQXBuRyg== X-Google-Smtp-Source: AK7set9c+aWEKO1Pw1h7Pzh7UhGNa//RafytfZpTPnUB+L6FRIQe5YzjjBo8BOJIm3kXdNQRXY4WEA== X-Received: by 2002:a05:6a20:8f04:b0:bf:73d:485e with SMTP id b4-20020a056a208f0400b000bf073d485emr7842207pzk.54.1676571738700; Thu, 16 Feb 2023 10:22:18 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.22.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:22:18 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 18/21] RISC-V: Add ACPI initialization in setup_arch() Date: Thu, 16 Feb 2023 23:50:40 +0530 Message-Id: <20230216182043.1946553-19-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102221_899790_CB8422CB X-CRM114-Status: GOOD ( 23.19 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Initialize the ACPI core for RISC-V during boot. ACPI tables and interpreter are initialized based on the information passed from the firmware and the value of the kernel parameter 'acpi'. Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki Reviewed-by: Andrew Jones --- arch/riscv/kernel/acpi.c | 113 ++++++++++++++++++++++++++++++++++++++ arch/riscv/kernel/setup.c | 25 ++++++--- 2 files changed, 130 insertions(+), 8 deletions(-) diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c index 13b26c87c136..35e7b24a30c8 100644 --- a/arch/riscv/kernel/acpi.c +++ b/arch/riscv/kernel/acpi.c @@ -16,6 +16,7 @@ #include #include #include +#include int acpi_noirq = 1; /* skip ACPI IRQ initialization */ int acpi_disabled = 1; @@ -26,6 +27,118 @@ EXPORT_SYMBOL(acpi_pci_disabled); static unsigned int intc_count; static struct acpi_madt_rintc cpu_madt_rintc[NR_CPUS]; +static bool param_acpi_off __initdata; +static bool param_acpi_on __initdata; +static bool param_acpi_force __initdata; + +static int __init parse_acpi(char *arg) +{ + if (!arg) + return -EINVAL; + + /* "acpi=off" disables both ACPI table parsing and interpreter */ + if (strcmp(arg, "off") == 0) + param_acpi_off = true; + else if (strcmp(arg, "on") == 0) /* prefer ACPI over DT */ + param_acpi_on = true; + else if (strcmp(arg, "force") == 0) /* force ACPI to be enabled */ + param_acpi_force = true; + else + return -EINVAL; /* Core will print when we return error */ + + return 0; +} +early_param("acpi", parse_acpi); + +/* + * acpi_fadt_sanity_check() - Check FADT presence and carry out sanity + * checks on it + * + * Return 0 on success, <0 on failure + */ +static int __init acpi_fadt_sanity_check(void) +{ + struct acpi_table_header *table; + struct acpi_table_fadt *fadt; + acpi_status status; + int ret = 0; + + /* + * FADT is required on riscv; retrieve it to check its presence + * and carry out revision and ACPI HW reduced compliancy tests + */ + status = acpi_get_table(ACPI_SIG_FADT, 0, &table); + if (ACPI_FAILURE(status)) { + const char *msg = acpi_format_exception(status); + + pr_err("Failed to get FADT table, %s\n", msg); + return -ENODEV; + } + + fadt = (struct acpi_table_fadt *)table; + + if (!(fadt->flags & ACPI_FADT_HW_REDUCED)) { + pr_err("FADT not ACPI hardware reduced compliant\n"); + ret = -EINVAL; + } + + /* + * acpi_get_table() creates FADT table mapping that + * should be released after parsing and before resuming boot + */ + acpi_put_table(table); + return ret; +} + +/* + * acpi_boot_table_init() called from setup_arch(), always. + * 1. find RSDP and get its address, and then find XSDT + * 2. extract all tables and checksums them all + * 3. check ACPI FADT HW reduced flag + * + * We can parse ACPI boot-time tables such as MADT after + * this function is called. + * + * On return ACPI is enabled if either: + * + * - ACPI tables are initialized and sanity checks passed + * - acpi=force was passed in the command line and ACPI was not disabled + * explicitly through acpi=off command line parameter + * + * ACPI is disabled on function return otherwise + */ +void __init acpi_boot_table_init(void) +{ + /* + * Enable ACPI instead of device tree unless + * - ACPI has been disabled explicitly (acpi=off), or + * - firmware has not populated ACPI ptr in EFI system table + * and ACPI has not been [force] enabled (acpi=on|force) + */ + if (param_acpi_off || + (!param_acpi_on && !param_acpi_force && + efi.acpi20 == EFI_INVALID_TABLE_ADDR)) + return; + + /* + * ACPI is disabled at this point. Enable it in order to parse + * the ACPI tables and carry out sanity checks + */ + enable_acpi(); + + /* + * If ACPI tables are initialized and FADT sanity checks passed, + * leave ACPI enabled and carry on booting; otherwise disable ACPI + * on initialization error. + * If acpi=force was passed on the command line it forces ACPI + * to be enabled even if its initialization failed. + */ + if (acpi_table_init() || acpi_fadt_sanity_check()) { + pr_err("Failed to init ACPI tables\n"); + if (!param_acpi_force) + disable_acpi(); + } +} static int acpi_parse_madt_rintc(union acpi_subtable_headers *header, const unsigned long end) { diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index 4335f08ffaf2..c2ee7f4427a1 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -8,6 +8,7 @@ * Nick Kossifidis */ +#include #include #include #include @@ -276,14 +277,22 @@ void __init setup_arch(char **cmdline_p) efi_init(); paging_init(); -#if IS_ENABLED(CONFIG_BUILTIN_DTB) - unflatten_and_copy_device_tree(); -#else - if (early_init_dt_verify(__va(XIP_FIXUP(dtb_early_pa)))) - unflatten_device_tree(); - else - pr_err("No DTB found in kernel mappings\n"); -#endif + + /* Parse the ACPI tables for possible boot-time configuration */ + acpi_boot_table_init(); + if (acpi_disabled) { + if (IS_ENABLED(CONFIG_BUILTIN_DTB)) { + unflatten_and_copy_device_tree(); + } else { + if (early_init_dt_verify(__va(XIP_FIXUP(dtb_early_pa)))) + unflatten_device_tree(); + else + pr_err("No DTB found in kernel mappings\n"); + } + } else { + early_init_dt_verify(__va(XIP_FIXUP(dtb_early_pa))); + } + early_init_fdt_scan_reserved_mem(); misc_mem_init(); From patchwork Thu Feb 16 18:20:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143648 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4CB5AC61DA4 for ; Thu, 16 Feb 2023 18:23:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WiOXHA+ZL7Cca5lBpTSiGOpxOjg69KUYZYJzEyofr0Y=; b=Kr7sWuXvoveO+P G0Eo4teNezsvlC6l9sLoNUh3R6aYtaUe3obNHRAMY9l6FpWXDUdFPR4jWhbT9xBwctekzcxl+uDvR s0BynCEjuxixR2ozBoa40nEoU/fjN/ofFJazCZ6mPtKO0fyeSfP75HM5O3DwYp7GauXosrDdwiTRa WgqTKWEGemSz43DxzGkBQwyjhlMIw9DD0jT+xb+FiY40mzcqeQsUfR0xiMIHylVjLf5HlvPk0qPJ+ mpmHIxDFYtfyWoO0DmzmbewfdKrLBDq6/o/1QQwXG6GS83C38RBHu+ETlvIIyQFZvxyIJSRZCESUY 0uVCf4+cbMM2p1DOeKqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSiuH-00BUn9-P4; Thu, 16 Feb 2023 18:22:57 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSitm-00BUOb-Lf for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:22:28 +0000 Received: by mail-pj1-x1034.google.com with SMTP id bg2so2711239pjb.4 for ; Thu, 16 Feb 2023 10:22:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=6w2bEiZ6pur5iCJunBAbzO2Rizq6VDyDF+3QNnzo8W4=; b=l+Os/mGF5YrQc2akg1w1/Es5B6/JyAn8aMu4QNlpR0eLtL5rBvzBv3N+L4c4RAn3e2 NWNQNJpm0yKXy2rpw8YXGRC9gfaABRTsrNzT+6q9AHftHO6EqPvXXlSHVqvE8MtnkG85 bkEslI8Ab9s0kLn040AFK2BWrECBEs0qEbPrv3vIrmvB5unRFZw2u0Xmp3oQ1YiYuy6l QKR0UKd+kZ/ZLd2MHjaHuhKZOfw+RDFIMRDmKg0/OU6e4Fd/uRFx6uWrpRekjAgwbbyv S89p0dZYt/HbQdps6oczHvziFLZv8Bt1VvD3m/LjDuwwTgBZm5zAel2igXlkA6trDU69 cioQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=6w2bEiZ6pur5iCJunBAbzO2Rizq6VDyDF+3QNnzo8W4=; b=nowpdFoTV18FIAZ5BdcfW2zZc4mqbe9xSzMNOW8Xvxu6aK9va9M9ECH3g/n99GAtdO 90wkgzDsEylskEgwTxNxvtlpIoXRd3Sg7K06clvSQCzszMbjMSh6jHay1UvaR9OLh4XI k5lnffqyUEV8ANwt2Jj6FKvWnGnpBwuhpI6aFsYxpLriiAXYBXfLRBRV4FMHMLW5moyq kJqS+i14aELcZeoNRXMIHUyht83KYnQDS8Z2Td5QsWDOglgv4siGPrbHHadIbjInrSiQ pmFAXqwS9mkiy5W/i7qzx/K0y9utBf7w7iJJWx8yegmh2d0SlTk2iL0cGvt//9lJBO+5 N1uQ== X-Gm-Message-State: AO0yUKWYUlKEDPhMQhtr0/t778WsCFManVUDzq6mH5NYCbx8wvt3u2x5 FQ4BJjNom7GljtSqtg4wcX48/A== X-Google-Smtp-Source: AK7set90jL8Ub99U8TFOUkAjXVqJvu8GPAP0Rn8q+1zVd+74L+TSkgpW2/7HHEruLJohOXin4327bQ== X-Received: by 2002:a05:6a20:c5a9:b0:c6:d84a:ce1c with SMTP id gn41-20020a056a20c5a900b000c6d84ace1cmr4929180pzb.35.1676571743596; Thu, 16 Feb 2023 10:22:23 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.22.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:22:23 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 19/21] RISC-V: Enable ACPI in defconfig Date: Thu, 16 Feb 2023 23:50:41 +0530 Message-Id: <20230216182043.1946553-20-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102226_750604_91B222BB X-CRM114-Status: UNSURE ( 8.36 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add support to build ACPI subsystem in defconfig. Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki --- arch/riscv/configs/defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig index 128dcf4c0814..f89f79294b34 100644 --- a/arch/riscv/configs/defconfig +++ b/arch/riscv/configs/defconfig @@ -218,3 +218,5 @@ CONFIG_RCU_EQS_DEBUG=y # CONFIG_FTRACE is not set # CONFIG_RUNTIME_TESTING_MENU is not set CONFIG_MEMTEST=y +CONFIG_ACPI=y +# CONFIG_PCI_QUIRKS is not set From patchwork Thu Feb 16 18:20:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143649 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 56D1EC636CC for ; Thu, 16 Feb 2023 18:23:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tbhV8uuPPAywdygotuYtkSqBdiYeuofu/RnmhU8JBtc=; b=jA2MP+Cz1a2HRs rWvYdXg0MqXZK47mDvPmIHO98RHqDiimCa+km0xGSVhAh6+N/0KLt/Bm6UUfPtgI/5+s2+H+5YcZO A9E3I93m7wDwOiQXVirgfinELDOQ0HWIdxfFzULSNZ6wSjNEr79pN4pwOm/8jSzeNsGMqx2al74jW yfSSvkIotXpEjM5IVEy0jaX22FN43dK1oekKytYQgT/UjHLLFKAMy8OOWOeaYmIj6gqBGtla/JksT KB5TQPeYiON2lNRVjCcPgiOfeAAEVgOS702cv68os+XZnPy+b16D4+unlGhvjvDMQB4Jeka+CuUAV cFM1Ij8WvkwVcTOIJ1sA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSiuh-00BV63-4A; Thu, 16 Feb 2023 18:23:23 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSitp-00BUTc-7a for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:22:30 +0000 Received: by mail-pj1-x102e.google.com with SMTP id d13-20020a17090ad3cd00b0023127b2d602so2979546pjw.2 for ; Thu, 16 Feb 2023 10:22:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=k6uh9i4Yg2UK+dtGNl63Dd2v2b9w/htIfSHYIG3sIgo=; b=mVXuI8tX22NJDu6yVW/g1R+u+kgg7UXHeVhfNyF0TbYKOj0ZLb3xWMXyv+ME0Gy0rG tVCkdPYlWPmzvGBICTXFxxMRlSS8pK/B2pxXGD9Sc36/petkDWVVq6qQSlCJSPy1sEg4 6AEhM/RTUff4Vh1y1IE6JfJ8iJDn39isEDMJI5giDQ4EWkEQRw9J6xFOwqvn4VmXNGM+ Ws+txz0rVy1NiDnjoPhdWs8J1x1YM1/HGFFOzizB5CJuJMkMuD6f2JS8IUgzj1T42PEs u7s3Js0bFqORE8smkyQu+P363zbCeyeYdVQRhTHs9bfJBw+/SiFAtZAR2SXhVgOjav4v YBsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=k6uh9i4Yg2UK+dtGNl63Dd2v2b9w/htIfSHYIG3sIgo=; b=hT1VZ8oiUV/PIu5yZ4BSLMjeefRA9sOQQtEWw7y9r/y4IY/QSLJTcYHoaWWqXB6bA2 THgeFd9c2dtWsoQxOtaSfj5icOP/aeHoNCYAU+kLRDMA5X5Pc8e1wFIEpw8HUnP3DTMY 1ZHz+TDrGYQLUO2Qsd/91A/e7ZtEqjBkc7qL1mvssGqLSPkVh7UlgeD5/kRoafWMxKBa DKY4k0OJ6ArY1Br1bg+/YpbfOjqGfWpjfJHXMO/LO685MXHpnSyII5VfbKnz0KOhyhu8 B+top3xxUEZhJtNKEhp6548O2ufS2fhyJinEzg6dGWmex9YvEjLg9sRCMAciYH/b+vgd s6pA== X-Gm-Message-State: AO0yUKVCYrRPmRmnH883wIklyEodxXSF9NQ3Ts25UhKJzTC7PWB//nt8 ydQX9fNbVNLz0S9p1HYoa4fQ4A== X-Google-Smtp-Source: AK7set8osOOcu+B/NPunBtlVAq9P8M092Oegw2Ys2UWMJiWbFSK/cFchK4srmj2/JHgMb6lllccJdQ== X-Received: by 2002:a17:902:e88d:b0:199:15bb:8316 with SMTP id w13-20020a170902e88d00b0019915bb8316mr8101008plg.68.1676571748298; Thu, 16 Feb 2023 10:22:28 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.22.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:22:27 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 20/21] MAINTAINERS: Add entry for drivers/acpi/riscv Date: Thu, 16 Feb 2023 23:50:42 +0530 Message-Id: <20230216182043.1946553-21-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102229_348867_4742D04F X-CRM114-Status: UNSURE ( 7.66 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org ACPI defines few RISC-V specific tables which need parsing code added in drivers/acpi/riscv. Add maintainer entries for this newly created folder. Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 39ff1a717625..d47212194457 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -450,6 +450,13 @@ S: Orphan F: drivers/platform/x86/wmi.c F: include/uapi/linux/wmi.h +ACPI FOR RISC-V (ACPI/riscv) +M: Sunil V L +L: linux-acpi@vger.kernel.org +L: linux-riscv@lists.infradead.org +S: Maintained +F: drivers/acpi/riscv + ACRN HYPERVISOR SERVICE MODULE M: Fei Li L: acrn-dev@lists.projectacrn.org (subscribers-only) From patchwork Thu Feb 16 18:20:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13143650 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4FCF3C636CC for ; Thu, 16 Feb 2023 18:24:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ru3TiLYzNqZccs2JaKgUF0LrqyHC0OTqQQrCTxV4yZI=; b=RFSxuqQZi0orlO LECURuhzDmTJFf9AJGz0tyX/3JzKmha8n1mkyCgsWb/UPO55Hk+0R5w9fuk90IurCeqbOrBW6JDXQ Q+e0PiyZ/+pZISbka4QX55aBCdQ8os/xb6VBC9HKGwx8O0kxsh0zm9ckb1en7ZfyOxNHRmEEFrpJi u8v5hPLiQxYen/3QStkmWGqD+K3UpI9M2NRe3F+s3kuqWnYqfrTFqtOWReQyYbPyYFZCL9AGO8E5L K56SgRZg1cGOtechkmPQQ8CkPPFhdRcHwiwXTZfWMb+8ZAPvLISAHg40WYEK9ECXsGgFtdS0tlIVs YVv//1UTnAbSt+oIHfww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSivP-00BVcs-65; Thu, 16 Feb 2023 18:24:07 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSitt-00BUXr-Ue for linux-riscv@lists.infradead.org; Thu, 16 Feb 2023 18:22:36 +0000 Received: by mail-pj1-x1031.google.com with SMTP id bt4-20020a17090af00400b002341621377cso6729010pjb.2 for ; Thu, 16 Feb 2023 10:22:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=Rc+EdRzJ0SRGUPyQRF18IAjDuJpqdPevv1iUeqHNSDY=; b=MT+u6Ji2DSotNL/3ZJ31+4cfLb/HUgIEAzHyb/4A3W3hXKL7CuBMT7DFaf8PRm7cRi hkX1t1QcAn6Fsh4g9bblEZv+ilGLrh4phGy+dWKqmPb5y5cpQtlH3TAu+YOU0SnV0Luk HDucHKXRMGxNFDuLtGBJm3I9tnzVAAQ1MUc6DNMO077XW2R/1eEDaW0Jd2emJHRAWPjM HGm8QIKeax6/ljYPvC/5GtfUEcuV0hqZzqfkU0/3+9ZK0znENu0rEkld1JzriqhbZHHh XyGAE624cdyEKo/bR2ibxnm20fA1861ECmsz+HbEDZY/Me4+oPLiv4hAMXBd3+rQsqSP LmUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Rc+EdRzJ0SRGUPyQRF18IAjDuJpqdPevv1iUeqHNSDY=; b=e8K8/2K05NqLq9p8pYY/FeSbmhLv2XjdL980XJWgn3Uv5ZsJIJ++GAMDDggAZTmQQk qQ7bWZxeNcg5FoAFUHms4E9Lw09Cy46XYIQALKxoD2MzxECWYPGWG6n6gI9z8+ae/zgo y+v8OLbrTOZ4jhjawtzuLI3tMe/HjISp8Y0qSjk7L6AEyK3K/uyTAZ+id3TxncSx6KOl KsSqeurTBqWzMlsSU3aQ8UKjhZGchHzG95DLLZJxHtNsws/SfoZ5YZGLmxs70glueIN9 jn5J2zhhtEyjyaMAIPoeKEmlOVaX0dMo3c234Yhd8TspoP46ViqwJcXeL4NllBUs5C4n iedQ== X-Gm-Message-State: AO0yUKVuZUx6wRCjUJP0dgoDT5KeY6QzI1kDS860RCClT4N9/3MRZblB a4XrFIV+kUnNAemb0RCskSJk0w== X-Google-Smtp-Source: AK7set9M9fF7YNnpHhSlQVgpgwmmQbyWXyDh9qg54yswDsPTDVjsTPAME9mc2ETjA4Y1JYejJYwZog== X-Received: by 2002:a05:6a20:d49b:b0:bd:278:f68f with SMTP id im27-20020a056a20d49b00b000bd0278f68fmr6832215pzb.52.1676571753281; Thu, 16 Feb 2023 10:22:33 -0800 (PST) Received: from kerodi.Dlink ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id n21-20020a637215000000b004dff15fc121sm1517574pgc.36.2023.02.16.10.22.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:22:32 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , Paul Walmsley , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Jonathan Corbet Subject: [PATCH V2 21/21] Documentation/kernel-parameters.txt: Add RISC-V for ACPI parameter Date: Thu, 16 Feb 2023 23:50:43 +0530 Message-Id: <20230216182043.1946553-22-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216182043.1946553-1-sunilvl@ventanamicro.com> References: <20230216182043.1946553-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230216_102234_048320_B3689037 X-CRM114-Status: GOOD ( 10.27 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , linux-doc@vger.kernel.org, "Rafael J . Wysocki" , Atish Patra , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, Andrew Jones Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org With ACPI support added for RISC-V, this kernel parameter is also supported on RISC-V. Hence, update the documentation. Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki --- Documentation/admin-guide/kernel-parameters.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 6cfa6e3996cf..b3a5a5844daa 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -1,17 +1,17 @@ - acpi= [HW,ACPI,X86,ARM64] + acpi= [HW,ACPI,X86,ARM64,RISC-V] Advanced Configuration and Power Interface Format: { force | on | off | strict | noirq | rsdt | copy_dsdt } force -- enable ACPI if default was off - on -- enable ACPI but allow fallback to DT [arm64] + on -- enable ACPI but allow fallback to DT [arm64,riscv] off -- disable ACPI if default was on noirq -- do not use ACPI for IRQ routing strict -- Be less tolerant of platforms that are not strictly ACPI specification compliant. rsdt -- prefer RSDT over (default) XSDT copy_dsdt -- copy DSDT to memory - For ARM64, ONLY "acpi=off", "acpi=on" or "acpi=force" - are available + For ARM64 and RISC-V, ONLY "acpi=off", "acpi=on" or + "acpi=force" are available See also Documentation/power/runtime_pm.rst, pci=noacpi