Commit Graph

977 Commits

Author SHA1 Message Date
jakllsch
20ab6e5f00 Fix two issues in NetBSD implementation of igp_read_bios_from_vram():
* Allocate the correct buffer for the VGA BIOS image.
 * Abort if buffer allocation failed, not if buffer allocation succeeded.

Not directly tested, but I can't imagine this makes anything worse.
2015-06-13 18:18:18 +00:00
mrg
22c58b8a2f disable drmkms on r100 and most r200. works around PR#49744, etc. 2015-05-29 05:48:46 +00:00
riastradh
6543027a39 Adapt ww_mutex to use LOCKDEBUG.
Should help track down PR 49862.
2015-05-21 21:55:55 +00:00
riastradh
565bd38756 Add XXX comment for previous. 2015-05-20 18:13:23 +00:00
riastradh
c4db66d4bf Don't pass along null encoder. Noted by Coverity, CID 113253. 2015-05-20 18:12:01 +00:00
riastradh
66cbe3320e Fix kassert: npdp may be GEN8_LEGACY_PDPS exactly.
Tripped over by msaitoh, our first Broadwell user, apparently.
2015-05-20 11:29:45 +00:00
riastradh
ce18844b86 Remove workaround for PR kern/49195.
Problem seems to have been properly fixed in rev. 1.25.
2015-05-13 23:57:02 +00:00
christos
bcec7bd07a CID 1294266: Cast to void. 2015-05-09 15:36:15 +00:00
christos
e617b5c6d2 CID 1292512: Help coverity with offset NULL calculations 2015-05-09 15:34:13 +00:00
christos
0286f1d2e9 CID 1292510: Check allocation 2015-05-09 15:31:36 +00:00
christos
e8c33bf290 CID 1256503: Handle memory leak 2015-05-09 15:24:56 +00:00
christos
6f91147d24 CID 1256502: missing lint fallthrough comment 2015-05-09 15:14:45 +00:00
christos
94e199271d CID 710492: dev_priv was dereferenced in via_release_futex, no point in
checking again.
2015-05-09 13:19:22 +00:00
christos
9a0dcc7c97 CID 976986: NULL deref. 2015-05-09 13:16:42 +00:00
hikaru
e427b2e5a6 Support external DMA mode and provide an interface for DMA address configuration 2015-05-01 06:58:40 +00:00
riastradh
6628d7ec9f Regen to get real rcsids here. 2015-04-29 19:26:59 +00:00
riastradh
f069bfda14 Add Chrome9 HC IGP to viadrm device ids. 2015-04-29 17:36:09 +00:00
riastradh
328fc44014 Empty suspend/resume handler for viadrmums. 2015-04-29 12:30:43 +00:00
riastradh
e988ad91e3 Hook up viadrmums and include it it i386/ALL. 2015-04-29 11:37:31 +00:00
riastradh
101a1af633 Avoid void *->paddr_t cast warning on i386. 2015-04-29 11:36:43 +00:00
riastradh
c03fed454d Just use `drm' for DRM/UMS PCI attachments at PCI devices.
It'll make life simpler.  No need to distinguish drm from drm2 here
because it's just an interface attribute, no content, and we use it
compatibly: parent provides pci_attach_args.
2015-04-29 11:28:32 +00:00
riastradh
a72b8c43e9 Add the missing viadrm files omitted last night. 2015-04-29 11:25:36 +00:00
riastradh
42bda9b449 Make viadrm (UMS) almost build.
Missing part: something needs to issue config_found_ia("drmums_pci"),
and config(5) needs to be told that it will do that.  The sensible
approach is for vga_pci to do so.  But config(5) doesn't seem to
understand that *only* vga_pci will do that, not all vga.

The old scheme was to tell config(5) that vga would always attach
drm, and actually attach it in vga_pci, and hope that nobody would
ever consider trying to attach non-PCI devices but quietly leave the
token `pci' out of the name of the drm interface attribute so it
didn't look wrong to have it outside dev/pci/files.pci.

Maybe that's still the right thing, as far as anything UMS can be
right.
2015-04-29 04:45:03 +00:00
riastradh
9f0b3ec037 Replace drm_ioremap by drm_core_ioremap, reducing diff a little. 2015-04-29 04:38:55 +00:00
riastradh
8eea28f41a kmem_free the container structure, not a substructure. 2015-04-25 21:00:29 +00:00
mrg
eefa02b0a2 don't apply the "don't set CLUT" to RV280. it isn't necessary for
my PCI 9250 card, and hoses the colours in X when running.

unfortunately, my RV250 does need this to avoid the console being
very very dark on black.

i'm curious what other earlier radeon card (anything matching any
of the card marked as:  CHIP_R100, CHIP_RV100, CHIP_RS100,
CHIP_RV200, CHIP_RS200, CHIP_R200, CHIP_RV250, and CHIP_RS300.)


