|
@@ -179,6 +179,8 @@ static Property q35_host_props[] = {
|
|
mch.below_4g_mem_size, 0),
|
|
mch.below_4g_mem_size, 0),
|
|
DEFINE_PROP_SIZE(PCI_HOST_ABOVE_4G_MEM_SIZE, Q35PCIHost,
|
|
DEFINE_PROP_SIZE(PCI_HOST_ABOVE_4G_MEM_SIZE, Q35PCIHost,
|
|
mch.above_4g_mem_size, 0),
|
|
mch.above_4g_mem_size, 0),
|
|
|
|
+ DEFINE_PROP_BOOL(PCI_HOST_PROP_SMM_RANGES, Q35PCIHost,
|
|
|
|
+ mch.has_smm_ranges, true),
|
|
DEFINE_PROP_BOOL("x-pci-hole64-fix", Q35PCIHost, pci_hole64_fix, true),
|
|
DEFINE_PROP_BOOL("x-pci-hole64-fix", Q35PCIHost, pci_hole64_fix, true),
|
|
DEFINE_PROP_END_OF_LIST(),
|
|
DEFINE_PROP_END_OF_LIST(),
|
|
};
|
|
};
|
|
@@ -214,6 +216,7 @@ static void q35_host_initfn(Object *obj)
|
|
/* mch's object_initialize resets the default value, set it again */
|
|
/* mch's object_initialize resets the default value, set it again */
|
|
qdev_prop_set_uint64(DEVICE(s), PCI_HOST_PROP_PCI_HOLE64_SIZE,
|
|
qdev_prop_set_uint64(DEVICE(s), PCI_HOST_PROP_PCI_HOLE64_SIZE,
|
|
Q35_PCI_HOST_HOLE64_SIZE_DEFAULT);
|
|
Q35_PCI_HOST_HOLE64_SIZE_DEFAULT);
|
|
|
|
+
|
|
object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_START, "uint32",
|
|
object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_START, "uint32",
|
|
q35_host_get_pci_hole_start,
|
|
q35_host_get_pci_hole_start,
|
|
NULL, NULL, NULL);
|
|
NULL, NULL, NULL);
|
|
@@ -476,6 +479,10 @@ static void mch_write_config(PCIDevice *d,
|
|
mch_update_pciexbar(mch);
|
|
mch_update_pciexbar(mch);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (!mch->has_smm_ranges) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (ranges_overlap(address, len, MCH_HOST_BRIDGE_SMRAM,
|
|
if (ranges_overlap(address, len, MCH_HOST_BRIDGE_SMRAM,
|
|
MCH_HOST_BRIDGE_SMRAM_SIZE)) {
|
|
MCH_HOST_BRIDGE_SMRAM_SIZE)) {
|
|
mch_update_smram(mch);
|
|
mch_update_smram(mch);
|
|
@@ -494,10 +501,13 @@ static void mch_write_config(PCIDevice *d,
|
|
static void mch_update(MCHPCIState *mch)
|
|
static void mch_update(MCHPCIState *mch)
|
|
{
|
|
{
|
|
mch_update_pciexbar(mch);
|
|
mch_update_pciexbar(mch);
|
|
|
|
+
|
|
mch_update_pam(mch);
|
|
mch_update_pam(mch);
|
|
- mch_update_smram(mch);
|
|
|
|
- mch_update_ext_tseg_mbytes(mch);
|
|
|
|
- mch_update_smbase_smram(mch);
|
|
|
|
|
|
+ if (mch->has_smm_ranges) {
|
|
|
|
+ mch_update_smram(mch);
|
|
|
|
+ mch_update_ext_tseg_mbytes(mch);
|
|
|
|
+ mch_update_smbase_smram(mch);
|
|
|
|
+ }
|
|
|
|
|
|
/*
|
|
/*
|
|
* pci hole goes from end-of-low-ram to io-apic.
|
|
* pci hole goes from end-of-low-ram to io-apic.
|
|
@@ -538,18 +548,20 @@ static void mch_reset(DeviceState *qdev)
|
|
pci_set_quad(d->config + MCH_HOST_BRIDGE_PCIEXBAR,
|
|
pci_set_quad(d->config + MCH_HOST_BRIDGE_PCIEXBAR,
|
|
MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT);
|
|
MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT);
|
|
|
|
|
|
- d->config[MCH_HOST_BRIDGE_SMRAM] = MCH_HOST_BRIDGE_SMRAM_DEFAULT;
|
|
|
|
- d->config[MCH_HOST_BRIDGE_ESMRAMC] = MCH_HOST_BRIDGE_ESMRAMC_DEFAULT;
|
|
|
|
- d->wmask[MCH_HOST_BRIDGE_SMRAM] = MCH_HOST_BRIDGE_SMRAM_WMASK;
|
|
|
|
- d->wmask[MCH_HOST_BRIDGE_ESMRAMC] = MCH_HOST_BRIDGE_ESMRAMC_WMASK;
|
|
|
|
|
|
+ if (mch->has_smm_ranges) {
|
|
|
|
+ d->config[MCH_HOST_BRIDGE_SMRAM] = MCH_HOST_BRIDGE_SMRAM_DEFAULT;
|
|
|
|
+ d->config[MCH_HOST_BRIDGE_ESMRAMC] = MCH_HOST_BRIDGE_ESMRAMC_DEFAULT;
|
|
|
|
+ d->wmask[MCH_HOST_BRIDGE_SMRAM] = MCH_HOST_BRIDGE_SMRAM_WMASK;
|
|
|
|
+ d->wmask[MCH_HOST_BRIDGE_ESMRAMC] = MCH_HOST_BRIDGE_ESMRAMC_WMASK;
|
|
|
|
|
|
- if (mch->ext_tseg_mbytes > 0) {
|
|
|
|
- pci_set_word(d->config + MCH_HOST_BRIDGE_EXT_TSEG_MBYTES,
|
|
|
|
- MCH_HOST_BRIDGE_EXT_TSEG_MBYTES_QUERY);
|
|
|
|
- }
|
|
|
|
|
|
+ if (mch->ext_tseg_mbytes > 0) {
|
|
|
|
+ pci_set_word(d->config + MCH_HOST_BRIDGE_EXT_TSEG_MBYTES,
|
|
|
|
+ MCH_HOST_BRIDGE_EXT_TSEG_MBYTES_QUERY);
|
|
|
|
+ }
|
|
|
|
|
|
- d->config[MCH_HOST_BRIDGE_F_SMBASE] = 0;
|
|
|
|
- d->wmask[MCH_HOST_BRIDGE_F_SMBASE] = 0xff;
|
|
|
|
|
|
+ d->config[MCH_HOST_BRIDGE_F_SMBASE] = 0;
|
|
|
|
+ d->wmask[MCH_HOST_BRIDGE_F_SMBASE] = 0xff;
|
|
|
|
+ }
|
|
|
|
|
|
mch_update(mch);
|
|
mch_update(mch);
|
|
}
|
|
}
|
|
@@ -578,6 +590,10 @@ static void mch_realize(PCIDevice *d, Error **errp)
|
|
PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE);
|
|
PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (!mch->has_smm_ranges) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
/* if *disabled* show SMRAM to all CPUs */
|
|
/* if *disabled* show SMRAM to all CPUs */
|
|
memory_region_init_alias(&mch->smram_region, OBJECT(mch), "smram-region",
|
|
memory_region_init_alias(&mch->smram_region, OBJECT(mch), "smram-region",
|
|
mch->pci_address_space, MCH_HOST_BRIDGE_SMRAM_C_BASE,
|
|
mch->pci_address_space, MCH_HOST_BRIDGE_SMRAM_C_BASE,
|