dragonfly.git
8 years ago<stdio.h>/<wchar.h>: Reduce namespace pollution in <wchar.h>.
Sascha Wildner [Wed, 4 May 2016 21:04:48 +0000 (23:04 +0200)]
<stdio.h>/<wchar.h>: Reduce namespace pollution in <wchar.h>.

Instead of including the whole of <stdio.h> in <wchar.h>, just define
FILE there too, which is all it needs.

Based on FreeBSD's similar definitions.

8 years agodrm/radeon: Add missing new bonaire pci id
zrj [Wed, 4 May 2016 07:15:03 +0000 (10:15 +0300)]
drm/radeon: Add missing new bonaire pci id

Tested-on: Gigabyte R7 360 (rev 2.0) card

8 years agoLocal adjustments for OpenSSL 1.0.1t.
Sascha Wildner [Tue, 3 May 2016 19:57:45 +0000 (21:57 +0200)]
Local adjustments for OpenSSL 1.0.1t.

8 years agoMerge branch 'vendor/OPENSSL'
Sascha Wildner [Tue, 3 May 2016 19:53:00 +0000 (21:53 +0200)]
Merge branch 'vendor/OPENSSL'

8 years agoImport OpenSSL 1.0.1t.
Sascha Wildner [Tue, 3 May 2016 19:47:42 +0000 (21:47 +0200)]
Import OpenSSL 1.0.1t.

* Fix CVE-2016-2107, CVE-2016-2105, CVE-2016-2106, CVE-2016-2109,
  CVE-2016-2176, CVE-2016-0702

For a more detailed list of changes, see crypto/openssl/CHANGES.

8 years agoRevert "kqueue: Avoid reprocessing processed knotes in KNOTE."
Sepherosa Ziehau [Tue, 3 May 2016 12:29:11 +0000 (20:29 +0800)]
Revert "kqueue: Avoid reprocessing processed knotes in KNOTE."

This reverts commit ed9db6a1912db34af387ff6978a265003258df16.

This cause panic under certain network load.

Reported-by: pavalos@
8 years agoRevert "kqueue: Return value of knote_release is no longer useful."
Sepherosa Ziehau [Tue, 3 May 2016 12:27:50 +0000 (20:27 +0800)]
Revert "kqueue: Return value of knote_release is no longer useful."

This reverts commit b75b5648541ea38deaf678ee62466780ffe62374.

Prepare to revert ed9db6a1912db34af387ff6978a265003258df16, which causes
panic under certain network load.

Reported-by: pavalos@
8 years agodrm/linux: Add linux/pwm.h
François Tigeot [Sun, 3 Apr 2016 11:46:08 +0000 (13:46 +0200)]
drm/linux: Add linux/pwm.h

8 years agodrm/linux: Add linux/gpio/consumer.h
François Tigeot [Tue, 3 May 2016 11:31:21 +0000 (13:31 +0200)]
drm/linux: Add linux/gpio/consumer.h

8 years agodrm/linux: Define U64_MAX
François Tigeot [Tue, 3 May 2016 11:13:03 +0000 (13:13 +0200)]
drm/linux: Define U64_MAX

8 years agodrm/linux: Add __test_and_clear_bit
François Tigeot [Tue, 3 May 2016 09:28:37 +0000 (11:28 +0200)]
drm/linux: Add __test_and_clear_bit

Obtained-from: NetBSD

8 years agogpio_intel: Slightly simplify interface to chipset-specific code.
Imre Vadász [Sun, 1 May 2016 15:10:45 +0000 (17:10 +0200)]
gpio_intel: Slightly simplify interface to chipset-specific code.

* The intidx value in struct pin_intr_map is slightly redundant at the
  moment, but it avoids needless lookups for now.

8 years agogpio_intel: Use a cookie object for gpio interrupt allocation as well.
Imre Vadász [Sat, 30 Apr 2016 20:07:57 +0000 (22:07 +0200)]
gpio_intel: Use a cookie object for gpio interrupt allocation as well.

* This tries to improve the gpio_if.m api, e.g. only the interrupt pin
  allocation can legitimately fail. The interrupt setup and teardown
  functions can't really fail for proper input values (and for bogus
  arguments it can just panic).

8 years agosys/dev/disk/dm: Remove read/write support for /dev/mapper/control
Tomohiro Kusumi [Sun, 1 May 2016 00:12:10 +0000 (09:12 +0900)]
sys/dev/disk/dm: Remove read/write support for /dev/mapper/control

It's obvious that /dev/mapper/control has nothing to read/write.
Running below results in kernel panic as the code requires properly
initialized a per-table lock while this chrdev has no tables mapped.
(control chrdev and dm blkdevs use the same dm device structures)

-----
 [root@]~# cat ./dm1.c
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <fcntl.h>
 int main(void)
 {
         int fd;
         char buf[1024];
         fd = open("/dev/mapper/control", O_RDWR);
         if (fd == -1) {
                 perror("open");
                 exit(1);
         }
         if (read(fd, buf, sizeof(buf)) == -1)
                 perror("read");
         if (write(fd, buf, sizeof(buf)) == -1)
                 perror("write");
         close(fd);
         return 0;
 }

With this commit.
-----
 [root@]~# uname
 DragonFly
 [root@]~# kldload dm
 [root@]~# ls -l /dev/mapper/control
 crw-r-----  1 root  operator   65, 0x00000000 May  1 09:25 /dev/mapper/control
 [root@]~# gcc -Wall -g ./dm1.c -o ./dm1
 [root@]~# ./dm1
 read: Operation not supported by device
 write: Operation not supported by device

With Linux kernel.
-----
 [root@localhost]~# uname
 Linux
 [root@localhost]~# ls -l /dev/mapper/control
 crw-rw---- 1 root root 10, 236 Apr 25 12:44 /dev/mapper/control
 [root@localhost]~# gcc -Wall -g ./dm1.c -o ./dm1
 [root@localhost]~# ./dm1
 read: Invalid argument
 write: Invalid argument

