pci: implement RW1C handling for PCI status register#865
Conversation
| vfu_pci_config_space_t *pci, | ||
| const char *buf) | ||
| { | ||
| vfu_pci_hdr_sts_t w; |
There was a problem hiding this comment.
nit, rename to device_status or something more descriptive?
tmakatos
left a comment
There was a problem hiding this comment.
BTW do you mind sharing what specific problem you've encountered that motivated you to fix this?
| @@ -1,17 +1,37 @@ | |||
| # | |||
| # Copyright (c) 2026 Nutanix Inc. | |||
| # Copyright (c) 2021 Nutanix Inc. All rights reserved. | |||
There was a problem hiding this comment.
I should have been more explicit, you don't have to add something, but if you it has to be correct. If in doubt, don't add anything.
There was a problem hiding this comment.
Thanks for clarifying — I copied the copyright header from an existing test file when creating this test. Could you clarify what would be the correct header in this case? Should I remove it entirely or follow a different convention for new tests?
There was a problem hiding this comment.
I was wrong about this, we do need the Copyright (year, company, author name) as well as the license.
There was a problem hiding this comment.
You still have Nutanix as the company and John as the author.
Just to clear we don't hear that much of how libvfio-user is used, feel free to decline if you don't want to discuss this further. |
8c524dc to
9f9d2f2
Compare
|
I’m currently exploring ideas around reducing cloud infrastructure cost and building an eBPF-based agent, and while reading through virtualization-related components I came across libvfio-user. This wasn’t triggered by a production issue — I noticed the PCI status handling and thought it would be a good area to contribute and learn more about the stack. |
tmakatos
left a comment
There was a problem hiding this comment.
LGTM apart from the copyright header.
|
Okay brother will do.One idea I’ve been exploring is whether eBPF could complement traditional observability by collecting more direct kernel-level signals instead of relying only on exported metrics. I’m curious whether you’ve seen similar approaches used for things like OOM root-cause analysis, VM efficiency, or infrastructure cost reduction.ur thought brother !! |
tmakatos
left a comment
There was a problem hiding this comment.
We also need SOB in the commit message.
| @@ -1,17 +1,37 @@ | |||
| # | |||
| # Copyright (c) 2026 Nutanix Inc. | |||
| # Copyright (c) 2021 Nutanix Inc. All rights reserved. | |||
There was a problem hiding this comment.
I was wrong about this, we do need the Copyright (year, company, author name) as well as the license.
|
thanks for contribution, as per above, we need SOB (you can make it a single commit), plus you have some python lint :) |
Implement Read/Write-1-to-Clear (RW1C) semantics for PCI status register writes. Handle clearing of supported RW1C bits and extend tests to verify: - writing 1 clears the target bit - writing 0 preserves status bits - read-only bits remain unchanged Signed-off-by: zp78256pxd-ux <zp78256pxd@privaterelay.appleid.com>
9f9d2f2 to
c628c3f
Compare
|
Thanks for the review and feedback. I updated the commit with Signed-off-by, cleaned up the commit message, and force-pushed the changes. I also reran the PCI status test locally and verified the RW1C coverage still passes. |
As @jlevon said there's a lint error and you still have John and Nutanix on the header. Also, don't force push or squash commits, we'll do that when merging, makes it easier to ensure that the content of the commit stays the same. |
Signed-off-by: Siddharth C <siddharthcibi@icloud.com>
Signed-off-by: Siddharth C <siddharthcibi@icloud.com>
pci: implement RW1C handling for PCI status register
First of all, really impressed by libvfio-user — the codebase is clean and well-structured, and the Python test framework is a great approach for this kind of low-level emulation testing. Happy to be contributing.
Summary
Implement RW1C (Read/Write 1 to Clear) handling for PCI Status register writes.
Previously, writes to
PCI_STATUSwere silently ignored, even though several status bits are defined as RW1C by the PCI 3.0 spec. A FIXME in the code acknowledged this:Changes
handle_status_write()implementing correct RW1C semantics for all six RW1C bits(
dpd,sta,rta,rma,sse,dpe)pci_hdr_write()with a call tohandle_status_write()test/py/test_pci_status.pytest/py/meson.buildValidation
Executed:
All unit and Python tests passed. The
test-lspcifailure appears unrelated to this change (environment/output formatting difference in the test environment).References