the RV280 now works again properly, but the RV250 is still having
a problem waiting for commands to complete and it appears as if
X is hung, when infact it is asking the kernel quite frequently
if the job it asked for is complete, each time sleeping for a
short time and thus only appearing to take almost no CPU.
2015-04-25 20:50:04 +00:00
riastradh
eadfa0c1a9 Make sure mem.bus.is_iomem is initialized. PR 49833 2015-04-20 20:15:22 +00:00
riastradh
1054fdc184 First attempt to make ttm_buffer_object_transfer less bogus. 2015-04-20 19:17:04 +00:00
riastradh
4897f1c47a Remove old drm's container_of. 2015-04-20 15:38:13 +00:00
riastradh
7fd36dbc4a Add container_of to libkern.
Given x = &c->f, container_of(x, T, f) yields c, where T is the type
of c.

Discussed on tech-kern a while ago:

https://mail-index.netbsd.org/tech-kern/2013/03/21/msg015131.html
2015-04-20 15:22:17 +00:00
mrg
83ab79e1fd apply some of the additional changes from Arto Huusko in PR#49645:
- call pmf_device_deregister on detach.

i've kept the "resume = true" for radeon_resume_kms() call as it
seems to work for me (indeed, code inspection shows it is unused
on netbsd :-)

my old nforce4 box that can resume old drm (or could, last i tried
several years ago) while X and GL apps were running, can at least
survive a resume if X hasn't started.  my one attempt so far with
X exited, but having run, did not work.
2015-04-19 01:08:56 +00:00
riastradh
48db6abd52 Remove broken drm2 vm_mmap stub. Can't possibly have ever worked. 2015-04-17 15:02:50 +00:00
pgoyette
1252d3ce68 Update module dependencies:
drmkms does not depend on iic
	drmkms_linux depends on i2cexec
2015-04-13 22:24:33 +00:00
christos
33592402d1 update for new acpica 2015-04-13 17:23:39 +00:00
christos
cb2bd8f0cd resolve conflicts. 2015-04-13 17:23:15 +00:00
christos
679c17fd50 ----------------------------------------
10 April 2015. Summary of changes for version 20150410:

Reverted a change introduced in version 20150408 that caused
a regression in the disassembler where incorrect operator
symbols could be emitted.

----------------------------------------
08 April 2015. Summary of changes for version 20150408:


1) ACPICA kernel-resident subsystem:

Permanently set the return value for the _REV predefined name. It now
returns 2 (was 5). This matches other ACPI implementations. _REV will be
deprecated in the future, and is now defined to be 1 for ACPI 1.0, and 2
for ACPI 2.0 and later. It should never be used to differentiate or
identify operating systems.

Added the "Windows 2015" string to the _OSI support. ACPICA will now
return TRUE to a query with this string.

Fixed several issues with the local version of the printf function.

Added the C99 compiler option (-std=c99) to the Unix makefiles.

  Current Release:
    Non-Debug Version:  99.9K Code, 27.4K Data, 127.3K Total
    Debug Version:     195.2K Code, 80.7K Data, 275.9K Total
  Previous Release:
    Non-Debug Version:  98.8K Code, 27.3K Data, 126.1K Total
    Debug Version:     192.1K Code, 79.8K Data, 271.9K Total


2) iASL Compiler/Disassembler and Tools:

iASL: Implemented an enhancement to the constant folding feature to
transform the parse tree to a simple Store operation whenever possible:
    Add (2, 3, X) ==> is converted to: Store (5, X)
    X = 2 + 3     ==> is converted to: Store (5, X)

Updated support for the SLIC table (Software Licensing Description Table)
in both the Data Table compiler and the disassembler. The SLIC table
support now conforms to "Microsoft Software Licensing Tables (SLIC and
MSDM). November 29, 2011. Copyright 2011 Microsoft". Note: Any SLIC data
following the ACPI header is now defined to be "Proprietary Data", and as
such, can only be entered or displayed as a hex data block.

Implemented full support for the MSDM table as described in the document
above. Note: The format of MSDM is similar to SLIC. Any MSDM data
following the ACPI header is defined to be "Proprietary Data", and can
only be entered or displayed as a hex data block.

Implemented the -Pn option for the iASL Table Compiler (was only
implemented for the ASL compiler). This option disables the iASL
preprocessor.

Disassembler: For disassembly of Data Tables, added a comment field
around the Ascii equivalent data that is emitted as part of the "Raw
Table Data" block. This prevents the iASL Preprocessor from possible
confusion if/when the table is compiled.

Disassembler: Added an option (-df) to force the disassembler to assume
that the table being disassembled contains valid AML. This feature is
useful for disassembling AML files that contain ACPI signatures other
than DSDT or SSDT (such as OEMx or other signatures).

Changes for the EFI version of the tools:
1) Fixed a build error/issue
2) Fixed a cast warning

iASL: Fixed a path issue with the __FILE__ operator by making the
directory prefix optional within the internal SplitInputFilename
function.

Debugger: Removed some unused global variables.

Tests: Updated the makefile for proper generation of the AAPITS suite.

----------------------------------------
04 February 2015. Summary of changes for version 20150204:

ACPICA kernel-resident subsystem:

