Commit Graph

38497 Commits

Author SHA1 Message Date
Matt Borgerson d4a5e78ba7 nvnet: Drop post-tx descriptor length increase 2025-06-19 01:56:05 -07:00
Matt Borgerson 59d98ed3be nvnet: Drop some useless debug prints 2025-06-19 01:56:05 -07:00
Matt Borgerson 389f7ad577 nvnet: Rename RingDesc::packet_buffer -> buffer_addr 2025-06-19 01:56:05 -07:00
Matt Borgerson 9e00beaffa nvnet: Migrate ring size tracking to registers 2025-06-19 01:56:05 -07:00
Matt Borgerson bfe9f659d2 nvnet: Shrink some debug printfs 2025-06-19 01:56:05 -07:00
Matt Borgerson 3fd776d98e nvnet: Convert descriptor fields to host byte order and back 2025-06-19 01:56:05 -07:00
Matt Borgerson 1dbda16970 nvnet: Simplify nvnet_dma_packet_to_guest 2025-06-19 01:56:05 -07:00
Matt Borgerson fded775222 nvnet: Clean up idle bit management 2025-06-19 01:56:05 -07:00
Matt Borgerson bf72b3b33a nvnet: Remove more useless comments 2025-06-19 01:56:05 -07:00
Matt Borgerson 3fc128d929 nvnet: Fix phy_{addr,reg} sizes in nvnet_mdio_{read,write} 2025-06-19 01:56:05 -07:00
Matt Borgerson e43cf90c74 nvnet: Simplify nvnet_mmio_write 2025-06-19 01:56:05 -07:00
Matt Borgerson 14a95ddb7f nvnet: Move nvnet_dump_ring_descriptors down 2025-06-19 01:56:05 -07:00
Matt Borgerson 86cda64f70 nvnet: Fix register stringification 2025-06-19 01:56:05 -07:00
Matt Borgerson 59cec6599d nvnet: Move NetClientInfo handlers up 2025-06-18 01:32:27 -07:00
Matt Borgerson 2e8a08b5e5 nvnet: Fix spacing in NvNetState 2025-06-18 01:32:27 -07:00
Matt Borgerson 5e4d7a1dba nvnet: Fix nvnet_phy_reg_* trace addr/value size 2025-06-18 01:32:27 -07:00
Matt Borgerson 4e5a1fa157 nvnet: Copyright update 2025-06-18 01:32:27 -07:00
Matt Borgerson c0fa7e9ec4 nvnet: Rename mii reg traces to nvnet_phy_reg_{read,write} 2025-06-18 01:32:27 -07:00
Matt Borgerson 3eff7dd7fe nvnet: Run clang-format 2025-06-18 01:32:27 -07:00
Matt Borgerson bd7a6d7b31 nvnet: Make phy registers 16b 2025-06-18 01:32:27 -07:00
Matt Borgerson 3649593c73 nvnet: Factor out phy register read/write from mdio 2025-06-18 01:32:27 -07:00
Matt Borgerson f640a9969a nvnet: Rename mdio addr/data registers 2025-06-18 01:32:27 -07:00
Matt Borgerson 04bd92df40 nvnet: Migrate ring size shifts to GET_MASK macro 2025-06-18 01:32:27 -07:00
Matt Borgerson f4ab3ab830 nvnet: Format the register list 2025-06-18 01:32:27 -07:00
Matt Borgerson 144d3049a9 nvnet: Drop more useless comments 2025-06-18 01:32:27 -07:00
Matt Borgerson e180a11d04 nvnet: Simplify register stringification 2025-06-18 01:32:27 -07:00
Matt Borgerson 8d2ea10ef0 nvnet: Use QEMU_PACKED macro 2025-06-18 01:32:27 -07:00
Matt Borgerson 936730bb98 nvnet: Drop dead code 2025-06-18 01:32:27 -07:00
Matt Borgerson 1fd4cc7dd4 nvnet: Simplify debug macro 2025-06-18 01:32:27 -07:00
Matt Borgerson bf76e3f666 nvnet: Eliminate redundant declarations 2025-06-18 01:32:27 -07:00
Matt Borgerson 361809d623 nvnet: Use OBJECT_DECLARE_SIMPLE_TYPE 2025-06-18 01:32:27 -07:00
Matt Borgerson 6fc9925dc9 nvnet: Drop custom packet hexdump 2025-06-18 01:32:27 -07:00
Matt Borgerson c9f794c277 nvnet: Use is_broadcast_ether_addr 2025-06-18 01:32:27 -07:00
Matt Borgerson 1312b7e683 nvnet: Drop some useless comments 2025-06-18 01:32:27 -07:00
Matt Borgerson 62b8e789f4 nvnet: Move NVNET_DEVICE macro up 2025-06-18 01:32:27 -07:00
Matt Borgerson 92bc16f015 nvnet: Reorganize for more prototype elimination 2025-06-18 01:32:27 -07:00
Matt Borgerson ea6d2fc050 nvnet: Drop some useless protos 2025-06-18 01:32:27 -07:00
Matt Borgerson 12127b469d nvnet: Clean up mii read and write handling 2025-06-18 01:32:27 -07:00
Matt Borgerson bc4dbcf4bb nvnet: Fix mii inuse/write bits 2025-06-18 01:32:27 -07:00
Matt Borgerson 928be451d9 nvnet: Drop unnecessary comment 2025-06-18 01:32:27 -07:00
Matt Borgerson 2027d5bc67 nvnet: Use hw/net/mii.h
hw/net/mii.h provides common definitions for MII.
2025-06-18 01:32:27 -07:00
Matt Borgerson e02e41ccaa nvnet: Move to hw/xbox/mcpx/nvnet 2025-06-03 19:36:08 -07:00
Matt Borgerson ba297f3b69 mcpx: Move APU components to hw/xbox/mcpx/apu 2025-06-03 19:36:08 -07:00
Matt Borgerson 395d136364 mcpx: Cleanup monitor 2025-06-03 19:36:08 -07:00
Matt Borgerson 829ec66757 mcpx: Rename {dsp->gp_ep}.c,h for clarity 2025-06-03 19:36:08 -07:00
Matt Borgerson 2f99d04730 mcpx: Minor cleanup 2025-06-03 19:36:08 -07:00
Matt Borgerson 979499ffe5 mcpx: Move SGE handles to VP struct 2025-06-03 19:36:08 -07:00
Matt Borgerson 04273de749 mcpx: Move DSP state structs to dsp.h 2025-06-03 19:36:08 -07:00
Matt Borgerson 7ab7f65cdf mcpx: Reorder functions, drop some protos 2025-06-03 19:36:08 -07:00
Matt Borgerson 068a623c54 mcpx: Move VP state struct to vp.h 2025-06-03 19:36:08 -07:00
Matt Borgerson ba6f7f360e mcpx: Move VP files into vp/ 2025-06-03 19:36:08 -07:00
Matt Borgerson 2321dbfeb6 mcpx: Split some VP structs out to vp.h 2025-06-03 19:36:08 -07:00
Matt Borgerson 8ee8732aad mcpx: Drop some redundant protos 2025-06-03 19:36:08 -07:00
Matt Borgerson 9bdeb2d793 mcpx: Add inline keyword to float conversion helpers 2025-06-03 19:36:08 -07:00
Matt Borgerson bf9985e7bf mcpx: Move DSP functions to dsp.c 2025-06-03 19:36:08 -07:00
Matt Borgerson 2d5c4fa34d mcpx: Move VP functions to vp.c 2025-06-03 19:36:08 -07:00
Matt Borgerson bee1cb6006 mcpx: Move debug functions to debug.c 2025-06-03 19:36:08 -07:00
Matt Borgerson eb88acf4c0 mcpx: Move some definitions to apu_int.h 2025-06-03 19:36:08 -07:00
Erik Abair 9732026aca nv2a: Ignore unsupported depth funcs to match HW 2025-06-03 12:11:46 -07:00
Matt Borgerson 26c451fc36 mcpx: Process voices concurrently 2025-06-03 01:54:09 -07:00
Matt Borgerson 344f7da132 mcpx: Support 3D voice HRTF filtering 2025-05-31 17:16:54 -07:00
Matt Borgerson 05b1f2c13d mcpx: Define a constant for 3D voice count 2025-05-31 17:16:54 -07:00
Matt Borgerson 38d33367ea xbox: Move xbox machine property creation to class init handler 2025-05-27 19:38:54 -07:00
Erik Abair 8667193001 nv2a: Prevent NaN in specular power factor calculation 2025-05-20 13:28:39 -07:00
coldhex ce936bccdd nv2a/gl: y-flipped rendering to framebuffer object
Render scenes upside-down to framebuffer objects (FBO). The strange thing
about rendering to OpenGL FBO is that it follows the bottom-left triangle
rasterization rule with common PC GPUs. At least Intel and AMD. NVIDIA to
be tested. My raster-rule-test github gist demonstrates this.