8 years agogpio_acpi: Introduce separate setup_intr and teardown_intr functions.
Imre Vadász [Fri, 29 Apr 2016 20:32:09 +0000 (22:32 +0200)]
gpio_acpi: Introduce separate setup_intr and teardown_intr functions.

* This allows us to actually reserve the gpio pin before, and separately
  from actually setting up the interrupt handler.

* XXX This interface is still a bit inconvenient to use, because the
  code allows gpio_setup_intr to fail. Instead the gpio_alloc_intr
  function should be returning a cookie to use for gpio_setup_intr
  (which could obviously never fail then).

8 years agolibstand: Fix -Wstrict-prototypes warning.
Sascha Wildner [Fri, 29 Apr 2016 14:02:44 +0000 (16:02 +0200)]
libstand: Fix -Wstrict-prototypes warning.

8 years agosys/boot: Fix a prototype (pointed out by zrj).
Sascha Wildner [Fri, 29 Apr 2016 12:05:07 +0000 (14:05 +0200)]
sys/boot: Fix a prototype (pointed out by zrj).

8 years agosys/boot: Ansify the remaining cases found by -Wold-style-definition.
Sascha Wildner [Fri, 29 Apr 2016 08:42:56 +0000 (10:42 +0200)]
sys/boot: Ansify the remaining cases found by -Wold-style-definition.

8 years agoboot/common: Clean up, ansify some functions, remove unneeded statements.
Imre Vadász [Thu, 28 Apr 2016 20:54:08 +0000 (22:54 +0200)]
boot/common: Clean up, ansify some functions, remove unneeded statements.

* No functional changes.

* Change some int variables into size_t in boot/common/module.c.

* Use MAX macro.

8 years agodrm/radeon: Retire old UMS driver.
zrj [Thu, 28 Apr 2016 16:29:22 +0000 (19:29 +0300)]
drm/radeon: Retire old UMS driver.

Cleanup before next, removed upstream.

8 years agotcp: Count connections by TCP state
Sepherosa Ziehau [Thu, 28 Apr 2016 14:37:58 +0000 (22:37 +0800)]
tcp: Count connections by TCP state

Inspired-by: FreeBSD 'netstat -s -p tcp' output
8 years agoUse size_t to remove casts.
zrj [Thu, 28 Apr 2016 13:09:18 +0000 (16:09 +0300)]
Use size_t to remove casts.

While there, perform some style(9) fixes.

No functional change.

8 years agoexamples: Add binary firmware wrapping reference script.
zrj [Tue, 26 Apr 2016 14:30:32 +0000 (17:30 +0300)]
examples: Add binary firmware wrapping reference script.

Mainly to keep base with dports synchronized.
Also could be used while developing drivers to quickly make
firmware modules for testing.

8 years agoboot/loader: Handle the /boot/modules.local
zrj [Tue, 26 Apr 2016 14:28:27 +0000 (17:28 +0300)]
boot/loader: Handle the /boot/modules.local

Weather /boot/modules.local is used during boot or by kldload(8)
is controlled by a new "local_modules" loader variable.

If local_modules is set to "YES", /boot/modules.local is also
appended to kern.module_path sysctl variable for use by kldload(8).
Setting variable to any other value disables that.

By default allow modules to searched in /boot/modules.local directory
since it does not shadow the default kernel modules and has lower
directory search priority.

8 years agomtree: Create /boot/modules.local
zrj [Tue, 26 Apr 2016 13:53:23 +0000 (16:53 +0300)]
mtree: Create /boot/modules.local

Intended for external modules and firmware e.g. from dports or for
user driver testing to keep base system clean during development.

This directory does not get affected when upgrading base system.

8 years agosys/kern: Add comment on unmounting
Tomohiro Kusumi [Thu, 28 Apr 2016 04:34:00 +0000 (13:34 +0900)]
sys/kern: Add comment on unmounting

8 years agoahci: Add and use AHCI_PREG_SCTL_IPM_NODEVSLP definition from ahci-1.3.1.
Imre Vadász [Sat, 23 Apr 2016 11:23:14 +0000 (13:23 +0200)]
ahci: Add and use AHCI_PREG_SCTL_IPM_NODEVSLP definition from ahci-1.3.1.

* The DevSleep interface power saving state was introduced with the
  ahci-1.3.1 specification. However actual DevSleep support needs to be
  recognized via the AHCI_REG_CAP2_SDS bit, since many controllers
  identifying as ahci-1.3 already support DevSleep.

* Since the correct bitmask to use in the AHCI_PREG_SCTL_IPM field
  for disabling all power-management features depends on DevSleep support,
  store that precomputed value in sc->sc_ipm_disable.

* Make some operations on the AHCI_PREG_SCTL_IPM_* bitfield a bit clearer.

* While there add AHCI_PREG_CMD_ICC_DEVSLEEP definition.

8 years agotcp: No need to return tcpcb from tcp_newtcpcb()
Sepherosa Ziehau [Wed, 27 Apr 2016 12:54:34 +0000 (20:54 +0800)]
tcp: No need to return tcpcb from tcp_newtcpcb()

8 years agotcp: Remove redundant tcpcb state setting
Sepherosa Ziehau [Wed, 27 Apr 2016 12:49:50 +0000 (20:49 +0800)]
tcp: Remove redundant tcpcb state setting

8 years agodhclient: Log a warning instead of bailing upon "illegal" options
Sepherosa Ziehau [Wed, 27 Apr 2016 12:41:20 +0000 (20:41 +0800)]
dhclient: Log a warning instead of bailing upon "illegal" options

Obtained-from: FreeBSD  r298385

