hw: q35: fix VGA text console with SMM disabled
PATCH 1/1 hw: q35: fix VGA text console with SMM disabled
Work around black screen in VGA mode with SMM disabled.
Required by NVMM, HVF and WHPX backends.
https://gnats.NetBSD.org/59721
https://gitlab.com/qemu-project/qemu/-/issues/2608
https://gitlab.com/qemu-project/qemu/-/work_items/3085
Patch written by Taylor R Campbell <[email protected]>
--- hw/pci-host/q35.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
hw/pci-host/q35.c +13 -9
@@ -372,6 +372,10 @@ static void mch_update_smram(MCHPCIState *mch)memory_region_set_enabled (&mch->high_smram, false); } +if (!mch->has_smm_ranges) { + goto out; + } +if ((pd->config[MCH_HOST_BRIDGE_ESMRAMC ] &MCH_HOST_BRIDGE_ESMRAMC_T_EN ) && (pd->config[MCH_HOST_BRIDGE_SMRAM ] &SMRAM_G_SMRAME )) { switch (pd->config[MCH_HOST_BRIDGE_ESMRAMC] &
@@ -405,7 +409,7 @@ static void mch_update_smram(MCHPCIState *mch) mch->below_4g_mem_size - tseg_size);memory_region_set_alias_offset (&mch->tseg_window, mch->below_4g_mem_size - tseg_size); - +out:memory_region_transaction_commit (); }
@@ -474,15 +478,15 @@ static void mch_write_config(PCIDevice *d,mch_update_pciexbar (mch); } -if (!mch->has_smm_ranges) { -return ; - } -if (ranges_overlap (address, len,MCH_HOST_BRIDGE_SMRAM ,MCH_HOST_BRIDGE_SMRAM_SIZE )) {mch_update_smram (mch); } +if (!mch->has_smm_ranges) { +return ; + } +if (ranges_overlap (address, len,MCH_HOST_BRIDGE_EXT_TSEG_MBYTES ,MCH_HOST_BRIDGE_EXT_TSEG_MBYTES_SIZE )) {mch_update_ext_tseg_mbytes (mch);
@@ -585,10 +589,6 @@ static void mch_realize(PCIDevice *d, Error **errp) PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE); } -if (!mch->has_smm_ranges) { -return ; - } -/* if *disabled* show SMRAM to all CPUs */ memory_region_init_alias(&mch->smram_region, OBJECT(mch), "smram-region", mch->pci_address_space, MCH_HOST_BRIDGE_SMRAM_C_BASE,
@@ -604,6 +604,10 @@ static void mch_realize(PCIDevice *d, Error **errp) &mch->open_high_smram, 1);memory_region_set_enabled (&mch->open_high_smram, false); +if (!mch->has_smm_ranges) { +return ; + } +/* smram, as seen by SMM CPUs */ memory_region_init (&mch->smram,OBJECT (mch),"smram" ,4 * GiB);memory_region_set_enabled (&mch->smram, true);
Signature · 1 line
2.50.1 (Apple Git-155)
Quoted 11 lines · Mohamed Mediouni
Work around black screen in VGA mode with SMM disabled.
Required by NVMM, HVF and WHPX backends.
https://gnats.NetBSD.org/59721
https://gitlab.com/qemu-project/qemu/-/issues/2608
https://gitlab.com/qemu-project/qemu/-/work_items/3085Patch written by Taylor R Campbell <[email protected]>
Signed-off-by Mohamed Mediouni <[email protected]>
Since this is effectively a reworked-for-later-qemu my patch from
https://lore.kernel.org/qemu-devel/[email protected]/,
Thanks,
/mjt
Quoted 70 lines
--- hw/pci-host/q35.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)hw/pci-host/q35.c +13
-9@@ -372,6 +372,10 @@ static void mch_update_smram(MCHPCIState *mch)memory_region_set_enabled (&mch->high_smram, false); } +if (!mch->has_smm_ranges) { + goto out; + } +if ((pd->config[MCH_HOST_BRIDGE_ESMRAMC ] &MCH_HOST_BRIDGE_ESMRAMC_T_EN ) && (pd->config[MCH_HOST_BRIDGE_SMRAM ] &SMRAM_G_SMRAME )) { switch (pd->config[MCH_HOST_BRIDGE_ESMRAMC] &@@ -405,7 +409,7 @@ static void mch_update_smram(MCHPCIState *mch) mch->below_4g_mem_size - tseg_size);memory_region_set_alias_offset (&mch->tseg_window, mch->below_4g_mem_size - tseg_size); - +out:memory_region_transaction_commit (); }@@ -474,15 +478,15 @@ static void mch_write_config(PCIDevice *d,mch_update_pciexbar (mch); } -if (!mch->has_smm_ranges) { -return ; - } -if (ranges_overlap (address, len,MCH_HOST_BRIDGE_SMRAM ,MCH_HOST_BRIDGE_SMRAM_SIZE )) {mch_update_smram (mch); } +if (!mch->has_smm_ranges) { +return ; + } +if (ranges_overlap (address, len,MCH_HOST_BRIDGE_EXT_TSEG_MBYTES ,MCH_HOST_BRIDGE_EXT_TSEG_MBYTES_SIZE )) {mch_update_ext_tseg_mbytes (mch);@@ -585,10 +589,6 @@ static void mch_realize(PCIDevice *d, Error **errp) PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE); } -if (!mch->has_smm_ranges) { -return ; - } -/* if *disabled* show SMRAM to all CPUs */ memory_region_init_alias(&mch->smram_region, OBJECT(mch), "smram-region", mch->pci_address_space, MCH_HOST_BRIDGE_SMRAM_C_BASE,@@ -604,6 +604,10 @@ static void mch_realize(PCIDevice *d, Error **errp) &mch->open_high_smram, 1);memory_region_set_enabled (&mch->open_high_smram, false); +if (!mch->has_smm_ranges) { +return ; + } +/* smram, as seen by SMM CPUs */ memory_region_init (&mch->smram,OBJECT (mch),"smram" ,4 * GiB);memory_region_set_enabled (&mch->smram, true);
Philippe Mathieu-Daudé
Reviewed-byQuoted 11 lines · Michael Tokarev
Quoted 10 lines · Mohamed Mediouni
Work around black screen in VGA mode with SMM disabled.
Required by NVMM, HVF and WHPX backends.
https://gnats.NetBSD.org/59721
https://gitlab.com/qemu-project/qemu/-/issues/2608
https://gitlab.com/qemu-project/qemu/-/work_items/3085Patch written by Taylor R Campbell <[email protected]>
Quoted 7 lines
Quoted 1 line
Signed-off-by Mohamed Mediouni <[email protected]>Since this is effectively a reworked-for-later-qemu my patch from
https://lore.kernel.org/qemu-devel/3458e5b7-b53e-4057- [email protected]/,Signed-off-by Michael Tokarev <[email protected]>
Quoted 71 lines
Thanks,
/mjt
Quoted 64 lines
---
hw/pci-host/q35.c| 22 +++++++++++++---------1 file changed, 13 insertions(+), 9 deletions(-)hw/pci-host/q35.c +4
-0@@ -372,6 +372,10 @@ static void mch_update_smram(MCHPCIState *mch) memory_region_set_enabled(&mch->high_smram, false); } + if (!mch->has_smm_ranges) { + goto out; + } +if ((pd->config[MCH_HOST_BRIDGE_ESMRAMC] &
MCH_HOST_BRIDGE_ESMRAMC_T_EN) && (pd->config[MCH_HOST_BRIDGE_SMRAM] &SMRAM_G_SMRAME)) { switch (pd->config[MCH_HOST_BRIDGE_ESMRAMC] &hw/pci-host/q35.c +9
-9@@ -405,7 +409,7 @@ static void mch_update_smram(MCHPCIState *mch) mch->below_4g_mem_size - tseg_size); memory_region_set_alias_offset(&mch->tseg_window, mch->below_4g_mem_size - tseg_size); - +out: memory_region_transaction_commit(); }@@ -474,15 +478,15 @@ static void mch_write_config(PCIDevice *d, mch_update_pciexbar(mch); } - if (!mch->has_smm_ranges) { - return; - } - if (ranges_overlap(address, len, MCH_HOST_BRIDGE_SMRAM, MCH_HOST_BRIDGE_SMRAM_SIZE)) { mch_update_smram(mch); } + if (!mch->has_smm_ranges) { + return; + } + if (ranges_overlap(address, len, MCH_HOST_BRIDGE_EXT_TSEG_MBYTES, MCH_HOST_BRIDGE_EXT_TSEG_MBYTES_SIZE)) { mch_update_ext_tseg_mbytes(mch);@@ -585,10 +589,6 @@ static void mch_realize(PCIDevice *d, Error **errp) PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE); } - if (!mch->has_smm_ranges) { - return; - } - /* if *disabled* show SMRAM to all CPUs */ memory_region_init_alias(&mch->smram_region, OBJECT(mch), "smram-region", mch->pci_address_space, MCH_HOST_BRIDGE_SMRAM_C_BASE,@@ -604,6 +604,10 @@ static void mch_realize(PCIDevice *d, Error **errp) &mch->open_high_smram, 1); memory_region_set_enabled(&mch->open_high_smram, false); + if (!mch->has_smm_ranges) { + return; + } + /* smram, as seen by SMM CPUs */ memory_region_init(&mch->smram, OBJECT(mch), "smram", 4 * GiB); memory_region_set_enabled(&mch->smram, true);