Re: svn commit: r322347 - in head/sys/x86: acpica include x86 xen

2017-08-11 Thread Roger Pau Monn
On Fri, Aug 11, 2017 at 10:10:15AM +, Li-Wen Hsu wrote:
> On Thu, Aug 10, 2017 at 18:48:53 +0100, Roger Pau Monn wrote:
> > On Thu, Aug 10, 2017 at 10:20:59AM -0400, Ed Maste wrote:
> > > On 10 August 2017 at 05:15, Roger Pau Monné  wrote:
> > > > Author: royger
> > > > Date: Thu Aug 10 09:15:18 2017
> > > > New Revision: 322347
> > > > URL: https://svnweb.freebsd.org/changeset/base/322347
> > > >
> > > > Log:
> > > >   apic_enumerator: only set mp_ncpus and mp_maxid at probe cpus phase
> > > 
> > > i386 is failing with:
> > 
> > Thanks for the heads up! Should be fixed in r322372, will keep an eye on
> > the CI.
> 
> It seems i386 LINT is still failing:
> 
> /workspace/src/sys/x86/acpica/srat.c:446:28: error: implicit declaration of 
> function 'PHYS_TO_DMAP' is invalid in C99 
> [-Werror,-Wimplicit-function-declaration]
> cpus = (struct cpu_info *)PHYS_TO_DMAP(addr);
>   ^
> 
> Could you also chcek this one? 
> https://ci.freebsd.org/job/FreeBSD-head-i386-LINT/2833/console

Sorry again for the breakage, should be fixed in r322403. Not sure if
it makes much sense to parse the SRAT on i386 anyway.

Roger.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r322347 - in head/sys/x86: acpica include x86 xen

2017-08-11 Thread Li-Wen Hsu
On Thu, Aug 10, 2017 at 18:48:53 +0100, Roger Pau Monn wrote:
> On Thu, Aug 10, 2017 at 10:20:59AM -0400, Ed Maste wrote:
> > On 10 August 2017 at 05:15, Roger Pau Monné  wrote:
> > > Author: royger
> > > Date: Thu Aug 10 09:15:18 2017
> > > New Revision: 322347
> > > URL: https://svnweb.freebsd.org/changeset/base/322347
> > >
> > > Log:
> > >   apic_enumerator: only set mp_ncpus and mp_maxid at probe cpus phase
> > 
> > i386 is failing with:
> 
> Thanks for the heads up! Should be fixed in r322372, will keep an eye on
> the CI.

It seems i386 LINT is still failing:

/workspace/src/sys/x86/acpica/srat.c:446:28: error: implicit declaration of 
function 'PHYS_TO_DMAP' is invalid in C99 
[-Werror,-Wimplicit-function-declaration]
cpus = (struct cpu_info *)PHYS_TO_DMAP(addr);
  ^

Could you also chcek this one? 
https://ci.freebsd.org/job/FreeBSD-head-i386-LINT/2833/console

Thanks,
Li-Wen

-- 
Li-Wen Hsu 
https://lwhsu.org
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r322347 - in head/sys/x86: acpica include x86 xen

2017-08-10 Thread Roger Pau Monné
On Thu, Aug 10, 2017 at 10:20:59AM -0400, Ed Maste wrote:
> On 10 August 2017 at 05:15, Roger Pau Monné  wrote:
> > Author: royger
> > Date: Thu Aug 10 09:15:18 2017
> > New Revision: 322347
> > URL: https://svnweb.freebsd.org/changeset/base/322347
> >
> > Log:
> >   apic_enumerator: only set mp_ncpus and mp_maxid at probe cpus phase
> 
> i386 is failing with:

Thanks for the heads up! Should be fixed in r322372, will keep an eye on
the CI.

Roger.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r322347 - in head/sys/x86: acpica include x86 xen

2017-08-10 Thread Ed Maste
On 10 August 2017 at 05:15, Roger Pau Monné  wrote:
> Author: royger
> Date: Thu Aug 10 09:15:18 2017
> New Revision: 322347
> URL: https://svnweb.freebsd.org/changeset/base/322347
>
> Log:
>   apic_enumerator: only set mp_ncpus and mp_maxid at probe cpus phase