8 years agoSync zoneinfo database with tzdata2016d from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Tue, 26 Apr 2016 17:28:52 +0000 (19:28 +0200)]
Sync zoneinfo database with tzdata2016d from ftp://ftp.iana.org/tz/releases

* America/Caracas switches from -0430 to -04 on 2016-05-01 at 02:30.
    (Thanks to Alexander Krivenyshev for the heads-up.)

* Asia/Magadan switched from +10 to +11 on 2016-04-24 at 02:00.
    (Thanks to Alexander Krivenyshev and Matt Johnson.)

* New zone Asia/Tomsk, split off from Asia/Novosibirsk.  It covers
    Tomsk Oblast, Russia, which switches from +06 to +07 on 2016-05-29
    at 02:00.  (Thanks to Stepan Golosunov.)

* New zone Europe/Kirov, split off from Europe/Volgograd.  It covers
    Kirov Oblast, Russia, which switched from +04/+05 to +03/+04 on
    1989-03-26 at 02:00, roughly a year after Europe/Volgograd made
    the same change.  (Thanks to Stepan Golosunov.)

* Russia and nearby locations had daylight-saving transitions on
    1992-03-29 at 02:00 and 1992-09-27 at 03:00, instead of on
    1992-03-28 at 23:00 and 1992-09-26 at 23:00.  (Thanks to Stepan
    Golosunov.)

* Many corrections to historical time in Kazakhstan from 1991
    through 2005.  (Thanks to Stepan Golosunov.)  Replace Kazakhstan's
    invented time zone abbreviations with numeric abbreviations.

* Mention Internet RFCs 7808 (TZDIST) and 7809 (CalDAV time zone references).

8 years agoigb: Fix MSI-X allocation when # of rings is less than # of cpus
Sepherosa Ziehau [Tue, 26 Apr 2016 12:57:42 +0000 (20:57 +0800)]
igb: Fix MSI-X allocation when # of rings is less than # of cpus

Dragonfly-bug: http://bugs.dragonflybsd.org/issues/2902

8 years agohier.7: Add missing /etc/devd entry.
zrj [Tue, 26 Apr 2016 06:24:28 +0000 (09:24 +0300)]
hier.7: Add missing /etc/devd entry.

There is also empty /etc/X11 /etc/skell in BSD.root.dist
and documented /pfs/ not in BSD.root.dist

8 years agomtree: Move pam.d to correct dirname order.
zrj [Fri, 22 Apr 2016 14:52:09 +0000 (17:52 +0300)]
mtree: Move pam.d to correct dirname order.

Reduces diffs when comparing with BSD.X.new

8 years agodrm/i915: Remove a duplicated assignment
François Tigeot [Mon, 25 Apr 2016 08:55:01 +0000 (10:55 +0200)]
drm/i915: Remove a duplicated assignment

Noticed-by: davshao, issue #2903
8 years agoSync ACPICA with Intel's version 20160422.
Sascha Wildner [Sun, 24 Apr 2016 22:18:12 +0000 (00:18 +0200)]
Sync ACPICA with Intel's version 20160422.

* Fixed AcpiHwRead/AcpiHwWrite regression from 20160318. It was
  insufficiently worked around by me in 3b9bfd22b87e14, but was
  still causing issues with qemu (as reported by zrj).

* Support for I2cSerialBusV2, SpiSerialBusV2 and UartSerialBusV2.
  The original non-V2 names are deprecated. V2 macros have one
  new argument.

* Support for new integer field in _BIX's returned package object.

* New PCCT subtable (HW-Reduced Comm Subspace Type2).

* Various improvements to iASL.

For a more detailed list, please see sys/contrib/dev/acpica/changes.txt.

Tested-by: ivadasz, zrj
8 years agosys/vfs/tmpfs: Remove unused mount variables
Tomohiro Kusumi [Sun, 24 Apr 2016 19:39:56 +0000 (04:39 +0900)]
sys/vfs/tmpfs: Remove unused mount variables

8 years agodrm/i915/gem: Switch to the Linux scatterlist API
François Tigeot [Sat, 23 Apr 2016 19:14:27 +0000 (21:14 +0200)]
drm/i915/gem: Switch to the Linux scatterlist API

* We were previously using regular arrays of pointers to vm pages

* This change tremendously reduces differences with the Linux code
  and will make future evolutions of this driver easier to implement

* Remove some unused i915 agp functions while I'm here

8 years agokernel - Reduce BSS size (3)
Matthew Dillon [Sat, 23 Apr 2016 18:36:58 +0000 (11:36 -0700)]
kernel - Reduce BSS size (3)

* Fix ordering issue in emergency interrupt thread management.  These
  routines may be called before objcache is operational, so we have to
  kmalloc() the thread structure manually.

Reported-by: jh32
8 years agokernel - Enhance the examine (x) command.
Matthew Dillon [Sat, 23 Apr 2016 16:39:02 +0000 (09:39 -0700)]
kernel - Enhance the examine (x) command.

* Change x/a to work similar to gdb.  The content of the memory is
  treated as an address, printed symbolically and the address is advanced.
  This way you can x/a <stack_address> and then just hit return a bunch
  of times to locate useful data on the stack.

* Add x/p.  The content of the memory is treated as an address and
  printed as hex.

8 years agokernel - Reduce BSS size (2)
Matthew Dillon [Sat, 23 Apr 2016 05:08:43 +0000 (22:08 -0700)]
kernel - Reduce BSS size (2)

* Fix a bunch of other places in the kernel where large BSS arrays are
  declared.  Reduces the kernel image by another ~2MB or so on top of
  the ~6MB saved in the last commit.

* Primarily these are places where a 'struct thread' is being embedded
  in a structure which is being declared [MAXCPU].  With MAXCPU at 256
  the result is pretty bloated.  Changing the embedded thread to a
  thread pointer removes most of the bloat.

