Commit graph

8041 commits

Author SHA1 Message Date
cinap_lenrek 6f15a730f3 merge 2020-11-04 23:09:47 +01:00
cinap_lenrek 6cc223ee56 pc/pc64: fix faulty mtrr slot reuse (thanks Fulton)
The change 3306:c5cf77167bfe made the code reuse MTRR slots
of the default memory type.

But this did not take overlapping ranges into account!

If two or more variable-range MTRRs overlap, the following rules apply:

a.	If the memory types are identical, then that memory type is used.
b.	If at least one of the memory types is UC, then UC memory type is used.
c.	If at least of of the memory types is WT. and the only other memory type
	is WB, then th WT memory type is used.
d.	If the combination of memory types is not listed above,
	then the memory type used in undefined.

It so happend that on a Dell Latitude E7450 that the BIOS defines
the default type as UC. and the first slot defines a 16GB range
of type WB. Then the rest of the ranges mark the PCI space back
as UC, but overlapping the first WB range! This works because
of rule (B) above.

When trying to make the framebuffer write-combining, we would
falsely reuse one of the UC sub-ranges and making the UC memory
into WB as a side effect.

Thanks to Fulton for his patience and providing debug logs and
doing experiments for us to narrow the problem down.
2020-11-04 23:08:52 +01:00
cinap_lenrek 9cca88895e merge 2020-11-03 20:47:14 +01:00
cinap_lenrek 0ba91ae22a pc, pc64: allocate i/o port space for unassigned pci bars, move ioalloc() to port/iomap.c
With some newer UEFI firmware, not all pci bars get
programmed and we have to assign them ourselfs.

This was already done for memory bars. This change
adds the same for i/o port space, by providing a
ioreservewin() function which can be used to allocate
port space within the parent pci-pci bridge window.

Also, the pci code now allocates the pci config
space i/o ports 0xCF8/0xCFC so userspace needs to
use devpnp to access pci config space now. (see
latest realemu change).

Also, this moves the ioalloc()/iofree() code out
of devarch into port/iomap.c as it can be shared
with the ppc mtx kernel.
2020-11-03 20:46:09 +01:00
Ori Bernstein 97de3f67c2 upas/common: delete library on 'mk clean'
libcommon.a$O doesn't end with a .a, so mk
doesn't know how to look inside it in order
to check if the files are up to date.

This means that when 'mk clean' is run,
libcommon.a$O looks up to date:

	% mk clean
	...
	% mk
	mk: 'default' is up to date

Deleting the library works around this problem.
2020-11-02 13:12:34 -08:00
cinap_lenrek aad55ccc2d mtx: fix pci access routines (see changeset 8012:78891f472fbf) 2020-11-02 20:53:20 +01:00
Ori Bernstein 33fb16c9fe profile: don't create $wsys if it doesn't exist
When $wsys doesn't exist (eg, drawterm -G, or
rcpu from a text console), the profile would
create an empty $wsys variable, and sessions
started in this environment would fail with a
null list in concatenation.

This change tests if /mnt/term/env/wsys exists
before assigning it.
2020-11-02 08:29:05 -08:00
Sigrid f4d2067373 audio/wavdec: add -s option 2020-11-02 11:46:50 +01:00
cinap_lenrek a4c6dc1d3d aux/realemu: use #$/pci/B.D.Fraw to access pci config space
This prevents VESA bios from accessing the pci
CONFIG_ADDRESS/CONFIG_DATA registers (0xCF8/0xCFC)
directly to access pci config space.

This makes sure the access to pci config space is
properly serialized by the kernel.
2020-11-02 01:14:30 +01:00
cinap_lenrek 2063019560 vmx: mask out bits 0:2 and 24:30 of pci CONFIG_ADDRESS on read
These bits are reserved, and by the specification,
must return zero on read.

This is also used by plan 9 for detecting config mode #1.
2020-11-02 01:01:48 +01:00
Ori Bernstein d75d842cf5 rc: show line numbers on error
This change provides a location for errors
like 'null list in concatenation'.
2020-11-01 11:56:26 -08:00
Ori Bernstein dbd54342fd libbio: add aux pointer to bio
This allows us to attach additional context
to the biobuf so can read from some sort of
data structure without a global variable.
2020-11-01 11:42:54 -08:00
Ori Bernstein b5086c1863 libc: recurse on smaller half of array
Our qsort has an optimization to recurse on one
half of the array, and do a tail call on the other
half. Unfortunately, the condition deciding which
half of the array to recurse on was wrong, so we
were recursing on the larger half of the array and
iterating on the smaller half.