This commit flips coordinates in y-direction, which effectively turns the
bottom-left rule into top-left rule needed for Xbox compatibility.

This (together with the previous commit) fixes Midtown Madness 3 Seine
water rectangular seam rendering artifacts (and the remaining seams are
present with Xbox hardware too.) May fix similar artifacts in other games.
2025-05-20 13:15:12 -07:00
coldhex a316d74872 nv2a: Use trunc in vertex rounding instead of floor
Xbox seems to truncate instead of flooring, which can be inferred from
interpolated depth buffer values.
2025-05-20 13:15:12 -07:00
coldhex 11dcae01b9 nv2a: implement screen coordinate rounding to 4 bit fractional precision
Xbox triangle rasterization appears to follow the usual top-left rule.
However, since Xemu renders to an OpenGL framebuffer object (FBO) instead
of directly to the default framebuffer, Xemu actually has what could be
called the bottom-left triangle rasterization rule. I'll address that in
another commit.

Also, note that the ProjAdjacentGeometry_0.5625 test in nxdk_pgraph_tests
is very sensitive to floating point rounding errors. For example, the
nxdk_pgraph_tests commit 66b32a0b1feba32a0db7a95d6358e84f7a6246ad changed
the math library which caused the test result to change also on real Xbox
hardware due to floating point rounding error differences in matrix
inverse computation. Apart from the bottom-left rasterization issue, the
differing result between Xbox and the rounding I am proposing here for
Xemu seems to stem from floating point rounding that happens in screen
coordinate calculations before the rounding to 4 bit precision takes place.
Fixing such rounding issues would require carrying all preceding floating
point computations exactly in the same order and with same precision as
Xbox. Note that Xbox Direct3D library seems to add 0.03125 (1/32) to
screen coordinates by default. Likely the idea there was to make floating
point screen coordinates round to the nearest screen coordinates in
4 bit fixed point precision. So the Xbox Direct3D library (and therefore
games) already mitigate against precarious rounding when exactly
half-integer coordinates are used by games. Actually they would use
integer coordinates because it is Direct3D 8, but since nv2a appears to
rasterize at half-integer coordinates like OpenGL, Xbox Direct3D
also adds 0.5 to screen coordinates in addition to 1/32.
2025-05-20 13:15:12 -07:00
Erik Abair c720af00bb
nv2a/vsh: Replace NaN with 1.0 for Bx, Dx, Fog outputs and MUL zero-check 2025-05-15 12:54:56 -07:00
Erik Abair 428c975f09 nv2a: Allow multiframe RenderDoc captures with nv2a traces
Allows multiple frames to be captured at once by holding shift while pressing
F10.

