From: Marcel Apfelbaum Date: Mon, 2 Oct 2017 10:31:35 +0000 (+0300) Subject: hw/gen_pcie_root_port: make IO RO 0 on IO disabled X-Git-Tag: v2.11.0-rc0~51^2~5 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=8e36c336d943c3bfe0d06f5465cc64d44b306e13;p=users%2Fdwmw2%2Fqemu.git hw/gen_pcie_root_port: make IO RO 0 on IO disabled IO_LIMIT and IO_BASE registers should not be writable if gen_pcie_root_port's io-reserve property is set to 0. The COMMAND register should have the IO flag read only. Signed-off-by: Marcel Apfelbaum Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c index ed03ffc764..ad4e6aa7ff 100644 --- a/hw/pci-bridge/gen_pcie_root_port.c +++ b/hw/pci-bridge/gen_pcie_root_port.c @@ -85,6 +85,13 @@ static void gen_rp_realize(DeviceState *dev, Error **errp) rpc->parent_class.exit(d); return; } + + if (!grp->io_reserve) { + pci_word_test_and_clear_mask(d->wmask + PCI_COMMAND, + PCI_COMMAND_IO); + d->wmask[PCI_IO_BASE] = 0; + d->wmask[PCI_IO_LIMIT] = 0; + } } static const VMStateDescription vmstate_rp_dev = {