From mboxrd@z Thu Jan 1 00:00:00 1970 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 435DBC77B75 for ; Tue, 9 May 2023 17:50: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-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EG9jBdDNrjO93HhNX4OIxnQDmpR/xqZa/FmaqNQrXjQ=; b=14GNLdIDDTSmSzdMqGMBQ5io4d Uy6rP+ncrujuf1/xEUWkomBZgKIICzkF6LfYYIgqcgjwsLR881DOM/b1ipgV7mWtXYXYSFU+OwyhY jyxIsPkEzUjPTct/HxA7oWW1hwwTitRmzKMSqZsYdoN6BAfy7UKRl5PcaCAPe577jnE1SxVSMgFqG gZwBJck0VNFq2rxq3bHfdZ7VT8kfYYwU95QaI1+S2hkLZLgGmtBqWchdhclb2pw8XW8/IXPd3Axoa 7TpWDWEYPCQn0WZ4JSytaV0VAoIRvxvwBNlv02fSWNZ7C0TipcWKPOCmXbCVyDI3pFeDMUxcVYVLx sTAWAbgQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pwRTg-003w63-34; Tue, 09 May 2023 17:50:20 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pwRTe-003w5M-16 for linux-riscv@lists.infradead.org; Tue, 09 May 2023 17:50:20 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5281162FB6; Tue, 9 May 2023 17:50:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C601C433EF; Tue, 9 May 2023 17:50:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683654615; bh=rVSz+Tb3H1/HHESESFxVFjW2CxxTsz7vH2xOqzNlQXc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SWUmzHG8xFjWpRkUn7jxvkUG21EZyVRmvIHAfaVcDHRGM9jMRutvis8vhLLUy4O6s TNfr8CkW+0xFnginSyEkOvFBFvpfOmfhA5nD3ARTrQ70JeNf4ZdFCI5HaO0KOLYccW vQdtgGdmg/tQ5H63l/yZA/IRiWefyI99JD7UG/jkDkK98gs8oeXFAAGuZ3x/WUQl08 dJVCQI52RgYMOfw8/KVYJ1KtUhhMWuPE0OU99QGXVBQFCtLEJXKyVpOEh03tYK0nnO JOdA+2jhGLcjwX9OUN+wPeWnGy/ROl2o4urTxQBEOvfJ3/SX8Fmf+xvybwL/5Cz17z qRmXV8na65m5w== Date: Tue, 9 May 2023 18:50:07 +0100 From: Conor Dooley To: Sunil V L Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-acpi@vger.kernel.org, linux-crypto@vger.kernel.org, platform-driver-x86@vger.kernel.org, llvm@lists.linux.dev, Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Rafael J . Wysocki" , Len Brown , Daniel Lezcano , Thomas Gleixner , Weili Qian , Zhou Wang , Herbert Xu , "David S . Miller" , Marc Zyngier , Maximilian Luz , Hans de Goede , Mark Gross , Nathan Chancellor , Nick Desaulniers , Tom Rix , "Rafael J . Wysocki" Subject: Re: [PATCH V5 08/21] RISC-V: ACPI: Cache and retrieve the RINTC structure Message-ID: <20230509-atlantic-writing-3ceea38e050e@spud> References: <20230508115237.216337-1-sunilvl@ventanamicro.com> <20230508115237.216337-9-sunilvl@ventanamicro.com> MIME-Version: 1.0 In-Reply-To: <20230508115237.216337-9-sunilvl@ventanamicro.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230509_105018_484172_F96F20D2 X-CRM114-Status: GOOD ( 31.71 ) 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: , Content-Type: multipart/mixed; boundary="===============5867981783939525503==" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org --===============5867981783939525503== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="VyG74+KZvewY8TZ5" Content-Disposition: inline --VyG74+KZvewY8TZ5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hey Sunil, On Mon, May 08, 2023 at 05:22:24PM +0530, Sunil V L wrote: > RINTC structures in the MADT provide mapping between the hartid > and the CPU. This is required many times even at run time like > cpuinfo. So, instead of parsing the ACPI table every time, cache > the RINTC structures and provide a function to get the correct > RINTC structure for a given cpu. >=20 > Signed-off-by: Sunil V L > Acked-by: Rafael J. Wysocki =46rom this patch until "RISC-V: Add ACPI initialization in setup_arch()" (which is 19/21), the series fails to build. allmodconfig, clang-16: =2E./arch/riscv/include/asm/acpi.h:22:23: error: unknown type name 'acpi_ph= ysical_address'; did you mean 'efi_physical_addr_t'? =2E./arch/riscv/include/asm/acpi.h:22:51: error: unknown type name 'acpi_si= ze' rv32_defconfig, clang-16: arch/riscv/kernel/setup.c:297:7: error: use of undeclared identifier 'acpi_= disabled'; did you mean '__cpu_disable'? arch/riscv/kernel/setup.c:297:7: warning: address of function '__cpu_disabl= e' will always evaluate to 'true' [-Wpointer-bool-conversion] I ballsed up a toolchain upgrade to gcc-13, so the whole series is showing build issues on patchwork for the gcc configurations: https://patchwork.kernel.org/project/linux-riscv/list/?series=3D745787 However, I suspect that the same patches that fail for clang-16 will fail for gcc-13 too, once I have fixed that! Cheers, Conor. > --- > arch/riscv/include/asm/acpi.h | 10 ++++++++ > arch/riscv/kernel/acpi.c | 45 +++++++++++++++++++++++++++++++++++ > arch/riscv/kernel/setup.c | 4 ++++ > 3 files changed, 59 insertions(+) >=20 > diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h > index 9be52b6ffae1..6519529c8bdf 100644 > --- a/arch/riscv/include/asm/acpi.h > +++ b/arch/riscv/include/asm/acpi.h > @@ -59,6 +59,16 @@ static inline bool acpi_has_cpu_in_madt(void) > =20 > static inline void arch_fix_phys_package_id(int num, u32 slot) { } > =20 > +void acpi_init_rintc_map(void); > +struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu); > +u32 get_acpi_id_for_cpu(int cpu); > +#else > +static inline void acpi_init_rintc_map(void) { } > +static inline struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu) > +{ > + return NULL; > +} > + > #endif /* CONFIG_ACPI */ > =20 > #endif /*_ASM_ACPI_H*/ > diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c > index 81d448c41714..89e142611c84 100644 > --- a/arch/riscv/kernel/acpi.c > +++ b/arch/riscv/kernel/acpi.c > @@ -24,6 +24,51 @@ EXPORT_SYMBOL(acpi_disabled); > int acpi_pci_disabled =3D 1; /* skip ACPI PCI scan and IRQ initializatio= n */ > EXPORT_SYMBOL(acpi_pci_disabled); > =20 > +static struct acpi_madt_rintc cpu_madt_rintc[NR_CPUS]; > + > +static int acpi_parse_madt_rintc(union acpi_subtable_headers *header, co= nst unsigned long end) > +{ > + struct acpi_madt_rintc *rintc =3D (struct acpi_madt_rintc *)header; > + int cpuid; > + > + if (!(rintc->flags & ACPI_MADT_ENABLED)) > + return 0; > + > + cpuid =3D riscv_hartid_to_cpuid(rintc->hart_id); > + /* > + * When CONFIG_SMP is disabled, mapping won't be created for > + * all cpus. > + * CPUs more than num_possible_cpus, will be ignored. > + */ > + if (cpuid >=3D 0 && cpuid < num_possible_cpus()) > + cpu_madt_rintc[cpuid] =3D *rintc; > + > + return 0; > +} > + > +/* > + * Instead of parsing (and freeing) the ACPI table, cache > + * the RINTC structures since they are frequently used > + * like in cpuinfo. > + */ > +void __init acpi_init_rintc_map(void) > +{ > + if (acpi_table_parse_madt(ACPI_MADT_TYPE_RINTC, acpi_parse_madt_rintc, = 0) <=3D 0) { > + pr_err("No valid RINTC entries exist\n"); > + BUG(); > + } > +} > + > +struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu) > +{ > + return &cpu_madt_rintc[cpu]; > +} > + > +u32 get_acpi_id_for_cpu(int cpu) > +{ > + return acpi_cpu_get_madt_rintc(cpu)->uid; > +} > + > /* > * __acpi_map_table() will be called before paging_init(), so early_iore= map() > * or early_memremap() should be called here to for ACPI table mapping. > diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c > index 9fb839074e16..a44c7fcde12f 100644 > --- a/arch/riscv/kernel/setup.c > +++ b/arch/riscv/kernel/setup.c > @@ -21,6 +21,7 @@ > #include > #include > =20 > +#include > #include > #include > #include > @@ -293,6 +294,9 @@ void __init setup_arch(char **cmdline_p) > setup_smp(); > #endif > =20 > + if (!acpi_disabled) > + acpi_init_rintc_map(); > + > riscv_init_cbo_blocksizes(); > riscv_fill_hwcap(); > apply_boot_alternatives(); > --=20 > 2.34.1 >=20 --VyG74+KZvewY8TZ5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZFqHzwAKCRB4tDGHoIJi 0vwIAP42h0wsHOgAHQ3WyuVw8G1XFBezccQwODC76RxofaL0TAEA+V+4IuPaUdHr 5H2An4OZhjeskB4ClsRk3M+rqDqMXAc= =OVlw -----END PGP SIGNATURE----- --VyG74+KZvewY8TZ5-- --===============5867981783939525503== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv --===============5867981783939525503==--