Temporarily toggles nv2a trace messages if control is held while pressing F10.
2025-05-15 08:37:13 -07:00
Erik Abair d593869429
nv2a: Move point params to uniforms
Co-authored-by: Matt Borgerson <contact@mborgerson.com>
2025-04-30 23:43:38 -07:00
Matt Borgerson 6e513ed948 nv2a/psh: Fix 2D texture addressing in DOT_STR_3D mode 2025-04-29 23:41:05 -07:00
Erik Abair 89185e6937 nv2a/psh: Fix default alpha for unbound texture samplers 2025-04-22 20:16:15 -07:00
Matt Borgerson 0c2a617819 nv2a: Bump vmstate version for new NV2A_MAX_BATCH_LENGTH 2025-04-18 11:58:22 -07:00
Erik Abair 270dbe01ea nv2a: Increase MAX_BATCH_LENGTH beyond highest known retail use 2025-04-18 10:46:43 -07:00
Matt Borgerson 5685a6290c nv2a/vk: Set specular power uniform 2025-04-16 20:26:22 -07:00
Erik Abair 679f6d06bd nv2a: Handle LOCALEYE light control 2025-04-16 18:24:46 -07:00
Erik Abair 34ed0f75de nv2a: Handle LOCAL_RANGE 2025-04-16 18:24:46 -07:00
Erik Abair 69c8df2a3e nv2a: Partial implementation of SET_SPECULAR_PARAMS 2025-04-16 18:24:46 -07:00
Erik Abair 7a34eedd6f nv2a: Partially handle SET_LIGHT_CONTROL 2025-04-16 18:24:46 -07:00
Erik Abair 86c85023e6 nv2a: Handle SET_FOG_COORD and SET_WEIGHT* commands 2025-04-16 14:09:13 -07:00
Matt Borgerson 2cc926588b nv2a/gl: Fix COLOR_LE_G8B8 GL surface format type 2025-04-11 04:18:28 -07:00
Erik Abair ebec5e3028 nv2a: Fix assert when setting fog gen mode to fog_x 2025-04-08 16:24:50 -07:00
Matt Borgerson 57cdee770e mcpx/dsp: Fix some formatting/spelling nits 2025-03-31 12:40:31 -07:00
Matt Borgerson 9439f605a8 mcpx/dsp: Drop redundant value/address assertions 2025-03-31 12:40:31 -07:00
Matt Borgerson e08011b772 mcpx/dsp: Rename *.inl -> *.c.inc 2025-03-31 12:40:31 -07:00
Matt Borgerson 4b81c28901 mcpx/dsp: Migrate some DPRINTFs to trace events 2025-03-31 12:40:31 -07:00
Matt Borgerson 31d8237ee3 mcpx/dsp: Remove dsp56k_execute_one_disasm_instruction 2025-03-31 12:40:31 -07:00
Matt Borgerson 8dafd513b9 mcpx/dsp: Move some debug functions out to debug.c 2025-03-31 12:40:31 -07:00
Matt Borgerson d18125994c mcpx/dsp: Drop some dead code 2025-03-31 12:40:31 -07:00
Matt Borgerson f8cbcbadaa mcpx/dsp: Move dma reg defs to a header 2025-03-31 12:40:31 -07:00
Matt Borgerson c68cdd9479 mcpx/dsp: Fix minor header issues 2025-03-31 12:40:31 -07:00
Matt Borgerson 31c491a702 mcpx/dsp: Move cpu reg defs to a header 2025-03-31 12:40:31 -07:00
Matt Borgerson 5ba2ef790c mcpx/dsp: Factor out debug bits to a header 2025-03-31 12:40:31 -07:00
Matt Borgerson 148f04e1c7 mcpx/dsp: Replace printf -> DPRINTF 2025-03-31 12:40:31 -07:00
Matt Borgerson 115456f255 mcpx/dsp: Bring back disassembly 2025-03-31 12:40:31 -07:00
Matt Borgerson 89f98947f6 mcpx/dsp: Fix dprintf use 2025-03-31 12:40:31 -07:00
Matt Borgerson 9af3c1a005 mcpx/dsp: Add missing copyright 2025-03-31 12:40:31 -07:00
Matt Borgerson bf51af891d mcpx/dsp: Move to a library 2025-03-31 12:40:31 -07:00
Erik Abair 672e9cd553 nv2a: Handle SET_SPECULAR_ENABLE 2025-03-28 02:18:42 -07:00
Matt Borgerson 312bd94573 mcpx: Move voice_list_regs to apu.c 2025-03-27 23:33:40 -07:00
Matt Borgerson 2d73e8aafe nv2a: Use root-relative paths to reference parent dir headers 2025-03-27 23:33:40 -07:00
Matt Borgerson 0e18d11d90 nv2a: Rename methods.h -> methods.h.inc 2025-03-27 23:33:40 -07:00
Matt Borgerson a830cc4526 xbox: Disable clang-format for deliberately aligned reg defs 2025-03-27 23:33:40 -07:00
Matt Borgerson 1893b56c38 nv2a/vk: Fix vertex ram buffer dirty bit check 2025-03-19 02:25:33 -07:00
Matt Borgerson b929d4eced nv2a: Drop surface compat clip constraint 2025-03-17 14:48:47 -07:00
Matt Borgerson c3a8b9569f nv2a: Simplify surface clip to scissor size calculation 2025-03-17 14:48:47 -07:00
Logan Stromberg 860bccb722
nv2a: Fix surface clip to scissor origin 2025-03-17 14:32:40 -07:00
coldhex 02659dd3cc nv2a: Fix cubemap fourth texture coordinate component handling
Xbox hardware ignores fourth texture coordinate component for cubemaps.
2025-03-17 11:37:41 -07:00
wilkovatch a00820746f
nv2a: Handle texture dimensions not divisible by 4 in S3TC decoder 2025-03-14 18:44:25 -07:00
Matt Borgerson a143f66ce4 nv2a/psh: Handle 3D textures in PROJECT2D mode 2025-03-10 16:13:09 -07:00
Matt Borgerson 6e3dfb36d8 nv2a/vk: Don't set compressed, swizzled when attribute is uniform 2025-03-10 14:23:43 -07:00
Matt Borgerson 4665515d80 nv2a: Group attributes in pgraph_get_glsl_vtx_header 2025-03-10 12:30:16 -07:00
coldhex 3eb22b6b81 nv2a: Explicit float representation for RCC and vertex shader W range 2025-03-08 14:54:18 -07:00
coldhex 63cb75ce84 nv2a: Fix -0.0 clamping of RCC instruction and vertex shader W-output
Xbox rounds -0.0 to the negative range and 0.0 to the positive range. This
commit also restores RCC instruction clamping to be done on the output of
reciprocal calculation (which current Xemu release does) with fix for the
input=Infinity case.
2025-03-08 14:54:18 -07:00
coldhex 8dc6c90e11 nv2a/vk: Drop unnecessary dirty check for NV_PGRAPH_ZCOMPRESSOCCLUDE
This was used to enable/disable Vulkan depth clamping, but that was
removed in previous commit.
2025-03-08 14:54:18 -07:00
coldhex 854a001063 nv2a: Fix zero-vector input in fixed function vertex shader
If tPosition is a zero-vector, then invViewport matrix had no effect.
Bounding w-coordinate away from zero and infinity must be done before
applying invViewport (which is needed for OpenGL/Vulkan) to emulate
Xbox hardware behaviour properly.
2025-03-08 14:54:18 -07:00
coldhex 798ad30819 nv2a: Perspective-correct interpolation for w-buffering
z_perspective is true implies w-buffering and then the w-coordinate stored
in the depth buffer should also be interpolated in a perspective-correct
way. We do this by calculating w and setting gl_FragDepth in the fragment
shader.