8 years agokernel - Reduce BSS size to fix loader initrd problem
Charlie Root [Sat, 23 Apr 2016 03:33:37 +0000 (20:33 -0700)]
kernel - Reduce BSS size to fix loader initrd problem

* kernel + modules + initrd.img (unpacked) exceeded the 63MB the loader has
  available for load-time data.

* Top hogs are mainly in BSS.  Make intr_info_ary and pcpu_sysctl
  kmalloc after boot instead of BSS as a temporary fix.

    335872  ifnet_threads
    335872  netisr_cpu
    339968  dummy_pcpu
    344064  bsd4_pcpu
    344064  stoppcbs
    346112  softclock_pcpu_ary
    538624  cpu_topology_nodes
    755712  dfly_pcpu
    786432  icu_irqmaps
    958464  map_entry_init
    1048576 idt_arr
    1064960 pcpu_sysctl <---- now kmallocd
    1179648 ioapic_irqmaps <---- (used too early, cannot be kmallocd)
    5242880 intr_info_ary <---- now kmallocd

* Should fix loader issues when trying to use initrd.img[.gz] for now.

Reported-by: Valheru
8 years agoahci: Add some DevSleep defintions. Recognize DevSleep link state.
Imre Vadász [Sun, 2 Aug 2015 10:30:28 +0000 (12:30 +0200)]
ahci: Add some DevSleep defintions. Recognize DevSleep link state.

* Add the AHCI_PREG_SSTS_IPM_DEVSLEEP definition, and recognize
  the DevSleep power-state via the dev.ahci.X.Y.link_pwr_state sysctl.

* Use AHCI_PREG_SSTS_* definitions in ahci_port_link_pwr_state(), instead
  of SATA_PM_SSTS_* ones.

* Add CAP2 bits for DevSleep.

* Add DEVSLP register definitions.

8 years agoahci: Clean up SET_FEATURES definitions. Add some power-mgmt definitions.
Imre Vadász [Fri, 22 Apr 2016 18:18:30 +0000 (20:18 +0200)]
ahci: Clean up SET_FEATURES definitions. Add some power-mgmt definitions.

* The ATA_C_SATA_FEATURE_ENA and ATA_C_SATA_FEATURE_DIS definitions aren't
  ata commands themselves, they are subcommands of ATA_C_SET_FEATURES.

