5 Commits
Author SHA1 Message Date
Ayush RanjanandgVisor bot 32d34dc396 Update nvidia_driver_differ to also check ioctl numbers.
Updated the tooling to fetch the ioctl number used in the driver source code
and compare it to the one used in nvproxy. It is possible that ioctl numbers
change across driver versions (under our foot). It is imperative that we mimic
these changes in nvproxy. For example, in 575.57.08 driver release,
NV2080_CTRL_CMD_FB_QUERY_DRAM_ENCRYPTION_INFOROM_SUPPORT changed from
0x20801358 to 0x20801357.

To achieve this effect, the AST parser has been updated in the previous change
to be able to parse numerical constants. However, it is unable to parse macros
that evaluate to constants (trust me, I tried). So as a workaround, the
nvidia_driver_differ declares "const uint64_t" variables in the source file
which is created with all relevant includes (see parser.WriteIncludeFile()).
These variables are defined with name "GVISOR_{IOCTL_MACRO} = IOCTL_MACRO" so
they should not conflict with anything in the driver. Then we use the AST
parser to evaluate the value of the const variable and return that.

PiperOrigin-RevId: 793350829
2025-08-10 12:01:26 -07:00
Ayush RanjanandgVisor bot 27a81c303b Add support for parsing constants from NVIDIA driver in driver_ast_parser.
The `driver_ast_parser` tool is now able to parse constants alongside with
structs. This is done by adding a new `constants` field in the JSON input, and
a `constants` field in the JSON output. This will be used later to detect
changes in constants between driver versions.

Also, the parser's `structs` argument was renamed to `input` to account for
both structs and constants.

PiperOrigin-RevId: 792677998
2025-08-08 10:39:19 -07:00
Ayush RanjanandgVisor bot 4fa9078c68 nvproxy: Remove SupportedStructNames() for simplification.
We have `SupportedStructTypes` which provides the same list of structs but
also includes their type.

This is also more performant, because TestStructDefinitionParity was calling
SupportedStructNames() and SupportedStructTypes(), which was doing duplicate
work of reconstructing the entire ABI twice.

This change also gets rid of TestSupportedStructNames. We are already testing
that in TestStructDefinitionParity. Should speed up tests as we don't have to
compile and analyze the driver source code twice for nvproxy_driver_parity_test

PiperOrigin-RevId: 789894363
2025-08-01 14:22:35 -07:00
Ayush RanjanandgVisor bot 5d3cd58e18 nvproxy: Refactor DriverVersion out to nvconf package.
This allows for runsc to be able to use DriverVersion without having to depend
on the entirety of nvproxy.

PiperOrigin-RevId: 733912696
2025-03-05 16:43:03 -08:00
Anthony CuiandgVisor bot 0b0097e27e Add helper code to set up and run the parser on a given driver version.
PiperOrigin-RevId: 657727841
2024-07-30 14:22:03 -07:00