Since enabling polygon offset and setting values using glPolygonOffset
won't have any effect when manually setting gl_FragDepth for w-buffering,
we introduce the depthOffset variable to obtain similar behaviour (but the
glPolygonOffset factor-argument is currently not emulated.) (Note that
glPolygonOffset is OpenGL implementation-dependent and it might be good to
use depthOffset for z-buffering as well, but this is not done here and we
still use OpenGL/Vulkan zbias functionality.)

This also implements depth clipping and clamping in the fragment shader.
If triangles are clipped, the shadows of the small rocks in Halo 2 Beaver
Creek map can have flickering horizontal lines. The shadows are drawn on
the ground in another pass with the same models as for the ground, but for
some reason with depth clamping enabled. The flickering happens if Xemu
clips the ground triangles, but the exact same shadow triangles are depth
clamped, so there are small differences in the coordinates. The shadows
are drawn with depth function GL_EQUAL so there is no tolerance for any
differences. Clipping in the fragment shader solves the problem because
the ground and shadow triangles remain exactly the same regardless of
depth clipping/clamping. For some performance gain, it might be a good
idea to cull triangles by depth in the geometry shader, but this is not
implemented here.

In the programmable vertex shader we always multiply position output by w
because this improves numerical stability in subsequent floating point
computations by modern GPUs. This usually means that the perspective
divide done by the vertex program gets undone.

