diff options
author | jfgd <4610889+jfgd@users.noreply.github.com> | 2024-03-29 11:37:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-29 10:37:10 +0000 |
commit | 143b4f840b07990a759d0e7328475bdf90d7d6ba (patch) | |
tree | f1f8c906c3e2495639baaf0f5cf6bfd95b3d305c /lib | |
parent | b646559cc90f1a1f475fc47048bbbd955e20f4a2 (diff) | |
download | libvfio-user-143b4f840b07990a759d0e7328475bdf90d7d6ba.zip libvfio-user-143b4f840b07990a759d0e7328475bdf90d7d6ba.tar.gz libvfio-user-143b4f840b07990a759d0e7328475bdf90d7d6ba.tar.bz2 |
Support 64 bits and prefetchable BARs (#792)
* Support 64 bits and prefetchable BARs
Add two new flags for lib user to request 64bits and/or prefetchable
BARs.
Tested with a vfio-user client patched QEMU.
Signed-off-by: Jérémy Fanguède <jfanguede@kalrayinc.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libvfio-user.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/libvfio-user.c b/lib/libvfio-user.c index dc13ea5..62efd30 100644 --- a/lib/libvfio-user.c +++ b/lib/libvfio-user.c @@ -1729,6 +1729,17 @@ vfu_realize_ctx(vfu_ctx_t *vfu_ctx) if (!(vfu_ctx->reg_info[i].flags & VFU_REGION_FLAG_MEM)) { vfu_ctx->pci.config_space->hdr.bars[i].io.region_type |= 0x1; } + if ((vfu_ctx->reg_info[i].flags & VFU_REGION_FLAG_64_BITS)) { + vfu_ctx->pci.config_space->hdr.bars[i].mem.locatable + = PCI_BASE_ADDRESS_MEM_TYPE_LOCATABLE_64; + } + if ((vfu_ctx->reg_info[i].flags & VFU_REGION_FLAG_PREFETCH)) { + vfu_ctx->pci.config_space->hdr.bars[i].mem.prefetchable = 1; + if (!(vfu_ctx->reg_info[i].flags & VFU_REGION_FLAG_64_BITS)) { + vfu_log(vfu_ctx, LOG_WARNING, + "Region %d has prefetchable flag set, but not 64bits flag", i); + } + } } if (vfu_ctx->irqs == NULL) { |