This meant that if we picked the partition poorly,
we were pessimizing our stack usage instead of
optimizing it.

This change reduces our stack usage from O(n)
to O(log(n)) for poorly chosen pivots.
2020-11-01 11:23:39 -08:00
Alex Musolino 51b22d8548 jpg: treat EOF as EOI marker
Some jpegs, rightly or wrongly, do not contain an EOI marker.  This
causes jpg(1) to bail out even after correctly parsing the entire
image.
2020-10-31 15:44:49 +10:30
Ori Bernstein 31eb1b9d72 vt: improve behavior of chording
vt chording behaves slightly differently from other
applications: a chord must be fully released before
the next chord can be applied. This makes any change
in chord apply the action.
2020-10-30 13:23:16 -07:00
cinap_lenrek 5f2cf12f38 ip/cifsd: fix missing int return type for vpack() (thanks pr) 2020-10-29 18:26:35 +01:00
Sigrid d541c7bfd3 aux/cpuid: decode leaf 7; extend leaf 13 decoding 2020-10-29 11:27:26 +01:00
cinap_lenrek 0205392410 audiohda: make it work with qemu (thanks mischief)
the driver was not using irb interrupts
and was just polling the irb write pointer
to wait for command completion.

this is not supported by qemu.

qemu requires the use of irb interrupt handshake
and it refuses to accept the next command until we
acknowledge the irb interrupt.
2020-10-27 15:16:03 +01:00
cinap_lenrek 950d970671 ip/tinc: fix reportedge()
supplying a non-ip address in ADD_EDGE crashes the unix tincd.

the reason was that we where misreporting ADD_EDGE messages;
ignoring the information from our peers; and always supplying
the Address string from our configuration instead of the
connections ip address.

now we just report the edge information as is.
2020-10-25 22:27:30 +01:00
Ori Bernstein 9bb519ac50 mp(2): correct documentation of error handling (thanks LordCreepity)
The documentation for mp(2) claimed we'd return nil on error, when
we actually sysfatal. This corrects the documentation to match our
actual behavior.
2020-10-24 17:24:59 -07:00
cinap_lenrek d9f201af49 kbmap: add latvian keymap (thanks freddy) 2020-10-25 00:49:29 +02:00
cinap_lenrek be32b44a9a kbmap: add croatian kbmap (thanks skerbergs) 2020-10-25 00:46:56 +02:00
Alex Musolino ebd23e51eb newuser(8): fix reference to incorrect file server console command 2020-10-23 17:51:03 +10:30
Sigrid 55945f6f24 vmx/vga: fix allocimage leaks 2020-10-23 00:16:47 +02:00
khm 19273fdee3 upas/fs/mbox.c: fix cosmetic typo 2020-10-22 13:46:00 -07:00
Sigrid 797a5ac470 libaml: add (nop) "signal" op 2020-10-21 12:06:25 +02:00
Ori Bernstein 78bed738e1 vncv: pick an auth type that we support
We used to pick the highest auth type regardless of whether
we supported it. Now we filter down to types that we support.
2020-10-18 19:30:14 -07:00
cinap_lenrek 87385accde sdiahci: accept AHCI controllers from ASMedia vendor id (thanks mischief) 2020-10-19 01:20:29 +02:00
cinap_lenrek a5764f8181 pc, pc64: remove mystery "type" bits in pcicfgrw*raw() (fixes qemu, thanks mischief)
the access functions for pci config space in config mode #1
used to set bit 0 in the register offset if the access was
to a device on any bus different from 0.

it is completely unclear why this was done and i can't find
any documentation on this.

but for sure, this breaks all pci config spacess access to
pci devices behind a bridge on qemu. with -trace pci* it
was discovered that all config space register offsets on
devies behind pci brige where off by one.

on real hardware, setting bit 0 in the offset doesnt appear
to be an issue.