The magic bounding constants 5.42101e-020 and 1.884467e+019 are replaced
by 5.421011e-20 and 1.8446744e19, i.e. more decimals added. This makes the
32-bit floating point numbers represent exactly 2^(-64) and 2^64 (raw bits
0x1f800000 and 0x5f800000) which seem more likely the correct values
although testing with hardware was not done to this precision.

Testing indicates that the same RCC instruction magic constants are also
applied to both fixed function and programmable vertex shader w-coordinate
output. This bounding replaces the special test for w==0.0 and abs(w)==inf
which used to set vtx_inv_w=1.0 (which did not match Xbox hardware
behaviour.)
2025-03-08 14:54:18 -07:00
Erik Abair f701573d44 nv2a: Use rounded values for alpha testing 2025-03-05 17:12:14 -07:00
mborgerson de1f311efa
Merge QEMU v9.2.1 2025-02-15 15:17:25 -07:00
coldhex 0427ae8cfc mcpx: Implement APU multipass voice processing
Voice Processor (VP) multipass feature allows configuring lists of voices
that are first mixed (in order) into a designated mixbin which is then used
as a sample source when processing voices with multipass flag set to true
in NV_PAVS_VOICE_CFG_FMT. Setting correct voice order in lists is the
responsibility of the game/application and in practice is handled by the
DirectSound library. The multipass mixbin is hardcoded to 31 in
DirectSound, but hardware would allow other bins.