Updated all ACPICA copyrights and signons to 2014. Added the 2014
copyright to all module headers and signons, including the standard Linux
header. This affects virtually every file in the ACPICA core subsystem,
iASL compiler, all ACPICA utilities, and the test suites.

Events: Introduce ACPI_GPE_DISPATCH_RAW_HANDLER to fix GPE storm issues.
A raw gpe handling mechanism was created to allow better handling of GPE
storms that aren't easily managed by the normal handler. The raw handler
allows disabling/renabling of the the GPE so that interrupt storms can be
avoided in cases where events cannot be timely serviced. In this
scenario, handlers should use the AcpiSetGpe() API to disable/enable the
GPE. This API will leave the reference counts undisturbed, thereby
preventing unintentional clearing of the GPE when the intent in only to
temporarily disable it. Raw handlers allow enabling and disabling of a
GPE by removing GPE register locking. As such, raw handlers much provide
their own locks while using GPE API's to protect access to GPE data
structures.
Lv Zheng

Events: Always modify GPE registers under the GPE lock.
Applies GPE lock around AcpiFinishGpe() to protect access to GPE register
values. Reported as bug by joe.liu@apple.com.

Unix makefiles: Separate option to disable optimizations and
_FORTIFY_SOURCE. This change removes the _FORTIFY_SOURCE flag from the
NOOPT disable option and creates a separate flag (NOFORTIFY) for this
purpose. Some toolchains may define _FORTIFY_SOURCE which leads redefined
errors when building ACPICA. This allows disabling the option without
also having to disable optimazations.
David Box

  Current Release:
    Non-Debug Version: 101.7K Code, 27.9K Data, 129.6K Total
    Debug Version:     199.2K Code, 82.4K Data, 281.6K Total

----------------------------------------
07 November 2014. Summary of changes for version 20141107:

This release is available at https://acpica.org/downloads

This release introduces and implements language extensions to ASL that
provide support for symbolic ("C-style") operators and expressions. These
language extensions are known collectively as ASL+.


1) iASL Compiler/Disassembler and Tools:

Disassembler: Fixed a problem with disassembly of the UartSerialBus
macro. Changed "StopBitsNone" to the correct "StopBitsZero". David E.
Box.

Disassembler: Fixed the Unicode macro support to add escape sequences.
All non-printable ASCII values are emitted as escape sequences, as well
as the standard escapes for quote and backslash. Ensures that the
disassembled macro can be correctly recompiled.

iASL: Added Printf/Fprintf macros for formatted output. These macros are
translated to existing AML Concatenate and Store operations. Printf
writes to the ASL Debug object. Fprintf allows the specification of an
ASL name as the target. Only a single format specifier is required, %o,
since the AML interpreter dynamically converts objects to the required
type. David E. Box.

    (old)    Store (Concatenate (Concatenate (Concatenate (Concatenate
                 (Concatenate (Concatenate (Concatenate ("", Arg0),
                 ": Unexpected value for "), Arg1), ", "), Arg2),
                 " at line "), Arg3), Debug)

    (new)    Printf ("%o: Unexpected value for %o, %o at line %o",
                 Arg0, Arg1, Arg2, Arg3)

    (old)    Store (Concatenate (Concatenate (Concatenate (Concatenate
                 ("", Arg1), ": "), Arg0), " Successful"), STR1)

    (new)    Fprintf (STR1, "%o: %o Successful", Arg1, Arg0)

iASL: Added debug options (-bp, -bt) to dynamically prune levels of the
ASL parse tree before the AML code is generated. This allows blocks of
ASL code to be removed in order to help locate and identify problem
devices and/or code. David E. Box.

AcpiExec: Added support (-fi) for an optional namespace object
initialization file. This file specifies initial values for namespace
objects as necessary for debugging and testing different ASL code paths
that may be taken as a result of BIOS options.


2) Overview of symbolic operator support for ASL (ASL+)
-------------------------------------------------------

As an extension to the ASL language, iASL implements support for symbolic
(C-style) operators for math and logical expressions. This can greatly
simplify ASL code as well as improve both readability and
maintainability. These language extensions can exist concurrently with
all legacy ASL code and expressions.

The symbolic extensions are 100% compatible with existing AML
interpreters, since no new AML opcodes are created. To implement the
extensions, the iASL compiler transforms the symbolic expressions into
the legacy ASL/AML equivalents at compile time.

Full symbolic expressions are supported, along with the standard C
precedence and associativity rules.

Full disassembler support for the symbolic expressions is provided, and
creates an automatic migration path for existing ASL code to ASL+ code
via the disassembly process. By default, the disassembler now emits ASL+
code with symbolic expressions. An option (-dl) is provided to force the
disassembler to emit legacy ASL code if desired.

Below is the complete list of the currently supported symbolic operators
with examples. See the iASL User Guide for additional information.


ASL+ Syntax      Legacy ASL Equivalent
-----------      ---------------------

    // Math operators

