1. 13 Jul, 2018 1 commit
  2. 13 Apr, 2018 1 commit
    • kib's avatar
      i386 4/4G split. · e3089a03
      kib authored
      The change makes the user and kernel address spaces on i386
      independent, giving each almost the full 4G of usable virtual addresses
      except for one PDE at top used for trampoline and per-CPU trampoline
      stacks, and system structures that must be always mapped, namely IDT,
      GDT, common TSS and LDT, and process-private TSS and LDT if allocated.
      
      By using 1:1 mapping for the kernel text and data, it appeared
      possible to eliminate assembler part of the locore.S which bootstraps
      initial page table and KPTmap.  The code is rewritten in C and moved
      into the pmap_cold(). The comment in vmparam.h explains the KVA
      layout.
      
      There is no PCID mechanism available in protected mode, so each
      kernel/user switch forth and back completely flushes the TLB, except
      for the trampoline PTD region. The TLB invalidations for userspace
      becomes trivial, because IPI handlers switch page tables. On the other
      hand, context switches no longer need to reload %cr3.
      
      copyout(9) was rewritten to use vm_fault_quick_hold().  An issue for
      new copyout(9) is compatibility with wiring user buffers around sysctl
      handlers. This explains two kind of locks for copyout ptes and
      accounting of the vslock() calls.  The vm_fault_quick_hold() AKA slow
      path, is only tried after the 'fast path' failed, which temporary
      changes mapping to the userspace and copies the data to/from small
      per-cpu buffer in the trampoline.  If a page fault occurs during the
      copy, it is short-circuit by exception.s to not even reach C code.
      
      The change was motivated by the need to implement the Meltdown
      mitigation, but instead of KPTI the full split is done.  The i386
      architecture already shows the sizing problems, in particular, it is
      impossible to link clang and lld with debugging.  I expect that the
      issues due to the virtual address space limits would only exaggerate
      and the split gives more liveness to the platform.
      
      Tested by: pho
      Discussed with:	bde
      Sponsored by:	The FreeBSD Foundation
      MFC after:	1 month
      Differential revision:	https://reviews.freebsd.org/D14633
      e3089a03
  3. 27 Nov, 2017 1 commit
    • pfg's avatar
      sys/x86: further adoption of SPDX licensing ID tags. · 921a5b48
      pfg authored
      Mainly focus on files that use BSD 2-Clause license, however the tool I
      was using misidentified many licenses so this was mostly a manual - error
      prone - task.
      
      The Software Package Data Exchange (SPDX) group provides a specification
      to make it easier for automated tools to detect and summarize well known
      opensource licenses. We are gradually adopting the specification, noting
      that the tags are considered only advisory and do not, in any way,
      superceed or replace the license texts.
      921a5b48
  4. 10 Aug, 2017 3 commits
    • royger's avatar
      mptable: fix i386 build failure · 89ad37fb
      royger authored
      Reported by:	emaste
      X-MFC-with:	r322347
      89ad37fb
    • royger's avatar
      x86: bump MAX_APIC_ID to 512 · 55936e52
      royger authored
      Introduce a new define to take int account the xAPIC ID limit, for
      systems where x2APIC is not available/reliable.
      
      Also change some of the usages of the APIC ID to use an unsigned int
      (which is the correct storage type to deal with x2APIC IDs as found in
      x2APIC MADT entries).
      
      This allows booting FreeBSD on a box with 256 CPUs and APIC IDs up to
      295:
      
      FreeBSD/SMP: Multiprocessor System Detected: 256 CPUs
      FreeBSD/SMP: 1 package(s) x 64 core(s) x 4 hardware threads
      Package HW ID = 0
      	Core HW ID = 0
      		CPU0 (BSP): APIC ID: 0
      		CPU1 (AP/HT): APIC ID: 1
      		CPU2 (AP/HT): APIC ID: 2
      		CPU3 (AP/HT): APIC ID: 3
      [...]
      	Core HW ID = 73
      		CPU252 (AP): APIC ID: 292
      		CPU253 (AP/HT): APIC ID: 293
      		CPU254 (AP/HT): APIC ID: 294
      		CPU255 (AP/HT): APIC ID: 295
      
      Submitted by:		kib (previous version)
      Relnotes:		yes
      MFC after:		1 month
      Reviewed by:		kib
      Differential revision:	https://reviews.freebsd.org/D11913
      55936e52
    • royger's avatar
      apic_enumerator: only set mp_ncpus and mp_maxid at probe cpus phase · 345fb326
      royger authored
      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&D
      MFC after:		1 month
      Reviewed by:		kib
      Differential revision:	https://reviews.freebsd.org/D11911
      345fb326
  5. 28 Jan, 2017 1 commit
  6. 15 Jan, 2017 1 commit
  7. 27 May, 2016 1 commit
  8. 21 Feb, 2014 1 commit
  9. 27 Dec, 2013 1 commit
  10. 11 Dec, 2013 1 commit
  11. 09 Dec, 2013 1 commit
  12. 16 Jul, 2011 1 commit
  13. 15 Jul, 2011 1 commit
    • jhb's avatar
      Respect the BIOS/firmware's notion of acceptable address ranges for PCI · b75d5a0e
      jhb authored
      resource allocation on x86 platforms:
      - Add a new helper API that Host-PCI bridge drivers can use to restrict
        resource allocation requests to a set of address ranges for different
        resource types.
      - For the ACPI Host-PCI bridge driver, use Producer address range resources
        in _CRS to enumerate valid address ranges for a given Host-PCI bridge.
        This can be disabled by including "hostres" in the debug.acpi.disabled
        tunable.
      - For the MPTable Host-PCI bridge driver, use entries in the extended
        MPTable to determine the valid address ranges for a given Host-PCI
        bridge.  This required adding code to parse extended table entries.
      
      Similar to the new PCI-PCI bridge driver, these changes are only enabled
      if the NEW_PCIB kernel option is enabled (which is enabled by default on
      amd64 and i386).
      
      Approved by:	re (kib)
      b75d5a0e
  14. 09 Nov, 2010 1 commit
  15. 08 Nov, 2010 1 commit
    • jhb's avatar
      Sync the APIC startup sequence with amd64: · bfc0fcbf
      jhb authored
      - Register APIC enumerators at SI_SUB_TUNABLES - 1 instead of SI_SUB_CPU - 1.
      - Probe CPUs at SI_SUB_TUNABLES - 1.  This allows i386 to set a truly
        accurate mp_maxid value rather than always setting it to MAXCPU - 1.
      bfc0fcbf
  16. 01 Nov, 2010 1 commit
  17. 28 Oct, 2010 1 commit
  18. 19 Oct, 2010 1 commit
  19. 19 Mar, 2010 1 commit
  20. 22 Nov, 2008 1 commit
  21. 19 Oct, 2008 1 commit
  22. 22 Jul, 2008 1 commit
    • rwatson's avatar
      Merge r177253, r177255 from head to stable/7: · 97ddbbd5
      rwatson authored
        In keeping with style(9)'s recommendations on macros, use a ';'
        after each SYSINIT() macro invocation.  This makes a number of
        lightweight C parsers much happier with the FreeBSD kernel
        source, including cflow's prcc and lxr.
      
        Discussed with: imp, rink
      
      The requirement to place a ; after each SYSINIT definition has not been
      MFC'd, as this might break the compile third-party modules, but merging
      the actual ; additions reduces diffs against 8.x making it easier to
      merge other changes.
      97ddbbd5
  23. 16 Mar, 2008 1 commit
  24. 05 Oct, 2007 1 commit
  25. 08 May, 2007 1 commit
    • jhb's avatar
      Handle CPUs with APIC IDs higher than 32 (at least one IBM server uses · 255387b6
      jhb authored
      an APIC ID of 38 for its second CPU):
      - Add a new MAX_APIC_ID constant for the highest valid APIC ID for modern
        systems.
      - Size the various arrays in the MADT, MP Table, and SMP code that are
        indexed by APIC IDs to allow for up to MAX_APIC_ID.
      - Explicitly go through and assign logical cpu ids to local APICs before
        starting any of the APs up rather than doing it while starting up the
        APs.  This step is now where we honor MAXCPU.
      
      MFC after:	1 week
      255387b6
  26. 09 Mar, 2007 1 commit
  27. 05 Mar, 2007 1 commit
  28. 31 Oct, 2005 1 commit
    • rwatson's avatar
      Normalize a significant number of kernel malloc type names: · be4f3571
      rwatson authored
      - Prefer '_' to ' ', as it results in more easily parsed results in
        memory monitoring tools such as vmstat.
      
      - Remove punctuation that is incompatible with using memory type names
        as file names, such as '/' characters.
      
      - Disambiguate some collisions by adding subsystem prefixes to some
        memory types.
      
      - Generally prefer lower case to upper case.
      
      - If the same type is defined in multiple architecture directories,
        attempt to use the same name in additional cases.
      
      Not all instances were caught in this change, so more work is required to
      finish this conversion.  Similar changes are required for UMA zone names.
      be4f3571
  29. 14 Apr, 2005 1 commit
  30. 10 Feb, 2005 1 commit
  31. 18 Jan, 2005 1 commit
    • jhb's avatar
      If a valid ELCR was found, consult it for the trigger mode of ISA · eb5749cd
      jhb authored
      interrupts that have a trigger mode of conforming.  This fixes problems on
      some older machines that still route PCI devices via ISA interrupts when
      using an I/O APIC.
      
      Tested by:	Peter Trifonov pvtrifonov at mail dot ru
      MFC after:	1 month
      eb5749cd
  32. 12 Jan, 2005 1 commit
    • jhb's avatar
      Try harder to work with MP table interrupt entries that claim that an · 2411c5a7
      jhb authored
      interrupt is wired up to all the I/O APICs in the system.  If the system
      has only one I/O APIC, then just act as if the entry specified that APIC.
      We still don't try to handle global entries in a system with multiple I/O
      APICs.
      
      Tested by:	Peter Trifonov pvtrifonov at mail dot ru
      MFC after:	1 week
      2411c5a7
  33. 07 Jan, 2005 1 commit
    • jhb's avatar
      Fix support for machines with default MP Table configurations: · 0e5c952f
      jhb authored
      - Fix the MP Table pci bridge drivers to not probe the configuration table
        unless we actually have one.  Machines using a default configuration do
        not have such a table.
      - Only allow default configuration types of 5 (ISA + PCI) and 6 (EISA +
        PCI) as the others are not likely to work.  Types 1 through 4 use an
        external APIC (probably with 80486 processors) which we certainly do not
        support, and type 7 uses an MCA bus which has not been tested with the
        new MP Table code.
      - Correct the fact that the single I/O APIC in a default configuration has
        an ID of 2, not 0.
      - Fix off by one errors in setting the bus types from the default_data[]
        arrays for default configurations.
      - Explicitly configure each of the 16 interrupt pins on the sole I/O APIC
        when using a default configuration.  This is especially helpful for type
        6 (EISA + PCI) since the EISA interrupts need to have their polarity
        programmed based on the values in the ELCR.
      
      Much thanks to the submitter and tester who endured several rounds of
      testing to get this fixed.
      
      MFC after:	1 week
      Tested by:	Georg Schwarz georg dot schwarz at freenet dot de
      0e5c952f
  34. 24 Sep, 2004 1 commit
  35. 01 Jul, 2004 1 commit
  36. 23 Jun, 2004 1 commit
    • jhb's avatar
      Various cleanups in support of a future ioapic_config_intr() function: · 22d8e1a7
      jhb authored
      - Allow ioapic_set_{nmi,smi,extint}() to be called multiple times on the
        same pin so long as the pin's mode is the same as the mode being
        requested.
      - Add a notion of bus type for the interrupt associated with interrupt pin.
        This is needed so that we can force all EISA interrupts to be active high
        in the forthcoming ioapic_config_intr().
      - Fix a bug for EISA systems that didn't remap IRQs.  This would have broken
        EISA systems that tried to disable mixed mode for IRQ 0.
      22d8e1a7
  37. 24 May, 2004 1 commit
    • jhb's avatar
      Revert part of rev 1.230 and assume that all EISA IRQs use active high · c6ce1616
      jhb authored
      polarity rather than assuming that level triggered IRQs use active low and
      edge triggered IRQs use active high.  Both the MultiProcessor 1.4
      and ACPI 2.0 Specifications state in their examples that level triggered
      EISA IRQs are active low, but in practice they seem to be active high.
      
      Reported by:	Nik Azim Azam nskyline_r35 at yahoo dot com
      c6ce1616
  38. 10 May, 2004 1 commit
    • jhb's avatar
      Rework the APIC mixed mode support a bit: · 3564a344
      jhb authored
      - Require the APIC enumerators to explicitly enable mixed mode by calling
        ioapic_enable_mixed_mode().  Calling this function tells the apic driver
        that the PC-AT 8259A PICs are present and routable through the first I/O
        APIC via an ExtINT pin.  The mptable enumerator always calls this
        function for now.  The MADT enumerator only enables mixed mode if the
        PC-AT compatability flag is set in the MADT header.
      - Allow mixed mode to be enabled or disabled via a 'hw.apic.mixed_mode'
        tunable.  By default this tunable is set to 1 (true).  The kernel option
        NO_MIXED_MODE changes the default to 0 to preserve existing behavior, but
        adding 'hw.apic.mixed_mode=0' to loader.conf achieves the same effect.
      - Only use mixed mode to route IRQ 0 if it is both enabled by the APIC
        enumerator and activated by the loader tunable.  Note that both
        conditions must be true, so if the APIC enumerator does not enable mixed
        mode, then you can't set the tunable to try to override the enumerator.
      3564a344