This implementation also adds additional info to audio debug UI to see what
the source and destination voices involved are. The info is only shown
when DSP processing is off, i.e. "VP Only" (MON_VP) is selected. This is
because storing the voice numbers requires additional digging which is
required for MON_VP anyway and therefore is free. The multipass feature
itself works fine with DSP (i.e. GP and EP) enabled, only the additional
debug info is not shown.
2025-02-15 15:01:29 -07:00
Matt Borgerson 366aacb398 v9.2.1 release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEZKoqtTHVaQM2a/75gqpKJDselHgFAmenP10ACgkQgqpKJDse
 lHhYXxAAhSGXrrfEjfyNPO0N5tRKqCzYkoeB5GDScRMb3UogF2/jg/VV2uAVBKnl
 ikCO87w81+8FctiYKfMYnhTk+axlxYq//H8JALX3tyt35BpSfSkyxS8RGzVl4S3l
 0TMA0l+cs3zPDq+yA3UAhppV5CgwBbzaN8xCm9mNFe49nlIHymgcFc3tFFtS0x+H
 PLjbqGX3X7joyqZ0O2cYk3UwzF01ZR1RKgM3sUumvsoSOwuKGul4jc0iLCn9hTHX
 QdxrThxb9KL5iL+fY5DlYc/LiJNPk1NcU1dQzqJinzrux9wNr4RpF7iSrs+m0Y/d
 3FNzMTPuiqwBh4JJFGuSguR83q6nJLlVR/kKxPmPNBSX86q4L1Dw0rbyb40ZRGAA
 xV88kv8gzvmhR2hnScn7S+2d3EG9D3DKDCKTPp0unHhMjZk9rP+hcPmQaTqi1CIW
 c400CI2gP0e0a8TFLKTnTFVP2+scvOkVn6rBy9+pQat0eTMgWjA9VSxvG5GRJ4W9
 +i/9RSTyCLy3s7DWX3JN9nytZ5mS/RDv5YB3FfeMlT/1wH5PFYitxHdyxjHrBE+8
 KjXPtqDsJTMvwqPP+2nDD7D1MQWJgz0468GeuPK5itJCYBVYilIOUlibKfAEPbo+
 0eUtq1oVMJfKnJadARf2cQrzR2IGEWF1rZqrRrkxfl+mHnTxnss=
 =XhYS
 -----END PGP SIGNATURE-----

Merge QEMU v9.2.1
2025-02-15 13:59:10 -07:00
Hongren Zheng e82fbf01b6 hw/usb/canokey: Fix buffer overflow for OUT packet
When USBPacket in OUT direction has larger payload
than the ep_out_buffer (of size 512), a buffer overflow
would occur.

It could be fixed by limiting the size of usb_packet_copy
to be at most buffer size. Further optimization gets rid
of the ep_out_buffer and directly uses ep_out as the target
buffer.

This is reported by a security researcher who artificially
constructed an OUT packet of size 2047. The report has gone
through the QEMU security process, and as this device is for
testing purpose and no deployment of it in virtualization
environment is observed, it is triaged not to be a security bug.