i386 is failing with:

13:55:08 --- mptable.o ---
13:55:08 /usr/src/sys/x86/x86/mptable.c:333:3: error: use of
undeclared identifier 'mp_ncpus'
13:55:08 mp_ncpus = 2;
13:55:08 ^
13:55:08 /usr/src/sys/x86/x86/mptable.c:334:3: error: use of
undeclared identifier 'mp_maxid'
13:55:08 mp_maxid = 1;
13:55:08 ^
13:55:08 /usr/src/sys/x86/x86/mptable.c:359:3: error: use of
undeclared identifier 'cpu_mask'
13:55:08 cpu_mask = 0;
13:55:08 ^
13:55:08 /usr/src/sys/x86/x86/mptable.c:360:51: error: use of
undeclared identifier 'cpu_mask'
13:55:08
mptable_walk_table(mptable_setup_cpus_handler, _mask);
13:55:08 ^
13:55:08 /usr/src/sys/x86/x86/mptable.c:480:39: error: use of
undeclared identifier 'mp_ncpus'
13:55:08 proc->apic_id < MAX_LAPIC_ID && mp_ncpus
< MAXCPU) {
13:55:08 ^
13:55:08 /usr/src/sys/x86/x86/mptable.c:481:4: error: use of
undeclared identifier 'mp_ncpus'
13:55:08 mp_ncpus++;
13:55:08 ^
13:55:08 /usr/src/sys/x86/x86/mptable.c:482:4: error: use of
undeclared identifier 'mp_maxid'
13:55:08 mp_maxid = mp_ncpus - 1;
13:55:08 ^
13:55:08 /usr/src/sys/x86/x86/mptable.c:482:15: error: use of
undeclared identifier 'mp_ncpus'
13:55:08 mp_maxid = mp_ncpus - 1;
13:55:08^
13:55:08 8 errors generated.
13:55:08 *** [mptable.o] Error code 1

https://ci.freebsd.org/job/FreeBSD-head-i386-build/3457/console
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r322347 - in head/sys/x86: acpica include x86 xen

2017-08-10 Thread Roger Pau Monné
Author: royger
Date: Thu Aug 10 09:15:18 2017
New Revision: 322347
URL: https://svnweb.freebsd.org/changeset/base/322347

Log:
  apic_enumerator: only set mp_ncpus and mp_maxid at probe cpus phase
  
  Populate the lapics arrays and call cpu_add/lapic_create in the setup
  phase instead. Also store the max APIC ID found in the newly
  introduced max_apic_id global variable.
  
  This is a requirement in order to make the static arrays currently
  using MAX_LAPIC_ID dynamic.
  
  Sponsored by: Citrix Systems R
  MFC after:1 month
  Reviewed by:  kib
  Differential revision:https://reviews.freebsd.org/D11911

Modified:
  head/sys/x86/acpica/madt.c
  head/sys/x86/acpica/srat.c
  head/sys/x86/include/x86_var.h
  head/sys/x86/x86/local_apic.c
  head/sys/x86/x86/mp_x86.c
  head/sys/x86/x86/mptable.c
  head/sys/x86/xen/pvcpu_enum.c

Modified: head/sys/x86/acpica/madt.c
==
--- head/sys/x86/acpica/madt.c  Thu Aug 10 09:02:44 2017(r322346)
+++ head/sys/x86/acpica/madt.c  Thu Aug 10 09:15:18 2017(r322347)
@@ -83,6 +83,8 @@ static intmadt_probe(void);
 static int madt_probe_cpus(void);
 static voidmadt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry,
void *arg __unused);
+static voidmadt_setup_cpus_handler(ACPI_SUBTABLE_HEADER *entry,
+   void *arg __unused);
 static voidmadt_register(void *dummy);
 static int madt_setup_local(void);
 static int madt_setup_io(void);
@@ -140,6 +142,7 @@ madt_setup_local(void)
bool bios_x2apic;
 
