From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============8171605444377363128==" MIME-Version: 1.0 From: Hanjun Guo Subject: Re: [Devel] [PATCH v7 13/15] ACPI / processor: Add acpi_map_madt_entry(). Date: Tue, 31 May 2016 13:05:37 +0000 Message-ID: <574D8C09.3030608@linaro.org> In-Reply-To: 1464129345-18985-14-git-send-email-ddaney.cavm@gmail.com List-ID: To: devel@acpica.org --===============8171605444377363128== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On 2016/5/25 6:35, David Daney wrote: > From: David Daney > > Follow-on arm64 ACPI/NUMA patches need to map MADT entries very early > (before kmalloc is usable). > > Add acpi_map_madt_entry() which, indirectly, uses > early_memremap()/early_memunmap() to access the table and parse out > the mpidr. The existing implementation of map_madt_entry() is > modified to take a pointer to the MADT as a parameter and the callers > adjusted. > > Signed-off-by: David Daney > --- > drivers/acpi/processor_core.c | 26 ++++++++++++++++++++++---- > include/acpi/processor.h | 1 + > 2 files changed, 23 insertions(+), 4 deletions(-) > > diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c > index 33a38d6..9125d7d 100644 > --- a/drivers/acpi/processor_core.c > +++ b/drivers/acpi/processor_core.c > @@ -108,13 +108,12 @@ static int map_gicc_mpidr(struct acpi_subtable_head= er *entry, > return -EINVAL; > } > > -static phys_cpuid_t map_madt_entry(int type, u32 acpi_id) > +static phys_cpuid_t map_madt_entry(struct acpi_table_madt *madt, > + int type, u32 acpi_id) > { > unsigned long madt_end, entry; > phys_cpuid_t phys_id =3D PHYS_CPUID_INVALID; /* CPU hardware ID */ > - struct acpi_table_madt *madt; > > - madt =3D get_madt_table(); > if (!madt) > return phys_id; > > @@ -145,6 +144,25 @@ static phys_cpuid_t map_madt_entry(int type, u32 acp= i_id) > return phys_id; > } > > +phys_cpuid_t __init acpi_map_madt_entry(u32 acpi_id) > +{ > + struct acpi_table_madt *madt =3D NULL; > + acpi_size tbl_size; > + phys_cpuid_t rv; > + > + acpi_get_table_with_size(ACPI_SIG_MADT, 0, > + (struct acpi_table_header **)&madt, > + &tbl_size); > + if (!madt) > + return PHYS_CPUID_INVALID; > + > + rv =3D map_madt_entry(madt, 1, acpi_id); Just nit-pick, pass 1 here means we need to define an acpi processor device object in DSDT (see function map_gicc_mpidr(), device_declaration), it would be fine for x2apic and gic mode, but not for lapic mode, since the function name is acpi_map_madt_entry which is general for all architecture, it will confuse people I think. How about rename acpi_map_madt_entry() to acpi_map_madt_gicc_entry()? It's only used for AMR64 to get mpidrs from GICC entries using acpi_id, other than that, it's good to me. Thanks Hanjun --===============8171605444377363128==-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hanjun Guo Subject: Re: [PATCH v7 13/15] ACPI / processor: Add acpi_map_madt_entry(). Date: Tue, 31 May 2016 21:05:13 +0800 Message-ID: <574D8C09.3030608@linaro.org> References: <1464129345-18985-1-git-send-email-ddaney.cavm@gmail.com> <1464129345-18985-14-git-send-email-ddaney.cavm@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mail-pa0-f53.google.com ([209.85.220.53]:34140 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753895AbcEaNFX (ORCPT ); Tue, 31 May 2016 09:05:23 -0400 Received: by mail-pa0-f53.google.com with SMTP id bz2so41800808pad.1 for ; Tue, 31 May 2016 06:05:23 -0700 (PDT) In-Reply-To: <1464129345-18985-14-git-send-email-ddaney.cavm@gmail.com> Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: David Daney , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Catalin Marinas , Tony Luck , Fenghua Yu , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, "Rafael J. Wysocki" , Len Brown , Rob Herring , Frank Rowand , Grant Likely , Robert Moore , Lv Zheng , Marc Zyngier , linux-ia64@vger.kernel.org, linux-acpi@vger.kernel.org, devel@acpica.org Cc: linux-kernel@vger.kernel.org, Robert Richter , David Daney On 2016/5/25 6:35, David Daney wrote: > From: David Daney > > Follow-on arm64 ACPI/NUMA patches need to map MADT entries very early > (before kmalloc is usable). > > Add acpi_map_madt_entry() which, indirectly, uses > early_memremap()/early_memunmap() to access the table and parse out > the mpidr. The existing implementation of map_madt_entry() is > modified to take a pointer to the MADT as a parameter and the callers > adjusted. > > Signed-off-by: David Daney > --- > drivers/acpi/processor_core.c | 26 ++++++++++++++++++++++---- > include/acpi/processor.h | 1 + > 2 files changed, 23 insertions(+), 4 deletions(-) > > diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c > index 33a38d6..9125d7d 100644 > --- a/drivers/acpi/processor_core.c > +++ b/drivers/acpi/processor_core.c > @@ -108,13 +108,12 @@ static int map_gicc_mpidr(struct acpi_subtable_header *entry, > return -EINVAL; > } > > -static phys_cpuid_t map_madt_entry(int type, u32 acpi_id) > +static phys_cpuid_t map_madt_entry(struct acpi_table_madt *madt, > + int type, u32 acpi_id) > { > unsigned long madt_end, entry; > phys_cpuid_t phys_id = PHYS_CPUID_INVALID; /* CPU hardware ID */ > - struct acpi_table_madt *madt; > > - madt = get_madt_table(); > if (!madt) > return phys_id; > > @@ -145,6 +144,25 @@ static phys_cpuid_t map_madt_entry(int type, u32 acpi_id) > return phys_id; > } > > +phys_cpuid_t __init acpi_map_madt_entry(u32 acpi_id) > +{ > + struct acpi_table_madt *madt = NULL; > + acpi_size tbl_size; > + phys_cpuid_t rv; > + > + acpi_get_table_with_size(ACPI_SIG_MADT, 0, > + (struct acpi_table_header **)&madt, > + &tbl_size); > + if (!madt) > + return PHYS_CPUID_INVALID; > + > + rv = map_madt_entry(madt, 1, acpi_id); Just nit-pick, pass 1 here means we need to define an acpi processor device object in DSDT (see function map_gicc_mpidr(), device_declaration), it would be fine for x2apic and gic mode, but not for lapic mode, since the function name is acpi_map_madt_entry which is general for all architecture, it will confuse people I think. How about rename acpi_map_madt_entry() to acpi_map_madt_gicc_entry()? It's only used for AMR64 to get mpidrs from GICC entries using acpi_id, other than that, it's good to me. Thanks Hanjun From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hanjun Guo Date: Tue, 31 May 2016 13:05:13 +0000 Subject: Re: [PATCH v7 13/15] ACPI / processor: Add acpi_map_madt_entry(). Message-Id: <574D8C09.3030608@linaro.org> List-Id: References: <1464129345-18985-1-git-send-email-ddaney.cavm@gmail.com> <1464129345-18985-14-git-send-email-ddaney.cavm@gmail.com> In-Reply-To: <1464129345-18985-14-git-send-email-ddaney.cavm@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: David Daney , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Catalin Marinas , Tony Luck , Fenghua Yu , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, "Rafael J. Wysocki" , Len Brown , Rob Herring , Frank Rowand , Grant Likely , Robert Moore , Lv Zheng , Marc Zyngier , linux-ia64@vger.kernel.org, linux-acpi@vger.kernel.org, devel@acpica.org Cc: linux-kernel@vger.kernel.org, Robert Richter , David Daney On 2016/5/25 6:35, David Daney wrote: > From: David Daney > > Follow-on arm64 ACPI/NUMA patches need to map MADT entries very early > (before kmalloc is usable). > > Add acpi_map_madt_entry() which, indirectly, uses > early_memremap()/early_memunmap() to access the table and parse out > the mpidr. The existing implementation of map_madt_entry() is > modified to take a pointer to the MADT as a parameter and the callers > adjusted. > > Signed-off-by: David Daney > --- > drivers/acpi/processor_core.c | 26 ++++++++++++++++++++++---- > include/acpi/processor.h | 1 + > 2 files changed, 23 insertions(+), 4 deletions(-) > > diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c > index 33a38d6..9125d7d 100644 > --- a/drivers/acpi/processor_core.c > +++ b/drivers/acpi/processor_core.c > @@ -108,13 +108,12 @@ static int map_gicc_mpidr(struct acpi_subtable_header *entry, > return -EINVAL; > } > > -static phys_cpuid_t map_madt_entry(int type, u32 acpi_id) > +static phys_cpuid_t map_madt_entry(struct acpi_table_madt *madt, > + int type, u32 acpi_id) > { > unsigned long madt_end, entry; > phys_cpuid_t phys_id = PHYS_CPUID_INVALID; /* CPU hardware ID */ > - struct acpi_table_madt *madt; > > - madt = get_madt_table(); > if (!madt) > return phys_id; > > @@ -145,6 +144,25 @@ static phys_cpuid_t map_madt_entry(int type, u32 acpi_id) > return phys_id; > } > > +phys_cpuid_t __init acpi_map_madt_entry(u32 acpi_id) > +{ > + struct acpi_table_madt *madt = NULL; > + acpi_size tbl_size; > + phys_cpuid_t rv; > + > + acpi_get_table_with_size(ACPI_SIG_MADT, 0, > + (struct acpi_table_header **)&madt, > + &tbl_size); > + if (!madt) > + return PHYS_CPUID_INVALID; > + > + rv = map_madt_entry(madt, 1, acpi_id); Just nit-pick, pass 1 here means we need to define an acpi processor device object in DSDT (see function map_gicc_mpidr(), device_declaration), it would be fine for x2apic and gic mode, but not for lapic mode, since the function name is acpi_map_madt_entry which is general for all architecture, it will confuse people I think. How about rename acpi_map_madt_entry() to acpi_map_madt_gicc_entry()? It's only used for AMR64 to get mpidrs from GICC entries using acpi_id, other than that, it's good to me. Thanks Hanjun From mboxrd@z Thu Jan 1 00:00:00 1970 From: hanjun.guo@linaro.org (Hanjun Guo) Date: Tue, 31 May 2016 21:05:13 +0800 Subject: [PATCH v7 13/15] ACPI / processor: Add acpi_map_madt_entry(). In-Reply-To: <1464129345-18985-14-git-send-email-ddaney.cavm@gmail.com> References: <1464129345-18985-1-git-send-email-ddaney.cavm@gmail.com> <1464129345-18985-14-git-send-email-ddaney.cavm@gmail.com> Message-ID: <574D8C09.3030608@linaro.org> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 2016/5/25 6:35, David Daney wrote: > From: David Daney > > Follow-on arm64 ACPI/NUMA patches need to map MADT entries very early > (before kmalloc is usable). > > Add acpi_map_madt_entry() which, indirectly, uses > early_memremap()/early_memunmap() to access the table and parse out > the mpidr. The existing implementation of map_madt_entry() is > modified to take a pointer to the MADT as a parameter and the callers > adjusted. > > Signed-off-by: David Daney > --- > drivers/acpi/processor_core.c | 26 ++++++++++++++++++++++---- > include/acpi/processor.h | 1 + > 2 files changed, 23 insertions(+), 4 deletions(-) > > diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c > index 33a38d6..9125d7d 100644 > --- a/drivers/acpi/processor_core.c > +++ b/drivers/acpi/processor_core.c > @@ -108,13 +108,12 @@ static int map_gicc_mpidr(struct acpi_subtable_header *entry, > return -EINVAL; > } > > -static phys_cpuid_t map_madt_entry(int type, u32 acpi_id) > +static phys_cpuid_t map_madt_entry(struct acpi_table_madt *madt, > + int type, u32 acpi_id) > { > unsigned long madt_end, entry; > phys_cpuid_t phys_id = PHYS_CPUID_INVALID; /* CPU hardware ID */ > - struct acpi_table_madt *madt; > > - madt = get_madt_table(); > if (!madt) > return phys_id; > > @@ -145,6 +144,25 @@ static phys_cpuid_t map_madt_entry(int type, u32 acpi_id) > return phys_id; > } > > +phys_cpuid_t __init acpi_map_madt_entry(u32 acpi_id) > +{ > + struct acpi_table_madt *madt = NULL; > + acpi_size tbl_size; > + phys_cpuid_t rv; > + > + acpi_get_table_with_size(ACPI_SIG_MADT, 0, > + (struct acpi_table_header **)&madt, > + &tbl_size); > + if (!madt) > + return PHYS_CPUID_INVALID; > + > + rv = map_madt_entry(madt, 1, acpi_id); Just nit-pick, pass 1 here means we need to define an acpi processor device object in DSDT (see function map_gicc_mpidr(), device_declaration), it would be fine for x2apic and gic mode, but not for lapic mode, since the function name is acpi_map_madt_entry which is general for all architecture, it will confuse people I think. How about rename acpi_map_madt_entry() to acpi_map_madt_gicc_entry()? It's only used for AMR64 to get mpidrs from GICC entries using acpi_id, other than that, it's good to me. Thanks Hanjun