Cc: qemu-stable@nongnu.org
Fixes: d7d3491855 ("hw/usb: Add CanoKey Implementation")
Reported-by: Juan Jose Lopez Jaimez <thatjiaozi@gmail.com>
Signed-off-by: Hongren Zheng <i@zenithal.me>
Message-id: Z4TfMOrZz6IQYl_h@Sun
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 664280abddcb3cacc9c6204706bb739fcc1316f7)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-29 22:29:03 +03:00
Matt Borgerson 7cb7bb68a9 nv2a: Multiversion [un]swizzle to optimize for common bpp 2025-01-26 18:47:46 -07:00
Matt Borgerson eae328dc19 nv2a: Move [un]swizzle_rect to swizzle.h 2025-01-26 18:47:46 -07:00
Matt Borgerson bb5ee6865b nv2a: Drop osdep.h, add stdbool.h to swizzle.c 2025-01-26 18:47:46 -07:00
NZJenkins ae4b5c0695
nv2a: Speed up software swizzling 2025-01-26 14:00:35 -07:00
Fred Hallock 191bc40f70
xid: Add Xbox Controller S 2025-01-25 20:48:58 -07:00
Li Zhijian acc4e8b69b hw/cxl: Fix msix_notify: Assertion `vector < dev->msix_entries_nr`
This assertion always happens when we sanitize the CXL memory device.
$ echo 1 > /sys/bus/cxl/devices/mem0/security/sanitize

It is incorrect to register an MSIX number beyond the device's capability.

Increase the device's MSIX number to cover the mailbox msix number(9).

Fixes: 43efb0bfad ("hw/cxl/mbox: Wire up interrupts for background completion")
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
Message-Id: <20250115075834.167504-1-lizhijian@fujitsu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 1ce979e7269a34d19ea1a65808df014d8b2acbf6)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-17 10:57:59 +03:00
Igor Mammedov 7170aa66aa pci: acpi: Windows 'PCI Label Id' bug workaround
Current versions of Windows call _DSM(func=7) regardless
of whether it is supported or not. It leads to NICs having bogus
'PCI Label Id = 0', where none should be set at all.

Also presence of 'PCI Label Id' triggers another Windows bug
on localized versions that leads to hangs. The later bug is fixed
in latest updates for 'Windows Server' but not in consumer
versions of Windows (and there is no plans to fix it
as far as I'm aware).

Given it's easy, implement Microsoft suggested workaround
(return invalid Package) so that affected Windows versions
could boot on QEMU.
This would effectvely remove bogus 'PCI Label Id's on NICs,
but MS teem confirmed that flipping 'PCI Label Id' should not
change 'Network Connection' ennumeration, so it should be safe
for QEMU to change _DSM without any compat code.

Smoke tested with WinXP and WS2022
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/774
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20250115125342.3883374-3-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 0b053391985abcc40b16ac8fc4a7f6588d1d95c1)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-17 09:30:54 +03:00
Nicholas Piggin c8fb662a58 pci/msix: Fix msix pba read vector poll end calculation
The end vector calculation has a bug that results in polling fewer
than required vectors when reading at a non-zero offset in PBA memory.

Fixes: bbef882cc1 ("msi: add API to get notified about pending bit poll")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Message-Id: <20241212120402.1475053-1-npiggin@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 42e2a7a0ab23784e44fcb18369e06067abc89305)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-17 09:26:23 +03:00
Sebastian Ott 91b2cb9a78 pci: ensure valid link status bits for downstream ports
PCI hotplug for downstream endpoints on arm fails because Linux'
PCIe hotplug driver doesn't like the QEMU provided LNKSTA:

  pcieport 0000:08:01.0: pciehp: Slot(2): Card present
  pcieport 0000:08:01.0: pciehp: Slot(2): Link Up
  pcieport 0000:08:01.0: pciehp: Slot(2): Cannot train link: status 0x2000

There's 2 cases where LNKSTA isn't setup properly:
* the downstream device has no express capability
* max link width of the bridge is 0

Move the sanity checks added via 88c869198a
("pci: Sanity test minimum downstream LNKSTA") outside of the
branch to make sure downstream ports always have a valid LNKSTA.

Signed-off-by: Sebastian Ott <sebott@redhat.com>
Tested-by: Zhenyu Zhang <zhenyzha@redhat.com>
Message-Id: <20241203121928.14861-1-sebott@redhat.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 694632fd44987cc4618612a38ad151047524a590)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-17 09:22:13 +03:00
Phil Dennis-Jordan 4a3538e6f2 hw/usb/hcd-xhci-pci: Use modulo to select MSI vector as per spec
QEMU would crash with a failed assertion if the XHCI controller
attempted to raise the interrupt on an interrupter corresponding
to a MSI vector with a higher index than the highest configured
for the device by the guest driver.