Z = X + Y        Add (X, Y, Z)
Z = X - Y        Subtract (X, Y, Z)
Z = X * Y        Multiply (X, Y, Z)
Z = X / Y        Divide (X, Y, , Z)
Z = X % Y        Mod (X, Y, Z)
Z = X << Y       ShiftLeft (X, Y, Z)
Z = X >> Y       ShiftRight (X, Y, Z)
Z = X & Y        And (X, Y, Z)
Z = X | Y        Or (X, Y, Z)
Z = X ^ Y        Xor (X, Y, Z)
Z = ~X           Not (X, Z)
X++              Increment (X)
X--              Decrement (X)

    // Logical operators

(X == Y)         LEqual (X, Y)
(X != Y)         LNotEqual (X, Y)
(X < Y)          LLess (X, Y)
(X > Y)          LGreater (X, Y)
(X <= Y)         LLessEqual (X, Y)
(X >= Y)         LGreaterEqual (X, Y)
(X && Y)         LAnd (X, Y)
(X || Y)         LOr (X, Y)
(!X)             LNot (X)

    // Assignment and compound assignment operations

X = Y           Store (Y, X)
X += Y          Add (X, Y, X)
X -= Y          Subtract (X, Y, X)
X *= Y          Multiply (X, Y, X)
X /= Y          Divide (X, Y, , X)
X %= Y          Mod (X, Y, X)
X <<= Y         ShiftLeft (X, Y, X)
X >>= Y         ShiftRight (X, Y, X)
X &= Y          And (X, Y, X)
X |= Y          Or (X, Y, X)
X ^= Y          Xor (X, Y, X)


3) ASL+ Examples:
-----------------

Legacy ASL:
        If (LOr (LOr (LEqual (And (R510, 0x03FB), 0x02E0), LEqual (
            And (R520, 0x03FB), 0x02E0)), LOr (LEqual (And (R530,
0x03FB),
            0x02E0), LEqual (And (R540, 0x03FB), 0x02E0))))
        {
            And (MEMB, 0xFFFFFFF0, SRMB)
            Store (MEMB, Local2)
            Store (PDBM, Local1)
            And (PDBM, 0xFFFFFFFFFFFFFFF9, PDBM)
            Store (SRMB, MEMB)
            Or (PDBM, 0x02, PDBM)
        }

ASL+ version:
        If (((R510 & 0x03FB) == 0x02E0) ||
            ((R520 & 0x03FB) == 0x02E0) ||
            ((R530 & 0x03FB) == 0x02E0) ||
            ((R540 & 0x03FB) == 0x02E0))
        {
            SRMB = (MEMB & 0xFFFFFFF0)
            Local2 = MEMB
            Local1 = PDBM
            PDBM &= 0xFFFFFFFFFFFFFFF9
            MEMB = SRMB
            PDBM |= 0x02
        }

Legacy ASL:
        Store (0x1234, Local1)
        Multiply (Add (Add (Local1, TEST), 0x20), Local2, Local3)
        Multiply (Local2, Add (Add (Local1, TEST), 0x20), Local3)
        Add (Local1, Add (TEST, Multiply (0x20, Local2)), Local3)
        Store (Index (PKG1, 0x03), Local6)
        Store (Add (Local3, Local2), Debug)
        Add (Local1, 0x0F, Local2)
        Add (Local1, Multiply (Local2, Local3), Local2)
        Multiply (Add (Add (Local1, TEST), 0x20), ToBCD (Local1), Local3)

ASL+ version:
        Local1 = 0x1234
        Local3 = (((Local1 + TEST) + 0x20) * Local2)
        Local3 = (Local2 * ((Local1 + TEST) + 0x20))
        Local3 = (Local1 + (TEST + (0x20 * Local2)))
        Local6 = Index (PKG1, 0x03)
        Debug = (Local3 + Local2)
        Local2 = (Local1 + 0x0F)
        Local2 = (Local1 + (Local2 * Local3))
        Local3 = (((Local1 + TEST) + 0x20) * ToBCD (Local1))
2015-04-13 17:21:01 +00:00
riastradh
e2706ecca9 Don't break when hardclock_ticks wraps around.
Since we now only count time spent in wait, rather than determining
the end time and checking whether we've passed it, timeouts might be
marginally longer in effect.  Unlikely to be an issue.
2015-04-12 20:55:02 +00:00
riastradh
ad39b58c4c KASSERT about page-alignment on initialization too. 2015-04-10 17:44:35 +00:00
riastradh
7c2bb57f2b Use KASSERTMSG to show bad base/offset. 2015-04-10 17:28:42 +00:00
riastradh
134f6b2a80 Need the page's uvm object lock to do pmap_page_protect. 2015-04-10 13:30:01 +00:00
mrg
a4598cfd67 almost add radeondrmkms suspend/resume support. it unfortunately doesn't work. 2015-04-10 02:03:14 +00:00
riastradh
188484eb4b Don't reserve if atomic -- caller must have pre-pinned the buffer. 2015-04-08 01:42:40 +00:00
riastradh
c955328013 Missed a zero: it's 0x100000, not 0x10000. 2015-04-06 02:29:18 +00:00
riastradh
8e8ad4e145 Don't let anyone else allocate the video BIOS either. 2015-04-06 01:11:19 +00:00
riastradh
8ed8bab8ef In DRM_SPIN_WAIT_ON, don't stop after waiting only one tick.
Continue the loop to recheck the condition and count the whole
duration.
2015-04-04 15:46:53 +00:00
jmcneill
ba1490c167 pmf_device_register returns false on failure, not true 2015-04-04 15:12:39 +00:00
riastradh
e1af3960a6 Use pmap_pv(9) to remove mappings of device pages in TTM.
Adapt nouveau and radeon to do pmap_pv_track for their device pages.