madt = pmap_mapbios(madt_physaddr, madt_length);
+   madt_walk_table(madt_setup_cpus_handler, NULL);
if ((cpu_feature2 & CPUID2_X2APIC) != 0) {
reason = NULL;
 
@@ -302,6 +305,19 @@ madt_walk_table(acpi_subtable_handler *handler, void *
 }
 
 static void
+madt_parse_cpu(unsigned int apic_id, unsigned int flags)
+{
+
+   if (!(flags & ACPI_MADT_ENABLED) || mp_ncpus == MAXCPU ||
+   apic_id > MAX_APIC_ID)
+   return;
+
+   mp_ncpus++;
+   mp_maxid = mp_ncpus - 1;
+   max_apic_id = max(apic_id, max_apic_id);
+}
+
+static void
 madt_add_cpu(u_int acpi_id, u_int apic_id, u_int flags)
 {
struct lapic_info *la;
@@ -331,6 +347,24 @@ madt_add_cpu(u_int acpi_id, u_int apic_id, u_int flags
 
 static void
 madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry, void *arg)
+{
+   ACPI_MADT_LOCAL_APIC *proc;
+   ACPI_MADT_LOCAL_X2APIC *x2apic;
+
+   switch (entry->Type) {
+   case ACPI_MADT_TYPE_LOCAL_APIC:
+   proc = (ACPI_MADT_LOCAL_APIC *)entry;
+   madt_parse_cpu(proc->Id, proc->LapicFlags);
+   break;
+   case ACPI_MADT_TYPE_LOCAL_X2APIC:
+   x2apic = (ACPI_MADT_LOCAL_X2APIC *)entry;
+   madt_parse_cpu(x2apic->LocalApicId, x2apic->LapicFlags);
+   break;
+   }
+}
+
+static void
+madt_setup_cpus_handler(ACPI_SUBTABLE_HEADER *entry, void *arg)
 {
ACPI_MADT_LOCAL_APIC *proc;
ACPI_MADT_LOCAL_X2APIC *x2apic;

Modified: head/sys/x86/acpica/srat.c
==
--- head/sys/x86/acpica/srat.c  Thu Aug 10 09:02:44 2017(r322346)
+++ head/sys/x86/acpica/srat.c  Thu Aug 10 09:15:18 2017(r322347)
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 
 #include 

Modified: head/sys/x86/include/x86_var.h
==
--- head/sys/x86/include/x86_var.h  Thu Aug 10 09:02:44 2017
(r322346)
+++ head/sys/x86/include/x86_var.h  Thu Aug 10 09:15:18 2017
(r322347)
@@ -78,6 +78,7 @@ externint _ufssel;
 extern int _ugssel;
 extern int use_xsave;
 extern uint64_t xsave_mask;
+extern u_int   max_apic_id;
 
 struct pcb;
 struct thread;

Modified: head/sys/x86/x86/local_apic.c
==
--- head/sys/x86/x86/local_apic.c   Thu Aug 10 09:02:44 2017
(r322346)
+++ head/sys/x86/x86/local_apic.c   Thu Aug 10 09:15:18 2017
(r322347)
@@ -184,6 +184,7 @@ static struct eventtimer lapic_et;
 #ifdef SMP
 static uint64_t lapic_ipi_wait_mult;
 #endif
+unsigned int max_apic_id;
 
 SYSCTL_NODE(_hw, OID_AUTO, apic, CTLFLAG_RD, 0, "APIC options");
 SYSCTL_INT(_hw_apic, OID_AUTO, x2apic_mode, CTLFLAG_RD, _mode, 0, "");

Modified: head/sys/x86/x86/mp_x86.c
==
--- head/sys/x86/x86/mp_x86.c   Thu Aug 10 09:02:44 2017(r322346)
+++ head/sys/x86/x86/mp_x86.c   Thu Aug 10 09:15:18 2017(r322347)
@@ -825,10 +825,6 @@ cpu_add(u_int apic_id, char boot_cpu)
boot_cpu_id = apic_id;
cpu_info[apic_id].cpu_bsp = 1;
}
-   if (mp_ncpus <