aboutsummaryrefslogtreecommitdiff
path: root/hw/pci/pci_bridge.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/pci/pci_bridge.c')
-rw-r--r--hw/pci/pci_bridge.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
index b2e50c36a0..40a39f57cb 100644
--- a/hw/pci/pci_bridge.c
+++ b/hw/pci/pci_bridge.c
@@ -412,22 +412,36 @@ void pci_bridge_map_irq(PCIBridge *br, const char* bus_name,
int pci_bridge_qemu_reserve_cap_init(PCIDevice *dev, int cap_offset,
uint32_t bus_reserve, uint64_t io_reserve,
- uint32_t mem_non_pref_reserve,
- uint32_t mem_pref_32_reserve,
+ uint64_t mem_non_pref_reserve,
+ uint64_t mem_pref_32_reserve,
uint64_t mem_pref_64_reserve,
Error **errp)
{
- if (mem_pref_32_reserve != (uint32_t)-1 &&
+ if (mem_pref_32_reserve != (uint64_t)-1 &&
mem_pref_64_reserve != (uint64_t)-1) {
error_setg(errp,
"PCI resource reserve cap: PREF32 and PREF64 conflict");
return -EINVAL;
}
+ if (mem_non_pref_reserve != (uint64_t)-1 &&
+ mem_non_pref_reserve >= (1ULL << 32)) {
+ error_setg(errp,
+ "PCI resource reserve cap: mem-reserve must be less than 4G");
+ return -EINVAL;
+ }
+
+ if (mem_pref_32_reserve != (uint64_t)-1 &&
+ mem_pref_32_reserve >= (1ULL << 32)) {
+ error_setg(errp,
+ "PCI resource reserve cap: pref32-reserve must be less than 4G");
+ return -EINVAL;
+ }
+
if (bus_reserve == (uint32_t)-1 &&
io_reserve == (uint64_t)-1 &&
- mem_non_pref_reserve == (uint32_t)-1 &&
- mem_pref_32_reserve == (uint32_t)-1 &&
+ mem_non_pref_reserve == (uint64_t)-1 &&
+ mem_pref_32_reserve == (uint64_t)-1 &&
mem_pref_64_reserve == (uint64_t)-1) {
return 0;
}