Commit Graph

62 Commits

Author SHA1 Message Date
bjorn3 e973f89139 Remove unnecessary feature gates
Some of these have been stabilized while others were likely no longer
used at all.
2025-02-22 14:38:33 +01:00
bjorn3 2c042f8c98 Fix a ton of unused import warnings 2024-12-26 16:05:04 +01:00
Andrey Turkin 18b688a49c Partial risc-v support 2024-10-17 20:07:17 +03:00
bjorn3 7935ed0248 Deduplicate setup_logging between all drivers
This will make it easier to change the way logging is done for all
drivers. This also fixes the log category for a couple of drivers as
well as makes failing to set the logger a fatal error. Only when a
logger is already set is it impossible to set another logger.
2024-07-24 22:00:40 +02:00
bjorn3 1a41bcab14 Enforce formatting in CI 2024-07-19 21:47:47 +02:00
Jeremy Soller e7781dcced Fix compilation on aarch64 2024-06-24 11:43:17 -06:00
bjorn3 fc9331b16a virtio: Remove legacy transport support
Transitional virtio devices (which have both legacy and virtio 1.0
support) have been the default since QEMU 2.7.0, which was released
8 years ago. Basically every non-commercial Linux distro with an older
QEMU has been EOL already.

The legacy transport is also one of the few places where port I/O is
necessary, which is non-trivial to sandbox even once we have IOMMU
support. As it isn't possible to distinguish legacy and modern virtio
devices for pcid, this would mean that all virtio drivers have to be
started as privileged even if it turns out the modern transport is
supported by the VMM.
2024-06-16 11:49:11 +02:00
bjorn3 359f4482dd virtio: Merge the x86 and x86_64 platform specific code 2024-06-15 21:59:10 +02:00
bjorn3 b6a75d0a16 virtio: Support the modern transport on x86 2024-06-15 21:59:10 +02:00
bjorn3 23ac696491 pcid: Add PciFunctionHandle::map_bar method
This will enable the pcid driver interface to safely map the MSI-X table
in the future without having to worry about a BAR being mapped twice.
2024-06-15 15:47:48 +02:00
bjorn3 a3b957c2e5 pcid: Fetch config in PciFunctionHandle::connect_default() 2024-06-15 15:16:09 +02:00
bjorn3 fdb9ea816b pcid: Rename PcidServerHandle to PciFunctionHandle 2024-06-15 15:05:59 +02:00
bjorn3 3299a070f2 pcid: Also return bar size from physmap_mem and use it in two more drivers 2024-06-15 14:01:06 +02:00
bjorn3 386a63df42 pcid: Replace get_capabilities with get_vendor_capabilities
While this stops returning raw MSI/MSI-X capabilities from
get_capabilities, the same info can be obtained using
fetch_all_features and feature_info.
2024-06-14 11:12:06 +02:00
bjorn3 dc33cba4c0 Fix typo 2024-06-11 21:05:09 +02:00
bjorn3 df66633111 pcid: Store decoded MsixInfo instead of full capability in PciFeatureInfo 2024-06-10 21:00:07 +02:00
bjorn3 588bbfe6a3 pcid: Stop returning feature enable status from fetch_all_features
For the same reason the feature_status method was removed.
2024-06-10 19:44:12 +02:00
4lDO2 4c35e88997 Use latest event queue interface everywhere. 2024-03-31 14:30:04 +02:00
Jeremy Soller ff7015a55a virtio-core: fix compilation on i686 2024-03-19 16:19:47 -06:00
Jacob Lorentzon ff956fd3bb Switch to libredox where applicable (fixed) 2024-03-18 22:09:25 +00:00
Jeremy Soller 98078650f8 Revert "Switch to libredox where applicable."
This reverts commit 2e7dbf1cc1.
2024-03-18 15:00:52 -06:00
4lDO2 2e7dbf1cc1 Switch to libredox where applicable. 2024-03-18 19:23:05 +01:00
bjorn3 9bb1222933 Fix UB lint in virtio-core
error: casting references to a bigger memory layout than the backing allocation is undefined behavior, even if the reference is unused
   --> virtio-core/src/probe.rs:126:21
    |
86  |         let capability = unsafe { &*(capability.data.as_ptr() as *const PciCapability) };
    |                                    --------------------------------------------------- backing allocation comes from here