This behaviour is correct on the MSI/PCI side: per PCI 3.0 spec,
devices must ensure they do not send MSI notifications for
vectors beyond the range of those allocated by the system/driver
software. Unlike MSI-X, there is no generic way for handling
aliasing in the case of fewer allocated vectors than requested,
so the specifics are up to device implementors. (Section
6.8.3.4. "Sending Messages")

It turns out the XHCI spec (Implementation Note in section 4.17,
"Interrupters") requires that the host controller signal the MSI
vector with the number computed by taking the interrupter number
modulo the number of enabled MSI vectors.

This change introduces that modulo calculation, fixing the
failed assertion. This makes the device work correctly in MSI mode
with macOS's XHCI driver, which only allocates a single vector.

Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250112210056.16658-2-phil@philjordan.eu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit bb5b7fced6b5d3334ab20702fc846e47bb1fb731)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-17 09:16:01 +03:00
Keoseong Park 48876bfc47 hw/ufs: Adjust value to match CPU's endian format
In ufs_write_attr_value(), the value parameter is handled in the CPU's
endian format but provided in big-endian format by the caller. Thus, it
is converted to the CPU's endian format. The related test code is also
fixed to reflect this change.

Fixes: 7c85332a2b ("hw/ufs: minor bug fixes related to ufs-test")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Keoseong Park <keosung.park@samsung.com>
Reviewed-by: Jeuk Kim <jeuk20.kim@samsung.com>
Message-ID: <20250107084356epcms2p2af4d86432174d76ea57336933e46b4c3@epcms2p2>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit 4572dacc33e232a7c951ba7ba7a20887fad29e71)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-15 15:53:53 +03:00
Ryzee119 e293f6ba67 input: Add xbox live communicator support 2025-01-15 03:08:14 -07:00
Matt Borgerson 6de26b0c2c ac97: Disable pi/mc reads for now 2025-01-15 03:05:35 -07:00
Fabiano Rosas e7a9d93428 s390x: Fix CSS migration
Commit a55ae46683 ("s390: move css_migration_enabled from machine to
css.c") disabled CSS migration globally instead of doing it
per-instance.

CC: Paolo Bonzini <pbonzini@redhat.com>
CC: qemu-stable@nongnu.org #9.1
Fixes: a55ae46683 ("s390: move css_migration_enabled from machine to css.c")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2704
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20250109185249.23952-8-farosas@suse.de>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
(cherry picked from commit c76ee1f6255c3988a9447d363bb17072f1ec84e1)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-13 11:25:57 +03:00
Matt Borgerson 7eba0d3124 nv2a/gl: Update copyright on recently modified files 2025-01-07 17:37:06 -07:00
Matt Borgerson 510c280b05 nv2a/gl: Unify ShaderBinding and ShaderLruNode 2025-01-07 17:35:06 -07:00
Matt Borgerson 5dcbb7ebdb nvnet: Minor cleanup 2025-01-07 14:28:27 -07:00
Matt Borgerson 6c389194b6 nv2a/psh: Remove unused arguments in string format 2025-01-07 00:52:51 -07:00
Matt Borgerson d76898f63b nv2a: Fix variable shadowing complaints 2025-01-07 00:52:51 -07:00
Matt Borgerson 281f42c5e1 mcpx: Fix variable shadowing 2025-01-07 00:52:51 -07:00
Matt Borgerson 85f84be04d mcpx: Narrow variable def scopes, fix shadowing 2025-01-07 00:52:51 -07:00
Matt Borgerson 57c6d82fa3 nv2a/vk: Simplify debug indent loop to a variable field width format 2025-01-07 00:52:51 -07:00
Matt Borgerson 6ac52147a4 nv2a/psh: Remove function scope variable i, which was being shadowed 2025-01-07 00:52:51 -07:00
Matt Borgerson 3070d6422c mstring: Remove mstring_append_{int,char} 2025-01-07 00:52:51 -07:00
Matt Borgerson 0e50741c28 ui,xbox: Copyright updates on changed files 2025-01-06 23:06:21 -07:00
Matt Borgerson 34fe7918d3 nvnet: Return `true' instead of `1' when returning a bool 2025-01-06 23:05:53 -07:00
Matt Borgerson 8687b152c9 nvnet: Drop pc.h, add pci_device.h includes 2025-01-06 23:05:53 -07:00
Matt Borgerson 376280a635 xbox: Configure nic 2025-01-06 23:05:53 -07:00