The NetBSD Project

CVS log for src/sys/dev/pci/virtio_pci.c

[BACK] Up to [cvs.NetBSD.org] / src / sys / dev / pci

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.38 / (download) - annotate - [select for diffs], Mon May 30 20:28:18 2022 UTC (8 months ago) by riastradh
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10, bouyer-sunxi-drm-base, bouyer-sunxi-drm, HEAD
Changes since 1.37: +7 -6 lines
Diff to previous 1.37 (colored)

virtio at pci: Provide attribution in debug message.

Also make it only happen in the error case so success doesn't clutter
up the console output.

Revision 1.37 / (download) - annotate - [select for diffs], Wed Apr 13 22:41:17 2022 UTC (9 months, 3 weeks ago) by uwe
Branch: MAIN
Changes since 1.36: +4 -4 lines
Diff to previous 1.36 (colored)

virtio_pci: Don't use a cast for upcasting.

Same object code is generated.

Revision 1.36 / (download) - annotate - [select for diffs], Thu Mar 17 23:05:01 2022 UTC (10 months, 2 weeks ago) by uwe
Branch: MAIN
Changes since 1.35: +12 -11 lines
Diff to previous 1.35 (colored)

virtio_pci_bus_space_write_8: don't use bus_space_write_8.

The standard says:

  4.1.3.1 Driver Requirements: PCI Device Layout

  For device configuration access, the driver MUST use ... 32-bit
  wide and aligned accesses for ... 64-bit wide fields.  For 64-bit
  fields, the driver MAY access each of the high and low 32-bit parts
  of the field independently.

NB: "MAY" in this text refers to "independently" (i.e. the order of
accesses) not "32-bit" (which is restricted by the earlier "MUST").

Note also that virtio_{read,write}_device_config_8 in virtio.c already
uses two 32-bit accesses.

Revision 1.35 / (download) - annotate - [select for diffs], Thu Mar 17 22:53:13 2022 UTC (10 months, 2 weeks ago) by uwe
Branch: MAIN
Changes since 1.34: +3 -3 lines
Diff to previous 1.34 (colored)

virtio_pci.c: use PCI_BAR macro instead of open-coding it.

Revision 1.34 / (download) - annotate - [select for diffs], Mon Mar 14 12:22:02 2022 UTC (10 months, 3 weeks ago) by uwe
Branch: MAIN
Changes since 1.33: +9 -2 lines
Diff to previous 1.33 (colored)

virtio_pci_match: add TODO about PCI Revision ID.

The standard says:

  Transitional devices MUST have a PCI Revision ID of 0.

  Non-transitional devices SHOULD have a PCI Revision ID of 1 or higher.
  Drivers MUST match any PCI Revision ID value.

so we must not check the revision id for non-transitional devices.
The code in attach relies on the revision being specifically(NB!) 1 so
this calls for a revision, but I can't test this properly at the
moment, so just leave a reminder.  Comment change only.

Revision 1.33 / (download) - annotate - [select for diffs], Thu Oct 28 01:36:43 2021 UTC (15 months, 1 week ago) by yamaguchi
Branch: MAIN
Changes since 1.32: +23 -20 lines
Diff to previous 1.32 (colored)

virtio: stop reinit for safety when a device resetting is failed

Revision 1.32 / (download) - annotate - [select for diffs], Thu Oct 21 05:37:43 2021 UTC (15 months, 1 week ago) by yamaguchi
Branch: MAIN
Changes since 1.31: +22 -12 lines
Diff to previous 1.31 (colored)

virtio: reconfigure MSI-X vector on re-initialization

This may fix a problem that some interrupts, for example
link-state change of vioif(4) are not notified.

Revision 1.31 / (download) - annotate - [select for diffs], Thu Oct 21 05:32:27 2021 UTC (15 months, 1 week ago) by yamaguchi
Branch: MAIN
Changes since 1.30: +36 -27 lines
Diff to previous 1.30 (colored)

divide setup routine of virtio interrupts
into establishment and device configuration

Revision 1.30 / (download) - annotate - [select for diffs], Sat Aug 7 16:19:14 2021 UTC (17 months, 3 weeks ago) by thorpej
Branch: MAIN
CVS Tags: thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2
Changes since 1.29: +3 -3 lines
Diff to previous 1.29 (colored)

Merge thorpej-cfargs2.