thanks mischief for reporting and providing a qemu demo
configuration to reproduce the problem.
2020-10-18 23:39:07 +02:00
cinap_lenrek d1604b5f9c sdnvme: use PCIWADDR() instead of PADDR() 2020-10-18 17:02:42 +02:00
cinap_lenrek 96e9f3707c etherbcm: handle 64-bit host addresses, use PCIWADDR() instead of PADDR() 2020-10-18 17:01:50 +02:00
cinap_lenrek 30417c12fd audiohda: use PCIWADDR() instead of PADDR(), handle 64-bit dma addresses 2020-10-18 17:00:04 +02:00
Ori Bernstein 83efe2f157 etheriwl: delay before crystal calibration
On my 6235 card, if we calibrate the crystal
immediately after disabling wimax, the the
firmware gets unhappy. A short nap before
sending the command prevents the command from
timing out.
2020-10-18 10:50:07 -04:00
Ori Bernstein 98c07541bb nusb/serial: add ids for FT230X (thanks mischief) 2020-10-17 19:27:21 -07:00
Ori Bernstein 90601f6e47 merge 2020-10-17 19:04:17 -07:00
Ori Bernstein a41b74059b upas: fix appendfolder timestamps (thanks umbraticus)
When moving messages between folders, mbappend,
deliver, and nedmail were trying to parse the
timestamp ouut of the message. They were doing
it incorrectly, trying to include the user name
as part of the date format.

Change to pass just the date to the date parser.
2020-10-17 18:59:36 -07:00
cinap_lenrek 3cfa8326b8 etheriwl: don't break controller on command flush timeout
ori and echoline are reporting regression on some 6000 cards;
which sometimes time out on crystal calibration command;
which is expected by the driver. but the new code used
to force a device reset on any command timeout.

reverting to old behaviour until for now until we have
a chance investigating.
2020-10-18 03:05:35 +02:00
cinap_lenrek cf8ff0e713 sdnvme: handle machines with more cpu's than submit queues (thanks mischief)
We used to assume a 1:1 pairing of processors to submit queues.
With recent machines, we now got more cpu cores than what some
nvme drives support so we need to distribute the queues across
these cpu's which requires locking on command submission.

There is a feature get/set command to probe the number of submit
and completion queues, but we decided to just handling
submission queue create command error gracefully as it is simpler
and has less chance of regression with existing setups.

Thanks to mischief for investigating and writing the code.
2020-10-18 02:51:32 +02:00
cinap_lenrek 5fd2e746e1 merge 2020-10-17 21:30:10 +02:00
cinap_lenrek 0b094303f3 ndb/dnsdebug: add -c flag to debug caching dns server behaviour 2020-10-17 21:28:56 +02:00
cinap_lenrek bf18724738 ndb/dns: mark ns record authoritative when in our area for delegation
I have the problem that i need to delegate a subdomain
to another name server that is confused about its own zone
(and its own name) returning unusable ns records.

With this, one can make up a nameserver entry in ndb that
is authoritative and owned by us for that nameserver,
and then put it in the soa=delegated ns entry.

This promotes the ns record in the soa=delegated to
Authoritative, which avoids overriding the ns rr's from
the confused server for the delegated zone.
2020-10-17 21:28:25 +02:00
Sigrid dfbf774bbb games/nes: workaround for truncated chr 2020-10-15 10:30:40 +02:00
cinap_lenrek d310da13ba ip/torrent: try harder allocating ports
we used to only allocate ports from 6881 to 6890,
which limits the maximum of parallel torrents to 9.

this change make it go up to 9000, which gives us
at best 2120 ports, which is overkill but ports might
be randomly occupied by other connections.
2020-10-12 02:03:52 +02:00
cinap_lenrek 3e880cd07d upas/fs: fix truncation of plumb date
the new date format introduced by the previous commit;
using numeric timezone offsets; needs one character more,
so increase the date format buffer to 31 characters.
2020-10-11 14:59:49 +02:00
cinap_lenrek c7598b18f3 kernel: get rid of unused ucallocb
the whole idea of a ucallocb() is bad, as even access to the
metadata header would be in uncached memory. also, it tuns out
that it was never used by anyone.
2020-10-09 22:05:32 +02:00
Sigrid 4a75ad5ec8 vmx: add Kmod4 2020-10-09 16:47:34 +02:00
Ori Bernstein 53234798c0 etheriwl: add Wireless 8260 card
After the latest tweaks to the order of operations,
the card works.
2020-10-05 14:10:12 -07:00
cinap_lenrek 204a96f163 merge 2020-10-05 22:43:25 +02:00
cinap_lenrek d49b9e1b84 etheriwl: remove stations *after* disabling binding quotas, drain all queues in rxoff7000() 2020-10-05 22:42:13 +02:00
kvik 6f76d00300 rio: move the code for 'send' into a function
Makes the code a bit nicer and allows reusing wsend() in patches.
2020-10-04 22:45:22 +02:00