Proposed on tech-kern with no objections:

https://mail-index.netbsd.org/tech-kern/2015/03/26/msg018561.html

Further background at:

https://mail-index.netbsd.org/tech-kern/2014/07/23/msg017392.html
2015-04-03 01:09:42 +00:00
riastradh
f8875b371c Use pmap_pv(9) to remove mappings of Intel graphics aperture pages.
Proposed on tech-kern with no objections:

https://mail-index.netbsd.org/tech-kern/2015/03/26/msg018561.html

Further background at:

https://mail-index.netbsd.org/tech-kern/2014/07/23/msg017392.html
2015-04-03 01:06:05 +00:00
khorben
1d8d50afe0 Fix for PR kern/48109 (and its duplicate kern/49807)
As provided by Takahiro HAYASHI in PR kern/48109. Additional error
registration in ipf(8) by myself. Changes tested with GENERIC and
XEN3_DOM0. Thanks!

XXX pull-up netbsd-7
2015-04-02 00:12:58 +00:00
christos
80cc774264 Hack against the blank console problem:
Leave the CLUT alone on ancient cards. At least this leaves us with a
semi working console (red and blue are flipped). Leave an example of what
seems to be happening but disable it because colors are better than 444 bit
greyscale.
2015-03-18 02:57:13 +00:00
christos
1a7eb0717b fix gcc is stupid. 2015-03-12 15:09:04 +00:00
joerg
0ef4f8b517 Don't use __gcc_personality_sj0 on ARM. 2015-03-09 17:28:11 +00:00
riastradh
2df0a617c4 Apply access control to gem mmap. 2015-03-09 01:29:40 +00:00
riastradh
b638ee77d7 Don't return events that are too large and leave them in the list. 2015-03-08 23:37:56 +00:00
christos
edbdebbcbb Dedup the NetBSD portion of the code (ok Riastradh), no functional change. 2015-03-06 22:24:05 +00:00
riastradh
1a0c0250a7 Pass cache-related flags through to the GTT on pre-SNB devices.
I had assumed for ages this would increase the amount of caching and
thereby increase the chance of stale caches leading to rendering
glitches.  But apparently I was wrong, and failing to pass these
through was causing all sorts of problems!
2015-03-06 22:03:06 +00:00
riastradh
f970967abf Create the nouveau device object so the driver can start.
I get a lot of messages on the console and then it hangs.  Progress!

Next to try with a breakfast console.
2015-03-06 15:39:28 +00:00
riastradh
0696cb6efa Spurious blank line. 2015-03-06 15:08:02 +00:00
riastradh
e979445ec8 Synchronize permission checks with upstream drm_ioctl_permit. 2015-03-06 14:02:39 +00:00
riastradh
d495674638 Simplify drm shenanigans with irrelevant irq numbers. 2015-03-06 13:44:18 +00:00
riastradh
59207580e6 Remove local definition of wbinvd. 2015-03-06 12:24:36 +00:00
riastradh
728f6d163b Use x86_mfence explicitly, not membar_sync, just to be clear. 2015-03-06 12:06:35 +00:00
riastradh
999436ee47 One last round for nouveau. It links! 2015-03-06 01:43:07 +00:00
riastradh
f994865553 Adapt drmkms_pci module initialization to work as builtin, for agp. 2015-03-06 01:24:24 +00:00
christos
5aa1e28d4a Write the loops the same way, leaving i containing the number of tries
left. Also break early in the hot case.
2015-03-05 21:13:48 +00:00
christos
0dc9dda4f2 properly include files so that modules work. 2015-03-05 20:19:30 +00:00
riastradh
8d3bbbe081 Factor out intelfb_is_vga_console to drmfb_pci. 2015-03-05 17:56:39 +00:00
riastradh
894a903bb9 Factor generic parts of intelfb out into a drmfb.
Adapting radeondrmkmsfb should not be hard.