* Add definitions for device-initiated power-management and for the
  devsleep power-state (which isn't supported in DragonFly yet).

8 years agokernel/linux: Move M_DRM definition to kern_slaballoc.c
François Tigeot [Fri, 22 Apr 2016 09:17:20 +0000 (11:17 +0200)]
kernel/linux: Move M_DRM definition to kern_slaballoc.c

Making it available to more than the drm subsystem

8 years agodrm/radeon: Add explicit dependency to the acpi module
François Tigeot [Fri, 22 Apr 2016 08:50:07 +0000 (10:50 +0200)]
drm/radeon: Add explicit dependency to the acpi module

Suggested-by: zrj
8 years agodrm/i915: Add explicit dependency to the acpi module
François Tigeot [Fri, 22 Apr 2016 08:48:38 +0000 (10:48 +0200)]
drm/i915: Add explicit dependency to the acpi module

Suggested-by: zrj
8 years agogpt: Align partitions to 1MiB
François Tigeot [Wed, 20 Apr 2016 05:15:51 +0000 (07:15 +0200)]
gpt: Align partitions to 1MiB

Submitted-by: pascii, bug report #2830
8 years agoefi/boot1: Fix best text mode detection.
zrj [Tue, 19 Apr 2016 11:14:09 +0000 (14:14 +0300)]
efi/boot1: Fix best text mode detection.

According to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL QueryMode() specs
Mode 0 is 80x25 and Mode 1 is 80x50, rest of device supported
modes follow as modes 2 and above. In case when device does not
support Mode 1, querying for it will return EFI_UNSUPPORTED.

Tested-on: Toshiba laptop w/o Mode 1 support.

8 years agosys/kern: Fix mountctl options list
Tomohiro Kusumi [Mon, 18 Apr 2016 19:15:26 +0000 (04:15 +0900)]
sys/kern: Fix mountctl options list

Add some minor mount flags that are missing in vfs_flagstostr().
MNT_IGNORE should be ignored since the purpose of this flag is to ignore.

8 years agosys/boot/efi/loader: Make module autoloading work as in pc32/loader.
Imre Vadász [Mon, 18 Apr 2016 19:09:23 +0000 (21:09 +0200)]
sys/boot/efi/loader: Make module autoloading work as in pc32/loader.

* For now keep sys/boot/efi/loader/autoload.c around, but we just
  use i386_module() from sys/boot/pc32/libi386/i386_module.c.

8 years agosbin/hammer: Use printf() instead of fprintf(stdout)
Tomohiro Kusumi [Mon, 18 Apr 2016 10:01:29 +0000 (19:01 +0900)]
sbin/hammer: Use printf() instead of fprintf(stdout)

Follow sbin/hammer's coding style (as well as C in general).

 # grep "fprintf(stdout" sbin/hammer -riI
 sbin/hammer/cmd_info.c:                                         fprintf(stdout, "\n");
 sbin/hammer/cmd_info.c:                         fprintf(stdout, "No mounted HAMMER filesystems found\n");
 sbin/hammer/cmd_info.c:                 fprintf(stdout, "No mounted filesystems found\n");
 sbin/hammer/cmd_info.c: fprintf(stdout, "Volume identification\n");
 sbin/hammer/cmd_info.c: fprintf(stdout, "\tLabel               %s\n", fip->vol_name);
 sbin/hammer/cmd_info.c: fprintf(stdout, "\tNo. Volumes         %d\n", fip->nvolumes);
 sbin/hammer/cmd_info.c: fprintf(stdout, "\tHAMMER Volumes      ");
 sbin/hammer/cmd_info.c: fprintf(stdout, "\tRoot Volume         %s\n", rootvol);
 sbin/hammer/cmd_info.c: fprintf(stdout, "\tFSID                %s\n", fsid);
 sbin/hammer/cmd_info.c: fprintf(stdout, "\tHAMMER Version      %d\n", fip->version);
 sbin/hammer/cmd_info.c: fprintf(stdout, "Big-block information\n");
 sbin/hammer/cmd_info.c: fprintf(stdout, "\tTotal      %10jd\n", (intmax_t)fip->bigblocks);
 sbin/hammer/cmd_info.c: fprintf(stdout, "\tUsed       %10jd (%.2lf%%)\n"
 sbin/hammer/cmd_info.c: fprintf(stdout, "Space information\n");
 sbin/hammer/cmd_info.c: fprintf(stdout, "\tNo. Inodes %10jd\n", (intmax_t)fip->inodes);
 sbin/hammer/cmd_info.c: fprintf(stdout, "\tTotal size     %6s (%jd bytes)\n",
 sbin/hammer/cmd_info.c: fprintf(stdout, "\tUsed           %6s (%.2lf%%)\n", buf,
 sbin/hammer/cmd_info.c: fprintf(stdout, "\tReserved       %6s (%.2lf%%)\n", buf,
 sbin/hammer/cmd_info.c: fprintf(stdout, "\tFree           %6s (%.2lf%%)\n", buf,
 sbin/hammer/cmd_info.c: fprintf(stdout, "PFS information\n");
 sbin/hammer/cmd_info.c: fprintf(stdout, "\tPFS ID  Mode    Snaps  Mounted on\n");
 sbin/hammer/cmd_info.c:         fprintf(stdout, "\t%6d  %-6s",
 sbin/hammer/cmd_info.c:         fprintf(stdout, " %6s  ", (pi->head.error && pi->snapcount == 0) ? "-" : buf);
 sbin/hammer/cmd_info.c:                 fprintf(stdout, "%s", pi->mountedon);
 sbin/hammer/cmd_info.c:                 fprintf(stdout, "not mounted");
 sbin/hammer/cmd_info.c:         fprintf(stdout, "\n");

8 years agosbin/hammer: Add no hammer found message if not mounted
Tomohiro Kusumi [Mon, 18 Apr 2016 09:57:10 +0000 (18:57 +0900)]
sbin/hammer: Add no hammer found message if not mounted

The local variable 'first' being non-zero after the loop means
none of them were hammer.

8 years agosbin/mount_hammer: Remove duplicated MOPT_UPDATE macro definition
Tomohiro Kusumi [Sun, 17 Apr 2016 18:09:08 +0000 (03:09 +0900)]
sbin/mount_hammer: Remove duplicated MOPT_UPDATE macro definition

include/mntopts.h has this for getmntopts(3).

mount_dirfs(8) has this too probably because it's been copy-pasted
from mount_hammer(8) though this commit doesn't touch that.
(the one in mount_devfs(8) is if0'd)

 # grep MOPT_UPDATE . -riI | grep define
 ./contrib/smbfs/mount_smbfs/mntopts.h:#define MOPT_UPDATE               { "update",     0, MNT_UPDATE, 0 }
 ./include/mntopts.h:#define MOPT_UPDATE         { "update",     0, MNT_UPDATE, 0 }
 ./sbin/mount_devfs/mount_devfs.c:#define MOPT_UPDATE         { "update",     0, MNT_UPDATE, 0 }
 ./sbin/mount_dirfs/mount_dirfs.c:#define MOPT_UPDATE         { "update",     0, MNT_UPDATE, 0 }
 ./sbin/mount_hammer/mount_hammer.c:#define MOPT_UPDATE         { "update",     0, MNT_UPDATE, 0 }

8 years agoefi/loader: Increase default staging area to 96MB. Retry with half of that.
Imre Vadász [Sun, 21 Feb 2016 10:21:05 +0000 (11:21 +0100)]
efi/loader: Increase default staging area to 96MB. Retry with half of that.

* The default 48MB area is too small for loading additional kernel modules
  beyond just acpi.ko, ehci.ko and xhci.ko.

* The 96MB allocation fails in qemu with 128MB memory configured.

8 years agodrm/i915/gem: Update i915_gem_fault()
François Tigeot [Sun, 17 Apr 2016 14:22:17 +0000 (16:22 +0200)]
drm/i915/gem: Update i915_gem_fault()

Reducing differences with Linux 4.2

8 years agodrm/linux: Add dma_map_sg and dma_unmap_sg()
François Tigeot [Sun, 17 Apr 2016 13:37:53 +0000 (15:37 +0200)]
drm/linux: Add dma_map_sg and dma_unmap_sg()

8 years agodrm/i915: Import two fixes from Linux 4.2.8
François Tigeot [Sun, 17 Apr 2016 12:40:42 +0000 (14:40 +0200)]
drm/i915: Import two fixes from Linux 4.2.8

* Always mark the object as dirty when used by the GPU

* Flush pipecontrol post-sync writes

In both cases, software didn't explicitely order cpu write buffers to be
flushed, leading to graphics corruption or a hung gpu after incoherent
reads on the gpu side.

8 years agosys/boot/efi/boot1: Use NELEM.
Imre Vadász [Sat, 16 Apr 2016 10:59:37 +0000 (12:59 +0200)]
sys/boot/efi/boot1: Use NELEM.

8 years agosys/boot/efi: Add boot1 to the build.
Imre Vadász [Sat, 16 Apr 2016 10:50:08 +0000 (12:50 +0200)]
sys/boot/efi: Add boot1 to the build.

8 years agosys/boot/efi/boot1: Port efi boot1 loader from FreeBSD to DragonFly.
Imre Vadász [Sat, 16 Apr 2016 10:48:58 +0000 (12:48 +0200)]
sys/boot/efi/boot1: Port efi boot1 loader from FreeBSD to DragonFly.

* Add PATH_* #define-s to boot1.c instead of using a paths.h header.

* Remove ZFS related code.

* Some fixes for compile errors.

8 years agosys/boot/efi/boot1: Port Makefile, comment out fatfs template stuff.
Imre Vadász [Sat, 16 Apr 2016 10:46:34 +0000 (12:46 +0200)]
sys/boot/efi/boot1: Port Makefile, comment out fatfs template stuff.

8 years agosys/boot/common: Make ufsread.c build and work with efi boot1 from FreeBSD.
Imre Vadász [Sat, 27 Feb 2016 23:49:34 +0000 (00:49 +0100)]
sys/boot/common: Make ufsread.c build and work with efi boot1 from FreeBSD.

* Bring ufsread.c a bit closer to the FreeBSD code (mostly by adding
  fs_read_size(), which is needed for the efi boot1.

* So far ufsread.c was only used in sys/boot/pc32/boot2, where it was
  built with -DBOOT2 in CFLAGS. Nothing should change there, since all
  changes in this commit are either #ifndef BOOT2, or obviously shouldn't
  make a difference for the pc32/boot2 (like adding the
  boot2_ufs_read_size() function).

Partly-Taken-From: FreeBSD

8 years agosys/boot/efi: Import subset of FreeBSD's sys/boot/efi/boot1.
Imre Vadász [Sat, 16 Apr 2016 10:08:47 +0000 (12:08 +0200)]
sys/boot/efi: Import subset of FreeBSD's sys/boot/efi/boot1.

* This omits zfs_module.c and fat filesystem templates.

8 years agodrm/linux: Add get_num_physpages()
François Tigeot [Sun, 17 Apr 2016 07:04:50 +0000 (09:04 +0200)]
drm/linux: Add get_num_physpages()

8 years agodrm/i915: Fix a bug in i915_gem_object_flush cpu/gpu write domains
François Tigeot [Sun, 17 Apr 2016 06:59:49 +0000 (08:59 +0200)]
drm/i915: Fix a bug in i915_gem_object_flush cpu/gpu write domains

Reported-by: zrj
8 years agodrm/i915: Fix a bug in i915_gem_object_flush_gtt_write_domain()
François Tigeot [Sun, 17 Apr 2016 06:59:05 +0000 (08:59 +0200)]
drm/i915: Fix a bug in i915_gem_object_flush_gtt_write_domain()

Reported-by: zrj
8 years agogpio_intel: Add workaround for concurrent GPIO register access erratum.
Imre Vadász [Thu, 14 Apr 2016 22:02:18 +0000 (00:02 +0200)]
gpio_intel: Add workaround for concurrent GPIO register access erratum.

* This implements the suggested workaround, using a global lock for GPIO
  register accesses for Cherry Trail erratum:

  CHT34   Multiple Drivers That Access the GPIO Registers Concurrently May
          Result in Unpredictable System Behaviour

8 years agolibc: Do not set errno when mmap(MAP_TRYFIXED) fails.
zrj [Tue, 12 Apr 2016 10:16:05 +0000 (13:16 +0300)]
libc: Do not set errno when mmap(MAP_TRYFIXED) fails.

If this mmap call fails, we'll fall back to moving the allocation to
a different virtual address. Setting errno here might result in
functions further up the call stack misinterpreting an error condition.

Indeed, this surfaced in git's calling of getdelim() in a loop, where
getdelim() would return -1 at EOF, but the caller would find ENOMEM in
errno from a previous, successful, call and interpret that as an OOM.

Fix-to: 07a8ffeaab3fc830679c6836a6ee198ad1a3275f

Suggested-by: aggelos
8 years agoUpdate the pciconf(8) database.
Sascha Wildner [Fri, 15 Apr 2016 09:33:28 +0000 (11:33 +0200)]
Update the pciconf(8) database.

April 12, 2016 snapshot from http://pciids.sourceforge.net/

8 years agokqueue: Use critical section for knote cache
Sepherosa Ziehau [Thu, 14 Apr 2016 12:45:39 +0000 (20:45 +0800)]
kqueue: Use critical section for knote cache

So knote_free() can be triggered from interrupt threads safely.

Suggested-by: dillon@
8 years agolibc: Fix mdoc warnings on escaped characters.
zrj [Tue, 12 Apr 2016 13:18:27 +0000 (16:18 +0300)]
libc: Fix mdoc warnings on escaped characters.

8 years agolib/libutil: Terminate quoted strings (mdoc).
zrj [Tue, 12 Apr 2016 12:46:23 +0000 (15:46 +0300)]
lib/libutil: Terminate quoted strings (mdoc).

8 years agonls.7: Use Ta for tabs to fix mdoc warnings.
zrj [Tue, 12 Apr 2016 12:32:30 +0000 (15:32 +0300)]
nls.7: Use Ta for tabs to fix mdoc warnings.

8 years agocpucontrol(8): Sync with FreeBSD
zrj [Tue, 12 Apr 2016 10:26:43 +0000 (13:26 +0300)]
cpucontrol(8): Sync with FreeBSD

No previous functional change intended.

Taken-from: FreeBSD

8 years agocpuctl(4): Sync with FreeBSD
zrj [Tue, 12 Apr 2016 10:23:33 +0000 (13:23 +0300)]
cpuctl(4): Sync with FreeBSD

Intel Haswell ucode loading needs more work.

No previous functional change intended.

Taken-from: FreeBSD

8 years agosys/vfs/hammer: Add missing unlock in the previous commit
Tomohiro Kusumi [Tue, 12 Apr 2016 17:20:26 +0000 (02:20 +0900)]
sys/vfs/hammer: Add missing unlock in the previous commit

8 years agosys/vfs/hammer: Get volume lock first
Tomohiro Kusumi [Tue, 12 Apr 2016 15:25:42 +0000 (00:25 +0900)]
sys/vfs/hammer: Get volume lock first

Nothing critical but volume-add|del should get hmp->volume_lock
before the conditional.

8 years agosbin/newfs_hammer: Check upper limit of volume size
Tomohiro Kusumi [Tue, 12 Apr 2016 05:23:37 +0000 (14:23 +0900)]
sbin/newfs_hammer: Check upper limit of volume size

In theory, a volume whose (vol_buf_end - vol_buf_beg) exceeds 52 bits is invalid.
Also do the same check (assertion) on hammer volume-add|del.

8 years agosbin/hammer: Minor cleanup
Tomohiro Kusumi [Mon, 11 Apr 2016 11:39:55 +0000 (20:39 +0900)]
sbin/hammer: Minor cleanup

(zone-2 offset of layer1's big-block never changes once initialized)

  # grep "layer1_offset = " sys/vfs/hammer sbin/hammer -rI
  sys/vfs/hammer/hammer_blockmap.c:       layer1_offset = freemap->phys_offset +
  sys/vfs/hammer/hammer_blockmap.c:       layer1_offset = freemap->phys_offset +
  sys/vfs/hammer/hammer_blockmap.c:       layer1_offset = freemap->phys_offset +
  sys/vfs/hammer/hammer_blockmap.c:       layer1_offset = freemap->phys_offset +
  sys/vfs/hammer/hammer_blockmap.c:       layer1_offset = freemap->phys_offset +
  sys/vfs/hammer/hammer_blockmap.c:       layer1_offset = freemap->phys_offset +
  sys/vfs/hammer/hammer_blockmap.c:       layer1_offset = freemap->phys_offset +
  sys/vfs/hammer/hammer_blockmap.c:       layer1_offset = freemap->phys_offset +
  sys/vfs/hammer/hammer_blockmap.c:       layer1_offset = freemap->phys_offset +
  sys/vfs/hammer/hammer_volume.c:         layer1_offset = freemap->phys_offset +
  sys/vfs/hammer/hammer_volume.c:         layer1_offset = freemap->phys_offset +
  sys/vfs/hammer/hammer_volume.c:         layer1_offset = freemap->phys_offset +
  sys/vfs/hammer/hammer_volume.c:         layer1_offset = freemap->phys_offset +
  sys/vfs/hammer/hammer_volume.c:         layer1_offset = freemap->phys_offset +
  sbin/hammer/blockmap.c:         layer1_offset = freemap->phys_offset +
  sbin/hammer/blockmap.c: layer1_offset = freemap->phys_offset +
  sbin/hammer/blockmap.c: layer1_offset = freemap->phys_offset +
  sbin/hammer/ondisk.c:   layer1_offset = alloc_bigblock(root_vol, HAMMER_ZONE_FREEMAP_INDEX);
* sbin/hammer/ondisk.c:           layer1_offset = layer1_base +
* sbin/hammer/ondisk.c:           layer1_offset = layer1_base +
  sbin/hammer/cmd_blockmap.c:             layer1_offset = rootmap->phys_offset +

8 years agosys/vfs/hammer: Remove unused local variable
Tomohiro Kusumi [Mon, 11 Apr 2016 11:32:22 +0000 (20:32 +0900)]
sys/vfs/hammer: Remove unused local variable

added by de75bb2.
(only hammer_format_freemap() needs layer1 counter)

Add some comments.

8 years agodrm/i915: Use iounmap() everywhere
François Tigeot [Tue, 12 Apr 2016 09:02:32 +0000 (11:02 +0200)]
drm/i915: Use iounmap() everywhere

8 years agodrm/linux: Improve ioremap*/iounmap functions
François Tigeot [Tue, 12 Apr 2016 08:45:21 +0000 (10:45 +0200)]
drm/linux: Improve ioremap*/iounmap functions

* Properly track ioremap allocations

* Set address-space ranges to write back in iounmap() if and only
  if they are backed by regular memory

8 years ago drm/i915: Simplify i915_gem_fault() a bit
François Tigeot [Tue, 12 Apr 2016 08:30:31 +0000 (10:30 +0200)]
 drm/i915: Simplify i915_gem_fault() a bit

8 years agodrm/linux: Add set_pages_wb()
François Tigeot [Tue, 12 Apr 2016 08:26:44 +0000 (10:26 +0200)]
drm/linux: Add set_pages_wb()

8 years agodrm/linux: Move M_DRM declaration to linux/slab.h
François Tigeot [Tue, 12 Apr 2016 08:00:42 +0000 (10:00 +0200)]
drm/linux: Move M_DRM declaration to linux/slab.h

8 years agogpio_intel: Handle level triggered interrupts more correctly.
Imre Vadász [Sat, 9 Apr 2016 10:15:56 +0000 (12:15 +0200)]
gpio_intel: Handle level triggered interrupts more correctly.

* Clearing the interrupt status bit needs to be done after handling
  the level-triggered gpio interrupt.

* This avoids duplicate interrupts for level-triggered GpioInt lines.

8 years agogpio_intel: Change GPIOcfg bits when needed to enable RX for interrupt pins.
Imre Vadász [Tue, 5 Apr 2016 20:52:44 +0000 (22:52 +0200)]
gpio_intel: Change GPIOcfg bits when needed to enable RX for interrupt pins.

* On the HP x2 210 detachable the "windows-key" hardware button doesn't
  have RX enabled in the Gpio pin configuration by default.

8 years agogpio_intel: Fix CHV_GPIO_CTL1_INVRX constant, we need the RX Data bit.
Imre Vadász [Sat, 9 Apr 2016 19:17:41 +0000 (21:17 +0200)]
gpio_intel: Fix CHV_GPIO_CTL1_INVRX constant, we need the RX Data bit.

* And accordingly rename it to CHV_GPIO_CTL1_INVRXDATA (RX Data is the
  correct bit needed for configuring an ActiveLow level-triggered
  interrupt).

8 years agosbin/hammer: Fix hammer(8) manpage
Tomohiro Kusumi [Sat, 9 Apr 2016 05:49:07 +0000 (14:49 +0900)]
sbin/hammer: Fix hammer(8) manpage

See sbin/hammer/cmd_cleanup.c.

 # newfs_hammer -L TEST /dev/da1 /dev/da2 /dev/da3 > /dev/null
 # mount_hammer /dev/da1:/dev/da2:/dev/da3 /HAMMER
 # hammer cleanup /HAMMER > /dev/null
 # hammer config /HAMMER
 snapshots 1d 60d
 prune     1d 5m
 rebalance 1d 5m
 #dedup     1d 5m
 reblock   1d 5m
 recopy    30d 10m
 # umount /HAMMER
 # hammer -vvvf /dev/da1:/dev/da2:/dev/da3 show | grep config -A7
                  config text="
                              snapshots 1d 60d
                              prune     1d 5m
                              rebalance 1d 5m
                              #dedup        1d 5m
                              reblock   1d 5m
                              recopy    30d 10m
                              "

8 years agosbin/hammer: Make hammer info print volumes
Tomohiro Kusumi [Sat, 9 Apr 2016 05:08:54 +0000 (14:08 +0900)]
sbin/hammer: Make hammer info print volumes

in blkdevs format, in addition to 56c2f4d6.
This code is exactly what hammer volume-blkdevs does.

 # hammer info /HAMMER
 Volume identification
         Label               TEST
         No. Volumes         3
         HAMMER Volumes      /dev/da1:/dev/da2:/dev/da3
         Root Volume         /dev/da1
 ...

8 years agodrm: Import asm/unaligned.h from NetBSD
François Tigeot [Thu, 7 Apr 2016 19:28:48 +0000 (21:28 +0200)]
drm: Import asm/unaligned.h from NetBSD

8 years agodrm/i915: Switch rps.client_lock to a lockmgr lock
François Tigeot [Thu, 7 Apr 2016 17:18:25 +0000 (19:18 +0200)]
drm/i915: Switch rps.client_lock to a lockmgr lock

Even though it was extremely improbable, there was a possibility for the
i915 driver to sleep while holding the rps.client_lock spinlock.

8 years agosbin/newfs_msdos: Fix error message
Tomohiro Kusumi [Thu, 7 Apr 2016 03:41:48 +0000 (12:41 +0900)]
sbin/newfs_msdos: Fix error message

595e3440 changed ioctl to DIOCGPART.

8 years agosys/vfs/hammer: Rename ondisk vol_name to vol_label
Tomohiro Kusumi [Thu, 7 Apr 2016 01:26:29 +0000 (10:26 +0900)]
sys/vfs/hammer: Rename ondisk vol_name to vol_label

Ondisk volume header having a field named vol_name for a label
(not a block device path) is confusing, especially when inmemory
volume structure has vol_name for a block device but not a label.

There is even a kprintf message wrongly using ondisk vol_name
as a block device path, as well as some comments saying vol_name
is a filesystem label but not a path, which implies the name was
misleading.

This commit changes ondisk vol_name to vol_label.
This commit also changes vol_name in struct hammer_ioc_info to
vol_label. Outbox userspace programs using these two will see
compile error after this commit (which I doubt there is any...).
This commit doesn't break binaries.

Note that vol_name in struct libhammer_fsinfo is unchanged.

8 years agolibc/libutil: Some mdoc cleanup in various manual pages.
Sascha Wildner [Wed, 6 Apr 2016 18:35:01 +0000 (20:35 +0200)]
libc/libutil: Some mdoc cleanup in various manual pages.

8 years agodrm/linux: Add dma_unmap_page()
François Tigeot [Wed, 6 Apr 2016 18:05:35 +0000 (20:05 +0200)]
drm/linux: Add dma_unmap_page()

8 years agosys/vfs/hammer: Cleanup hammer_format_volume_header() prototype
Tomohiro Kusumi [Wed, 6 Apr 2016 06:30:31 +0000 (15:30 +0900)]
sys/vfs/hammer: Cleanup hammer_format_volume_header() prototype

No functional changes, just remove some arguments that can be
dereferenced from other pointers since it has way too many args,
plus some refactoring to make it look more like newfs_hammer code
which basically does the same thing.

(It doesn't need to be a generic function by having these fileds
as different arguments. Formatting a volume within kernel space
is specific to this ioctl, and the original design was to format
volumes in userspace. It's also technically possible to implement
hammer volume-add|del mostly in userspace. In fact the current
kernel code which formats volumes looks pretty much identical to
what newfs_hammer does on formatting after below commits, which
is natural thing considering what these commands do.)

c7a9d2e sys/vfs/hammer: Remove hammer_iterate_l1l2_entries()
de75bb2 sys/vfs/hammer: Fix/rewrite hammer_free_freemap()
d8d6680 sys/vfs/hammer: Fix/rewrite hammer_format_freemap()
28cdb63 sys/vfs/hammer: Remove struct bigblock_stat
12d76ce sys/vfs/hammer: Remove hammer_test_free_freemap()
e2c5fb2 sys/vfs/hammer: Separate total/free big-block counting from formatting

8 years agodrm/i915: Fix Baytrail hangs with deeper C-states
François Tigeot [Wed, 6 Apr 2016 06:40:48 +0000 (08:40 +0200)]
drm/i915: Fix Baytrail hangs with deeper C-states

Submitted-by: Daniel Bilik
8 years agolibc: mdoc cleanup in some system call manual pages.
Sascha Wildner [Tue, 5 Apr 2016 17:41:41 +0000 (19:41 +0200)]
libc: mdoc cleanup in some system call manual pages.