Revision 1.29.8.1 / (download) - annotate - [select for diffs], Wed Aug 4 21:27:00 2021 UTC (17 months, 4 weeks ago) by thorpej
Branch: thorpej-cfargs2
Changes since 1.29: +3 -3 lines
Diff to previous 1.29 (colored) next main 1.30 (colored)

Adapt to CFARGS().

Revision 1.29 / (download) - annotate - [select for diffs], Sat Apr 24 23:36:57 2021 UTC (21 months, 1 week ago) by thorpej
Branch: MAIN
CVS Tags: thorpej-i2c-spi-conf-base, thorpej-i2c-spi-conf, thorpej-futex2-base, thorpej-futex2, thorpej-cfargs2-base, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Branch point for: thorpej-cfargs2
Changes since 1.28: +5 -5 lines
Diff to previous 1.28 (colored)

Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
  actually needed.
- Don't be explicit about what interface attribute is attaching if
  the device only has one.  (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
  situations, making is visibly easier to see when indirect config is
  in play, and allowing for future change in semantics.  (As of now,
  this is just a wrapper around config_match(), but that is an
  implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance.  This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).

Revision 1.14.2.1 / (download) - annotate - [select for diffs], Sat Apr 3 22:28:49 2021 UTC (22 months ago) by thorpej
Branch: thorpej-futex
Changes since 1.14: +612 -226 lines
Diff to previous 1.14 (colored) next main 1.15 (colored)

Sync with HEAD.

Revision 1.28.2.1 / (download) - annotate - [select for diffs], Sat Mar 27 01:41:43 2021 UTC (22 months, 1 week ago) by thorpej
Branch: thorpej-cfargs
Changes since 1.28: +5 -5 lines
Diff to previous 1.28 (colored) next main 1.29 (colored)

- config_found_ia() -> config_found().
- virtio only carries a single interface attribute, so no need to
  specify it explicitly.

Revision 1.28 / (download) - annotate - [select for diffs], Fri Feb 5 19:18:23 2021 UTC (23 months, 3 weeks ago) by reinoud
Branch: MAIN
CVS Tags: thorpej-futex-base, thorpej-cfargs-base
Branch point for: thorpej-cfargs
Changes since 1.27: +4 -11 lines
Diff to previous 1.27 (colored)

Second round of cleaning up endian code. No more tailored code to maintain.

Revision 1.27 / (download) - annotate - [select for diffs], Thu Jan 28 15:43:12 2021 UTC (2 years ago) by reinoud
Branch: MAIN
Changes since 1.26: +35 -247 lines
Diff to previous 1.26 (colored)

Rewrite and streamline virtio device config read/write and explicitly cater
for the Aarch64-eb bus problem with Qemu. This removes lots of bus_space
`magic' and cleans up the code.

Revision 1.26 / (download) - annotate - [select for diffs], Tue Jan 26 16:40:16 2021 UTC (2 years ago) by reinoud
Branch: MAIN
Changes since 1.25: +7 -7 lines
Diff to previous 1.25 (colored)

Fix indexing bug in clean up code on error in virtio PCI v1.0 attach code.
Thanks go to Rin Okuyama for spotting it.

Revision 1.25 / (download) - annotate - [select for diffs], Sun Jan 24 15:59:35 2021 UTC (2 years ago) by reinoud
Branch: MAIN
Changes since 1.24: +2 -8 lines
Diff to previous 1.24 (colored)

Remove incorrect comment. It would violate the specs.

VirtIO PCI v1.0 attachments can only happen on revision 1 devices as they have
a radical different register layout. Transitional devices have to use revision
0 and have to use the VirtIO PCI v0.9 attachment method but can allow for
features to be negotiated normally found in later versions.

Revision 1.24 / (download) - annotate - [select for diffs], Sun Jan 24 15:34:07 2021 UTC (2 years ago) by thorpej
Branch: MAIN
Changes since 1.23: +16 -14 lines
Diff to previous 1.23 (colored)

Redefining bus_space functions in drivers is a bad idea, and we just
should't be in the habit of doing so.  Besides, the previous "solutions"
still did not compile correctly, and this does, so let's be done with
this nonsense, shall we?

Revision 1.23 / (download) - annotate - [select for diffs], Sun Jan 24 15:33:02 2021 UTC (2 years ago) by reinoud
Branch: MAIN
Changes since 1.22: +9 -3 lines
Diff to previous 1.22 (colored)

On error unmap the pci_mapreg_map()d regions using bus_space_unmap() as
suggested by jak@

Revision 1.22 / (download) - annotate - [select for diffs], Sun Jan 24 14:33:49 2021 UTC (2 years ago) by reinoud
Branch: MAIN
Changes since 1.21: +5 -4 lines
Diff to previous 1.21 (colored)

Move definition of NMAPREG to the start

Revision 1.21 / (download) - annotate - [select for diffs], Sun Jan 24 14:12:36 2021 UTC (2 years ago) by reinoud
Branch: MAIN
Changes since 1.20: +5 -5 lines
Diff to previous 1.20 (colored)

Prevent potential buffer over runs in number of BARS

Revision 1.20 / (download) - annotate - [select for diffs], Sun Jan 24 01:44:11 2021 UTC (2 years ago) by christos
Branch: MAIN
Changes since 1.19: +8 -2 lines
Diff to previous 1.19 (colored)

Add a comment explaining why bus_space_write_8 is limited to virtio.

Revision 1.19 / (download) - annotate - [select for diffs], Sat Jan 23 20:00:19 2021 UTC (2 years ago) by christos
Branch: MAIN
Changes since 1.18: +23 -12 lines
Diff to previous 1.18 (colored)

Provide a generic bus_space_write_8 function that is bi-endian.

Revision 1.18 / (download) - annotate - [select for diffs], Thu Jan 21 20:48:33 2021 UTC (2 years ago) by reinoud
Branch: MAIN
Changes since 1.17: +17 -8 lines
Diff to previous 1.17 (colored)

Remove dependency on bus_space_write_8() for i386 and instead implement it as
two bus_space_write_4()'s as allowed in the spec.

Revision 1.17 / (download) - annotate - [select for diffs], Thu Jan 21 08:17:13 2021 UTC (2 years ago) by martin
Branch: MAIN
Changes since 1.16: +5 -4 lines
Diff to previous 1.16 (colored)

Use PRIxBUSSIZE to print a bus_size_t value.

Revision 1.16 / (download) - annotate - [select for diffs], Wed Jan 20 21:59:48 2021 UTC (2 years ago) by reinoud
Branch: MAIN
Changes since 1.15: +2 -8 lines
Diff to previous 1.15 (colored)

Remove the virtio child driver finalisation check KASSERT that, while it
should never trigger, a possible bug in a child driver shouldn't have to panic
the kernel. Instead report the internal error.

Revision 1.15 / (download) - annotate - [select for diffs], Wed Jan 20 19:46:48 2021 UTC (2 years ago) by reinoud
Branch: MAIN
Changes since 1.14: +739 -158 lines
Diff to previous 1.14 (colored)

Add VirtIO PCI v1.0 attachments and fix the drivers affected.

The vioif, ld, scsi, viornd and viomb devices were adjusted when needed and
tested both in legacy 0.9 and v1.0 attachments trough PCI on amd64, sparc64,
aarch64 and aarch64-eb. ACPI/FDT attachments also tested on
aarch64/aarch64-eb.

Known issues

* viomb on aarch64 works only with ACPI/FDT attachment but not with PCI
  attachment. PCI and ACPI/FDT attachment works on aarch64-eb.

* virtio on sparc64 attaches but is it not functioning though not a
  regression.

Revision 1.14 / (download) - annotate - [select for diffs], Wed Sep 23 13:45:14 2020 UTC (2 years, 4 months ago) by jakllsch
Branch: MAIN
Branch point for: thorpej-futex
Changes since 1.13: +3 -3 lines
Diff to previous 1.13 (colored)

whitespace fix

Revision 1.7.4.2 / (download) - annotate - [select for diffs], Sun Sep 20 10:16:50 2020 UTC (2 years, 4 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE
Changes since 1.7.4.1: +12 -2 lines
Diff to previous 1.7.4.1 (colored) to branchpoint 1.7 (colored) next main 1.8 (colored)

Pull up following revision(s) (requested by jakllsch in ticket #1090):

	sys/dev/pci/virtio_pci.c: revision 1.13

Ensure MSI-X is disabled if allocation of MSI-X interrupts fail.

The virtio device config space moves out from under us when MSI-X
remains enabled, and/or INTx interrupts are masked if we don't ensure
this.

This un-breaks virtio devices that run out of MSI-X interrupts.
Particularly a problem on uniproc x86, where there are only 8 or 9
vectors available, allowing for only about 4 virtio devices to use
MSI-X.

Revision 1.7.4.1 / (download) - annotate - [select for diffs], Sun Sep 20 10:03:11 2020 UTC (2 years, 4 months ago) by martin
Branch: netbsd-9
Changes since 1.7: +4 -4 lines
Diff to previous 1.7 (colored)

Pull up following revision(s) (requested by jakllsch in ticket #1089):

	sys/dev/pci/virtio_pci.c: revision 1.12

Ensure interrupt handles buffer is zeroed on allocation
Prevents crashes trying to deallocate interrupts at shutdown.

Found by kim and mlelstv, confirmed by me

Revision 1.13 / (download) - annotate - [select for diffs], Thu Sep 17 17:33:50 2020 UTC (2 years, 4 months ago) by jakllsch
Branch: MAIN
Changes since 1.12: +12 -2 lines
Diff to previous 1.12 (colored)

Ensure MSI-X is disabled if allocation of MSI-X interrupts fail.

The virtio device config space moves out from under us when MSI-X
remains enabled, and/or INTx interrupts are masked if we don't ensure
this.

This un-breaks virtio devices that run out of MSI-X interrupts.
Particularly a problem on uniproc x86, where there are only 8 or 9
vectors available, allowing for only about 4 virtio devices to use
MSI-X.

Revision 1.12 / (download) - annotate - [select for diffs], Thu Sep 17 17:04:31 2020 UTC (2 years, 4 months ago) by jakllsch
Branch: MAIN
Changes since 1.11: +4 -4 lines
Diff to previous 1.11 (colored)

Ensure interrupt handles buffer is zeroed on allocation

Prevents crashes trying to deallocate interrupts at shutdown.

Found by kim and mlelstv, confirmed by me

Revision 1.11 / (download) - annotate - [select for diffs], Wed May 27 11:24:31 2020 UTC (2 years, 8 months ago) by yamaguchi
Branch: MAIN
Changes since 1.10: +9 -5 lines
Diff to previous 1.10 (colored)

Fix to allocate resources actuall used around interrupts

Revision 1.10 / (download) - annotate - [select for diffs], Mon May 25 07:52:16 2020 UTC (2 years, 8 months ago) by yamaguchi
Branch: MAIN
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored)

Set handlers implemented in child device of virtio(4) to virtqueue
instead of the commonized function

Revision 1.9 / (download) - annotate - [select for diffs], Mon May 25 07:37:47 2020 UTC (2 years, 8 months ago) by yamaguchi
Branch: MAIN
Changes since 1.8: +5 -14 lines
Diff to previous 1.8 (colored)

Register an interrupt handler for virtqueue to that for pci
to reduce function call

Revision 1.8 / (download) - annotate - [select for diffs], Mon May 25 07:29:52 2020 UTC (2 years, 8 months ago) by yamaguchi
Branch: MAIN
Changes since 1.7: +4 -11 lines
Diff to previous 1.7 (colored)

Remove VIRTIO_F_PCI_INTR_SOFTINT support for multiqueue

The functionality is no longer used by obsolating VIOIF_SOFTINT_INTR.

Revision 1.5.2.1 / (download) - annotate - [select for diffs], Mon Jun 10 22:07:27 2019 UTC (3 years, 7 months ago) by christos
Branch: phil-wifi
Changes since 1.5: +116 -22 lines
Diff to previous 1.5 (colored) next main 1.6 (colored)

Sync with HEAD

Revision 1.7 / (download) - annotate - [select for diffs], Sun Jan 27 02:08:42 2019 UTC (4 years ago) by pgoyette
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, phil-wifi-20190609, netbsd-9-base, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, isaki-audio2-base, isaki-audio2, is-mlppp-base, is-mlppp, bouyer-xenpvh-base2, bouyer-xenpvh-base1, bouyer-xenpvh-base, bouyer-xenpvh, ad-namecache-base3, ad-namecache-base2, ad-namecache-base1, ad-namecache-base, ad-namecache
Branch point for: netbsd-9
Changes since 1.6: +2 -3 lines
Diff to previous 1.6 (colored)

Merge the [pgoyette-compat] branch

Revision 1.2.2.2 / (download) - annotate - [select for diffs], Fri Jan 18 08:50:42 2019 UTC (4 years ago) by pgoyette
Branch: pgoyette-compat
CVS Tags: pgoyette-compat-merge-20190127
Changes since 1.2.2.1: +116 -21 lines
Diff to previous 1.2.2.1 (colored) to branchpoint 1.2 (colored) next main 1.3 (colored)

Synch with HEAD

Revision 1.6 / (download) - annotate - [select for diffs], Mon Jan 14 14:55:37 2019 UTC (4 years ago) by yamaguchi
Branch: MAIN
CVS Tags: pgoyette-compat-20190127, pgoyette-compat-20190118
Changes since 1.5: +116 -21 lines
Diff to previous 1.5 (colored)

Add multiqueue support, virtio(4)

Revision 1.2.2.1 / (download) - annotate - [select for diffs], Mon Jun 25 07:26:01 2018 UTC (4 years, 7 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.2: +585 -30 lines
Diff to previous 1.2 (colored)

Sync with HEAD

Revision 1.5 / (download) - annotate - [select for diffs], Wed Jun 6 16:11:36 2018 UTC (4 years, 7 months ago) by jakllsch
Branch: MAIN
CVS Tags: phil-wifi-base, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, jdolecek-ncqfixes-base, jdolecek-ncqfixes
Branch point for: phil-wifi
Changes since 1.4: +34 -2 lines
Diff to previous 1.4 (colored)

fix up virtio module for current structure; add virtio_pci module

Revision 1.4 / (download) - annotate - [select for diffs], Sat Jun 2 22:43:15 2018 UTC (4 years, 8 months ago) by jakllsch
Branch: MAIN
Changes since 1.3: +553 -30 lines
Diff to previous 1.3 (colored)

Begin to detangle virtio from its PCI attachment

Revision 1.3 / (download) - annotate - [select for diffs], Sat Jun 2 13:30:32 2018 UTC (4 years, 8 months ago) by jakllsch
Branch: MAIN
Changes since 1.2: +2 -2 lines
Diff to previous 1.2 (colored)

fix CVS keyword in __KERNEL_RCSID

Revision 1.2 / (download) - annotate - [select for diffs], Thu Feb 15 19:05:10 2018 UTC (4 years, 11 months ago) by uwe
Branch: MAIN
CVS Tags: pgoyette-compat-base, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315
Branch point for: pgoyette-compat
Changes since 1.1: +6 -1 lines
Diff to previous 1.1 (colored)

Explicitly enable PCI_COMMAND_MASTER_ENABLE and PCI_COMMAND_IO_ENABLE.
Recent versions of VirtualBox do not enable bus-mastering by default -
this will be fixed, but it doesn't hurt to do it ourselves too.

Revision 1.1.4.2 / (download) - annotate - [select for diffs], Sun Dec 3 11:37:29 2017 UTC (5 years, 2 months ago) by jdolecek
Branch: tls-maxphys
Changes since 1.1.4.1: +201 -0 lines
Diff to previous 1.1.4.1 (colored) to branchpoint 1.1 (colored) next main 1.2 (colored)

update from HEAD

Revision 1.1.2.2 / (download) - annotate - [select for diffs], Mon Aug 28 17:52:25 2017 UTC (5 years, 5 months ago) by skrll
Branch: nick-nhusb
Changes since 1.1.2.1: +201 -0 lines
Diff to previous 1.1.2.1 (colored) to branchpoint 1.1 (colored) next main 1.2 (colored)

Sync with HEAD

Revision 1.1.4.1, Wed Aug 2 08:39:14 2017 UTC (5 years, 6 months ago) by jdolecek
Branch: tls-maxphys
Changes since 1.1: +0 -201 lines
FILE REMOVED

file virtio_pci.c was added on branch tls-maxphys on 2017-12-03 11:37:29 +0000

Revision 1.1.2.1, Wed Aug 2 08:39:14 2017 UTC (5 years, 6 months ago) by skrll
Branch: nick-nhusb
Changes since 1.1: +0 -201 lines
FILE REMOVED

file virtio_pci.c was added on branch nick-nhusb on 2017-08-28 17:52:25 +0000

Revision 1.1 / (download) - annotate - [select for diffs], Wed Aug 2 08:39:14 2017 UTC (5 years, 6 months ago) by cherry
Branch: MAIN
CVS Tags: tls-maxphys-base-20171202, nick-nhusb-base-20170825
Branch point for: tls-maxphys, nick-nhusb

Reorg the virtio(4) config(9) code to be explicitly pci specific.

We'll later use this for a non-pci virtio(4) usecase.

ok martin

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>