...
126 |                     (&*(capability as *const PciCapability as *const PciCapabilityNotify))
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: casting from `transport_pci::PciCapability` (13 bytes) to `transport_pci::PciCapabilityNotify` (17 bytes)
    = note: `#[deny(invalid_reference_casting)]` on by default
2024-03-06 21:06:26 +01:00
Jeremy Soller 2c672a0568 More fixes for 32-bit x86 2024-02-16 20:58:54 -07:00
Jeremy Soller 2a4e292e1d virtio-core: mark CommonCfg as packed 2024-02-16 20:52:55 -07:00
Enver Balalic 7439262994 ihdad, rtl8139d, rtl8168d, virtio-core, xhcid: Fix aarch64 build 2024-02-10 19:03:36 +01:00
bjorn3 67d3015e2e Add helper for allocating a single MSI/MSI-X interrupt vector
It doesn't actually configure the device to emit it though, but does
make this easier to do.
2024-01-25 14:43:44 +01:00
bjorn3 9b809312c2 Ignore MSI-X PBA in all drivers
It isn't used in any driver and even on Linux no driver seems to use it
at all. The only times it seems to be useful are if you were to mask an
interrupt and want to check if the interrupt fired without unmasking or
if you want to make the device itself trigger an interrupt.
2024-01-24 14:28:40 +01:00
bjorn3 f43aa8574c Simplify MSI-X table pointer computation 2024-01-24 14:28:40 +01:00
bjorn3 7dbf22331b Share msix config validation code 2024-01-24 14:28:40 +01:00
bjorn3 77b97bb2ed Introduce PciBar::physmap_mem helper 2024-01-23 12:02:40 +01:00
bjorn3 a5d0c7c354 Use pci_types for reading BARs
This simplifies a lot of code and adds support for 64bit BARs.
2024-01-22 15:54:18 +01:00
bjorn3 5192816de7 Introduce expect_port and expect_mem helpers 2024-01-21 21:12:24 +01:00
bjorn3 d0e90f5ded Remove fetch_header from pcid_interface
Most things are already stored in SubdriverArguments and the couple of
things that aren't may change over time and thus should be read again
each time they are accessed, while fetch_header would receive a fixed
copy from pcid.
2024-01-21 19:35:39 +01:00
bjorn3 1890293e86 Introduce a FullDeviceId type and pass it in pcid_interface 2024-01-21 15:18:56 +01:00
bjorn3 fbcf01b413 Add a couple of FIXME 2024-01-18 19:03:10 +01:00
bjorn3 b06f0534aa Remove interrupt status register probing
It isn't used when MSI-X is used and we always use MSI-X interrupts.
2024-01-18 18:45:32 +01:00
bjorn3 fcc55507ea Move the notify_multiplier field into a separate PciCapabilityNotify type
It only exists for VIRTIO_PCI_CAP_NOTIFY_CFG and could conflict with
fields of other capability types.
2024-01-18 18:07:05 +01:00
bjorn3 380a416258 Reorganize virtio headers and add a couple of new fields
Also add a decent amount of comments from the virtio spec.
2024-01-18 17:17:39 +01:00
bjorn3 bd8b218174 Don't return Result from spawn_irq_thread
It never returns an error.
2024-01-18 15:29:06 +01:00
4lDO2 ea73da92bf Replace all physalloc usages with Dma. 2023-12-12 12:03:03 +01:00
4lDO2 0d99333c3f Remove PhysBox. 2023-12-12 12:03:03 +01:00
Jeremy Soller 82fe14960f Fix build on x86 2023-11-08 09:54:27 -07:00
Enver Balalic ad9295715f virtio-core: move things around so aarch64 builds 2023-10-19 15:01:01 +00:00
Jeremy Soller 9d7e19cc0d Merge branch 'core' into 'master'
virtio-core: add support for legacy transport

See merge request redox-os/drivers!112
2023-08-23 12:26:44 +00:00
Anhad Singh 6a5e9d2613 virtio-core: add support for legacy transport
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2023-08-23 15:03:46 +10:00
Jeremy Soller ac9e4abcd0 virtio-core: Fix compilation on non-x86_64 2023-08-21 09:21:35 -06:00
Anhad Singh 820b8370ae virtio-gpu: remove the +1 workaround
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2023-07-25 16:34:25 +10:00
Anhad Singh a153c8bc1c inputd: correctly pass on resize events
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2023-07-20 19:20:56 +10:00
Anhad Singh e457f03935 virtio-gpu: handling GPU resets
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2023-07-20 17:34:59 +10:00