aboutsummaryrefslogtreecommitdiff
path: root/include/pci_caps
AgeCommit message (Collapse)AuthorFilesLines
2021-05-27Fix struct pxcap (#534)Swapnil Ingle1-3/+4
* Added missing reserved bits and renamed per to rer nameing as the nvme specs * Add pxcap capability in lspci test Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2021-05-27Cleanup and fix structs padding (#532)Swapnil Ingle4-91/+91
In case of bitfields compiler may use data type to allocate struct size and add additional paddings. Instead use data type which is closest to the total size of the bitfields. This patch also uses uint* version consistently throughout. Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2021-04-23correct PM capability definition (#452)John Levon1-11/+19
the static size assert for the PMCS register was checking the wrong struct; however, the struct was nonetheless 4 bytes long, due to uint bitfields. This accidentally meant the containing struct pmcap was the correct size (the alignment attribute makes no difference). After fixing struct pmcs, we'll include the additional two bytes defined in the PCI PM specification, Section 3.2. These are "optional", but as elsewhere, we'll require them when adding the capability. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-18use sizeof() consistently (#351)John Levon1-1/+1
The most common way we have written this is as "sizeof()"; use this form consistently. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-02define full PCI Express capability struct (#289)John Levon1-5/+116
Define the full-size capability as defined in the specification. Previously, we were defining the structure as in the form used by PCI Express Integrated Endpoints. It's reasonable to assume, however, that a vfio-user device is a normal PCI Express Endpoint connected over a Link. We'll go further, and define the whole structure, including the slot registers at the end that are usually only used for Ports. The presumption here is that it can't hurt to use the larger size: the only way a client could care is if it presumed the next capability was at a particular offset from this one, and we must hope nothing is that silly. This also corrects a buffer overflow: cap_size() in fact disagreed with the original size of our struct pxcap (found via clang's address sanitizer). Signed-off-by: John Levon <john.levon@nutanix.com Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-20support extended capabilities (#226)John Levon2-0/+79
Provide initial support for extended capabilities, and implement handlers for the Device Serial Number and Vendor-Specific capabilities. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-12-11add support PCI vendor-specific capabilityThanos Makatos2-8/+22
The PCI vendor-specific capability is blindly read/written by the library. It is possible that the user might want to intercept accesses to it, in which case we'll have to add callback. The best way to do this to introduce a new function that configures callbacks for the PCI capabilities, e.g. typedef ssize_t (vfu_cap_access_t) (void *pvt, uint8_t id, char *buf, size_t count, loff_t offset, bool is_write); vfu_pci_cap_set_cb(vfu_ctx-T *vfu_ctx, uint8_t cap_id, vfu_cap_access_t *cb); This way the existing API won't have to change. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-07assorted PCI capabilities improvementsThanos Makatos1-0/+4
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-27rename to libvfio-user (#128)John Levon5-15/+15
The muser name no longer reflects the implementation, and will just serve to confuse. Bite the bullet now, and rename ourselves to reflect the actual implementation. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-11-24clean up headersJohn Levon5-0/+447
Introduce include/ dir for public headers, and clean up include guards etc.