This will make nouveaufb easier too.
2015-03-05 17:50:41 +00:00
riastradh
c48dc052b9 Rewrite drm_encoder_slave.c, as nouveau will need. 2015-03-05 17:42:48 +00:00
riastradh
5ed5a417f5 Add an unused struct dev_pm_ops to <linux/pm.h>. 2015-03-05 17:35:56 +00:00
riastradh
851c4ebcd8 Reorganize Linux i2c header file and add a few more shims. 2015-03-05 17:29:18 +00:00
riastradh
2ee2d4e588 Include some necessary header files and forward declarations. 2015-03-05 17:24:36 +00:00
riastradh
39be2cc0ab Remove outdated comment. The ->dev.parent stuff is part of the API. 2015-03-05 15:02:36 +00:00
riastradh
8cfa708e19 Mark pages dirty after use for write in the aperture (`GTT'). 2015-03-05 01:04:51 +00:00
riastradh
da1bc3098b Unwire pages when we're done in i915_gem_object_attach_phys. 2015-03-05 00:55:34 +00:00
riastradh
7582f7f3c9 CLFLUSH needs to be surrounded by membars.
While here, round everything to a multiple of the cache line size.
2015-03-04 18:19:27 +00:00
riastradh
7bdeaa6116 Return current pid and current euid from drm_getclient to fool libva. 2015-03-04 11:00:15 +00:00
riastradh
bdd8b1b6ce Re-enable prints to diagnose PR 49195.
I believe I fixed this problem by fixing __wait_seqno, but before I
remove the workaround I'll try to make sure it's not getting hit any
more.
2015-03-03 14:31:48 +00:00
riastradh
d6dfcdeae7 radeon_fence_wait returns 0, not positive, on success. 2015-03-03 13:57:20 +00:00
riastradh
dae0a2cc06 Replace `out' label by break.
Reduces diff from upstream a little.

No functional change, confirmed by diffing `objdump -dr' output.
2015-03-02 23:29:56 +00:00
riastradh
fb34b3a2a0 Narrow the scope of the gmbus wait lock to where we need it. 2015-03-02 23:05:03 +00:00
riastradh
96ef47eb7a Drop the gmbus wait lock to delay. 2015-03-02 18:36:49 +00:00
riastradh
afd556cfa9 Return the error if there is one in radeon_fence_wait_seq.
Don't just always say we succeeded!
2015-03-02 17:53:00 +00:00
riastradh
ae9280efd2 Don't sleep in the drm_vma allocator. Fail with ENOSPC, not ENOMEM.
Caller has dev->struct_mutex locked and will handle ENOSPC anyway.
2015-03-02 17:34:23 +00:00
riastradh
3bcdd265e2 Make sure wedged actually gets set on all code paths.
Otherwise GCC helpfully realizes we're invoking undefined behaviour
and optimizes away the possibility that this routine will return
success, without saying a word about it.
2015-03-02 17:30:17 +00:00
riastradh
8aae5c1e3e Fix broken error checking in kmalloc_array/kcalloc. 2015-03-02 02:26:37 +00:00
mrg
9a104ac13a fix some comments about the half-working i386 hack. 2015-03-01 10:07:01 +00:00
riastradh
fd2bb02c5e Actually poll every tick as advertised. 2015-02-28 21:30:22 +00:00
riastradh
74ed5123ca Remove extraneous blank line. 2015-02-28 21:17:32 +00:00
riastradh
a52fa629a5 New macro DRM_SPIN_WAIT_ON better reflects DRM_WAIT_ON.
We still need to adapt all waits from upstream to use an interlock,
so we can't implement DRM_WAIT_ON verbatim, but this more closely
reflects the API of DRM_WAIT_ON than DRM_*WAIT*_UNTIL do.

Major difference is that this polls every tick, like DRM_WAIT_ON,
unlike DRM_*WAIT*_UNTIL.  So it will mask missing wakeups, but it
wouldn't surprise me if there were such things upstream.
2015-02-28 18:25:39 +00:00
riastradh
6e783fa3c8 Match Linux's wait for gmbus a little more precisely.
Don't just wait up to 50 ms for a gmbus interrupt -- poll every tick
for >=50 ms.
2015-02-28 14:10:00 +00:00
riastradh
50797df5dd Another upstream uninterruptible. 2015-02-28 05:42:07 +00:00
riastradh
b49b6cccd5 These are uninterruptible upstream too. 2015-02-28 05:38:49 +00:00
riastradh
c0e49bed9f This one is uninterruptible upstream too. 2015-02-28 05:37:10 +00:00
riastradh
41c73966f3 Elaborate on essay about DRM_*WAIT*_UNTIL reutrn convention. 2015-02-28 04:57:12 +00:00
riastradh
1764a2cd49 Fix two more gmbus wait bugs.
- Fix sense of return value in intel_dp_aux_wait_done.
- Make the waits uninterruptible here like in Linux.
2015-02-28 04:54:12 +00:00
riastradh
900c8c0ef4 Make timed and untimed cases of __wait_seqno agree on return value. 2015-02-28 04:47:44 +00:00
riastradh
6e671c0df3 Fix sense of conditional in wait while cold. Functional change! 2015-02-28 04:18:12 +00:00
riastradh
a74fbdef46 Simplify wait while cold. No functional change. 2015-02-28 04:17:37 +00:00
riastradh
9f6b9af91f More DRM_TIMED_WAIT mistakes: 0, not -ETIMEDOUT, for timeout. 2015-02-28 03:33:22 +00:00
riastradh
0fe69285b7 Recheck condition after wait in wait_for like Linux does. 2015-02-28 03:27:38 +00:00
riastradh
c22bc250dc Fix these drm waits too, in case anyone tries to use this via code. 2015-02-28 03:23:32 +00:00
riastradh
5919a0453e Write an essay to remind myself about (timed) wait return values. 2015-02-28 03:22:50 +00:00
riastradh
32fb3c782c And another timeout return value mistake. 2015-02-28 03:06:46 +00:00
riastradh
34a2befd8a Clarify comment in last commit. 2015-02-28 03:05:09 +00:00
riastradh
5af39c7521 Fix another *@!#^$@!& timeout return convention mistake. 2015-02-28 03:03:30 +00:00
riastradh
f6920c646c Fix typo: __gtt_iomem, not __acpi_iomem. No functional change. 2015-02-27 16:02:03 +00:00
riastradh
8363517855 Also get the sense of the condition to wait until right. @!&#^$@!&* 2015-02-27 04:40:17 +00:00
riastradh
5fbac436ac Make gmbus_wait_hw_status consistently use 50ms timeout like Linux.
Apparently I changed this to a 1-tick timeout.  No clue why.
2015-02-27 04:35:02 +00:00
riastradh
58fea22061 Limit scope of ret and omit needless use of it to reduce confusion. 2015-02-27 04:29:27 +00:00
riastradh
066a045600 ...aaaaand one more fix for __wait_seqno return value. 2015-02-26 23:32:40 +00:00
riastradh
f94741bf4c Another attempt to fix the drm timed wait blarf blugh blahhh. 2015-02-26 23:27:41 +00:00
riastradh
722ec83fe7 Omit needless bus_dmamap_sync -- they're batched for gart updates. 2015-02-26 23:00:05 +00:00
riastradh
b522b62fa2 Fix return code of __wait_seqno.
MAX(ret, 0) is 0 if ret is negative, but if ret is negative we want
to return that negative value, meaning error.  Should've been
MIN(ret, 0), but I'll just rewrite it to clarify a wee bit.

If the GPU reset, call i915_gem_check_wedge and always return failure
like Linux does.  Caller must retry in that case.
2015-02-26 19:43:43 +00:00
riastradh
b3c8e40fbd Fix returned timeout in wait_seqno: remaining time, not time slept. 2015-02-26 14:10:14 +00:00
riastradh
dbd4128628 Another round of nouveau whack-a-mole.
Nouveau compiles now, though it doesn't link yet.

Need to write driver attachment, wscons framebuffer, &c.  Probably
also some i2c stuff.
2015-02-25 22:11:59 +00:00
riastradh
6e33c83b5f <linux/vgaarb.h> needs <sys/types.h> and <sys/errno.h>. 2015-02-25 21:55:30 +00:00
riastradh
5b8aff708e Another round of whack-a-mole with nouveau. 2015-02-25 17:29:42 +00:00
riastradh
9a2add20ac Add clamp to <linux/kernel.h>. 2015-02-25 15:50:16 +00:00
riastradh
91850c8312 Add hweight8 (hamming weight of 8-bit quantity). 2015-02-25 15:40:20 +00:00
riastradh
389d09bf31 Add kstrtol. 2015-02-25 15:11:07 +00:00
riastradh
13a0a37bad Add get_unaligned_le16, put_unaligned_le16. 2015-02-25 15:01:03 +00:00
riastradh
4dce353130 Another round of nouveau whack-a-mole.
Derived from a patch by chs@.
2015-02-25 14:57:04 +00:00
riastradh
a27e15b5f3 Linux's <asm/io.h> includes <linux/string.h>, so do so here. 2015-02-25 14:56:17 +00:00
riastradh
f6be41f847 Add kstrndup. 2015-02-25 14:55:57 +00:00
riastradh
2e2399fceb Add sizep argument to pci_platform_rom stub. 2015-02-25 14:51:22 +00:00
riastradh
5aee6af702 Add pci_platform_rom stub to <linux/pci.h>. 2015-02-25 14:50:51 +00:00
riastradh
0e971517c2 Add pci_enable_rom/pci_disable_rom to <linux/pci.h>. 2015-02-25 14:49:01 +00:00
riastradh
e1229b690d Add put_unaligned_le32 to Linux <asm/unaligned.h>. 2015-02-25 14:36:58 +00:00
riastradh
0aaf9d504a <linux/io-mapping.h> needs <sys/mman.h> for PROT_READ/WRITE.
From chs@.
2015-02-25 14:02:43 +00:00
riastradh
444a6bab41 Add string Linux module parameters.
Needed by nouveau.

From chs@.
2015-02-25 14:00:52 +00:00
riastradh
7f6d2a73ac Back-port attempt [2/2] to fix i915drmkms on G4X, from Linux.
commit 95468892fdfeef6d1004b524e35957629efdbe00
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Aug 7 15:39:54 2014 +0100

    drm/i915: Reset the HEAD pointer for the ring after writing START

    Ville found an old w/a documented for g4x that suggested that we need to
    reset the HEAD after writing START. This is a useful fixup for some of
    the g4x ring initialisation woes, but as usual, not all.

    v2: Do the rewrite unconditionally anyway
2015-02-25 13:35:25 +00:00
riastradh
df0f923a1e Back-port attempt [1/2] to fix i915drmkms on G4X, from Linux.
commit ece4a17d237a79f63fbfaf3f724a12b6d500555c
Author: Jiri Kosina <jkosina@suse.cz>
Date:   Thu Aug 7 16:29:53 2014 +0200

    drm/i915: read HEAD register back in init_ring_common() to enforce ordering

    Withtout this, ring initialization fails reliabily during resume with

        [drm:init_ring_common] *ERROR* render ring initialization failed ctl 000
1f001 head ffffff8804 tail 00000000 start 000e4000

    This is not a complete fix, but it is verified to make the ring
    initialization failures during resume much less likely.

    We were not able to root-cause this bug (likely HW-specific to Gen4 chips)
    yet. This is therefore used as a ducttape before problem is fully
    understood and proper fix created, so that people don't suffer from
    completely unusable systems in the meantime.

    The discussion and debugging is happening at

        https://bugs.freedesktop.org/show_bug.cgi?id=76554
2015-02-25 13:30:02 +00:00
riastradh
e5210032ca Initialize mchdev_lock earlier. Fixes i915drmkms boot on Ironlake.
Derived from a patch sent to me by degroote@ longer ago than I care
to admit.
2015-02-25 13:06:13 +00:00
alnsn
ca5348d86e Apply a bugfix from r282 http://sourceforge.net/p/sljit/code/282/.
The bug was originally reported by me in a newer upstream version.
American fuzzy lop rediscovered it for the version of sljit in the
NetBSD tree.
2015-02-16 13:33:24 +00:00
alnsn
af6353ef19 Backport a new testcase from r282 (registers are renamed in the new version).
http://sourceforge.net/p/sljit/code/282/.
2015-02-16 13:30:15 +00:00
mrg
c0a52feac5 fix the previous. bus_space_map() returns *zero* on success. 2015-02-16 12:17:57 +00:00
mrg
ae839ccccc add a ugly hack to avoid difficult to understand failures with
radeondrmkms on i386.  the problem is that the pcdisplay@isa
and vga@isa drivers rely on some other driver having already
mapped the vga registers to know they should not attach, but
radeondrmkms attaches late as it needs rootfs access, and it
does not map these registers, and either of vga or pcdisplay
will attach, and then attach wsdisplay0, and then getty and
X11 will fail and you shake a tiny fist at the computer.

so, for i386, map and unmap the VGA register space between
the normal attach and the mountroot attach.
2015-02-14 06:58:12 +00:00
chs
38a55106b3 revert rev 1.5, which brings back PR 48494.
that earlier revision itself reverted an upstream bugfix,
and that change fixed some systems but broke others
(in particular, it broke my HP Z800 workstation.)
this latest revision brings us back in sync with upstream.
the current upstream (and this latest flip-flop of our copy)
is clearly correct, since it zeros a buffer which is intended
to be used as scratch space for a single acpica operation.
agreed by christos and ryoon back in april 2014.
2015-02-09 03:16:33 +00:00
christos
7df88c51be fix ioctl cut-n-paste error 2015-02-06 19:24:12 +00:00
skrll
cbbec73b8e It turns out we needed to track pid all along, so revert the lwp tracking
I did ages ago.

quake has a chance of working now.
2015-01-28 09:41:04 +00:00
skrll
eae9e31ebb More count vs ret confusion. Need to send notification if count != 0. 2015-01-23 10:19:22 +00:00
chs
781ea102df initialize "addr" before passing its address to uvm_mmap_dev().
from Onno van der Linden in PR 49536.
2015-01-10 23:34:49 +00:00
riastradh
e04e273f56 Move Linux ww_mutex code into a .c file where it belongs. 2015-01-08 23:35:47 +00:00
mrg
1851f5322b apply a patch from rjs@, which is necessary for radeondrmkms on i386:
set DRM_FILE_PAGE_OFFSET to 0xa0000000UL for 32 bit platforms.
2015-01-05 06:28:34 +00:00
mrg
32b977d226 due to hangs seen by several folks, for now revert:
http://mail-index.netbsd.org/source-changes/2014/11/04/msg060120.html

Log Message:
This code should be MP-safe. Use IPL_SCHED in place of IPL_DRM/IPL_VM and set
D_MPSAFE flag in cdevsw.
2015-01-01 01:15:42 +00:00
mrg
1fa7346932 fix a confusion between dev_t and devmajor_t, and include the primary
minor when calling makedev().
2014-12-31 08:55:18 +00:00
nonaka
a8f2caddcc Also need to flush an object from CPU domain. 2014-12-30 09:58:53 +00:00
macallan
a32c0ca555 #include "opt_usb.h" 2014-12-23 16:20:06 +00:00
nat
549ebbf5aa Allow more space for temp string buffer in service stats display.
Fixes corrupted display when rx and tx count become large.
2014-12-20 19:49:27 +00:00