NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/59721: qemu VM's blackscreen over VNC wth -machine q35



The following reply was made to PR kern/59721; it has been noted by GNATS.

From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: Roy Marples <roy%marples.name@localhost>,
	Michael van Elst <mlelstv%serpens.de@localhost>,
	Martin Husemann <martin%duskware.de@localhost>
Cc: gnats-bugs%NetBSD.org@localhost, netbsd-bugs%NetBSD.org@localhost
Subject: Re: kern/59721: qemu VM's blackscreen over VNC wth -machine q35
Date: Mon, 27 Oct 2025 01:15:09 +0000

 This is a multi-part message in MIME format.
 --=_17Wymd7lPaKOmlAiVMiz9N/EY5eA0fm1
 
 The attached patch to qemu makes q35 with smm=off -- or with nvmm --
 work to display a VGA console again on my machine.
 
 As workarounds pending an upstream fix or pkgsrc patch, you can:
 
 1. use serial console instead of graphical console,
 
 2. use OVMF for UEFI boot rather than SeaBIOS for BIOS boot, by adding
    `-bios $LOCALBASE/share/ovmf/OVMFX64.fd' to qemu arguments
 
 --=_17Wymd7lPaKOmlAiVMiz9N/EY5eA0fm1
 Content-Type: text/plain; charset="ISO-8859-1"; name="patch-hw_pci-host_q35"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment; filename="patch-hw_pci-host_q35.c"
 
 $NetBSD$
 
 Work around black screen in VGA mode with SMM disabled, as required by,
 e.g., NVMM:
 
 https://gnats.NetBSD.org/59721
 https://gitlab.com/qemu-project/qemu/-/issues/2608
 
 --- hw/pci-host/q35.c.orig	2025-10-08 20:50:34.000000000 +0000
 +++ hw/pci-host/q35.c
 @@ -373,6 +373,10 @@ static void mch_update_smram(MCHPCIState
          memory_region_set_enabled(&mch->high_smram, false);
      }
 =20
 +    if (!mch->has_smm_ranges) {
 +        goto out;
 +    }
 +
      if ((pd->config[MCH_HOST_BRIDGE_ESMRAMC] & MCH_HOST_BRIDGE_ESMRAMC_T_E=
 N) &&
          (pd->config[MCH_HOST_BRIDGE_SMRAM] & SMRAM_G_SMRAME)) {
          switch (pd->config[MCH_HOST_BRIDGE_ESMRAMC] &
 @@ -406,7 +410,7 @@ static void mch_update_smram(MCHPCIState
                                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();
  }
 =20
 @@ -478,15 +482,15 @@ static void mch_write_config(PCIDevice *
          mch_update_pciexbar(mch);
      }
 =20
 -    if (!mch->has_smm_ranges) {
 -        return;
 -    }
 -
      if (ranges_overlap(address, len, MCH_HOST_BRIDGE_SMRAM,
                         MCH_HOST_BRIDGE_SMRAM_SIZE)) {
          mch_update_smram(mch);
      }
 =20
 +    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);
 @@ -589,10 +593,6 @@ static void mch_realize(PCIDevice *d, Er
                   PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE);
      }
 =20
 -    if (!mch->has_smm_ranges) {
 -        return;
 -    }
 -
      /* if *disabled* show SMRAM to all CPUs */
      memory_region_init_alias(&mch->smram_region, OBJECT(mch), "smram-regio=
 n",
                               mch->pci_address_space, MCH_HOST_BRIDGE_SMRAM=
 _C_BASE,
 @@ -608,6 +608,10 @@ static void mch_realize(PCIDevice *d, Er
                                          &mch->open_high_smram, 1);
      memory_region_set_enabled(&mch->open_high_smram, false);
 =20
 +    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);
 
 --=_17Wymd7lPaKOmlAiVMiz9N/EY5eA0fm1--
 


Home | Main Index | Thread Index | Old Index