qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] q35:Enable TSEG only when G_SMRAME and TSEG_EN both enabled
@ 2022-06-15  3:45 Zhenzhong Duan
  2022-06-15  6:57 ` Gerd Hoffmann
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Zhenzhong Duan @ 2022-06-15  3:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst, marcel.apfelbaum, lersek, imammedo, kraxel

According to spec:
"TSEG Enable (T_EN): Enabling of SMRAM memory for Extended SMRAM space
only. When G_SMRAME = 1 and TSEG_EN = 1, the TSEG is enabled to appear
in the appropriate physical address space. Note that once D_LCK is set,
this bit becomes read only."

Changed to match the spec description.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
 hw/pci-host/q35.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index ab5a47aff560..20da1213747c 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -379,7 +379,8 @@ static void mch_update_smram(MCHPCIState *mch)
         memory_region_set_enabled(&mch->high_smram, false);
     }
 
-    if (pd->config[MCH_HOST_BRIDGE_ESMRAMC] & MCH_HOST_BRIDGE_ESMRAMC_T_EN) {
+    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] &
                 MCH_HOST_BRIDGE_ESMRAMC_TSEG_SZ_MASK) {
         case MCH_HOST_BRIDGE_ESMRAMC_TSEG_SZ_1MB:
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] q35:Enable TSEG only when G_SMRAME and TSEG_EN both enabled
  2022-06-15  3:45 [PATCH] q35:Enable TSEG only when G_SMRAME and TSEG_EN both enabled Zhenzhong Duan
@ 2022-06-15  6:57 ` Gerd Hoffmann
  2022-06-15  8:44 ` Paolo Bonzini
  2022-06-15  8:59 ` Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2022-06-15  6:57 UTC (permalink / raw)
  To: Zhenzhong Duan; +Cc: qemu-devel, mst, marcel.apfelbaum, lersek, imammedo

On Wed, Jun 15, 2022 at 11:45:01AM +0800, Zhenzhong Duan wrote:
> According to spec:
> "TSEG Enable (T_EN): Enabling of SMRAM memory for Extended SMRAM space
> only. When G_SMRAME = 1 and TSEG_EN = 1, the TSEG is enabled to appear
> in the appropriate physical address space. Note that once D_LCK is set,
> this bit becomes read only."

edk2 agrees and explicitly sets SMRAM_G_SMRAME:

  //
  // TSEG should be closed (see above), but unlocked, initially. Set G_SMRAME
  // (Global SMRAM Enable) too, as both D_LCK and T_EN depend on it.
  //
  PciAndThenOr8 (
    DRAMC_REGISTER_Q35 (MCH_SMRAM),
    (UINT8)((~(UINT32)MCH_SMRAM_D_LCK) & 0xff),
    MCH_SMRAM_G_SMRAME
    );

Good.

> -    if (pd->config[MCH_HOST_BRIDGE_ESMRAMC] & MCH_HOST_BRIDGE_ESMRAMC_T_EN) {
> +    if ((pd->config[MCH_HOST_BRIDGE_ESMRAMC] & MCH_HOST_BRIDGE_ESMRAMC_T_EN) &&
> +        (pd->config[MCH_HOST_BRIDGE_SMRAM] & SMRAM_G_SMRAME)) {

Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>

take care,
  Gerd



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] q35:Enable TSEG only when G_SMRAME and TSEG_EN both enabled
  2022-06-15  3:45 [PATCH] q35:Enable TSEG only when G_SMRAME and TSEG_EN both enabled Zhenzhong Duan
  2022-06-15  6:57 ` Gerd Hoffmann
@ 2022-06-15  8:44 ` Paolo Bonzini
  2022-06-15  8:59 ` Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2022-06-15  8:44 UTC (permalink / raw)
  To: Zhenzhong Duan, qemu-devel
  Cc: mst, marcel.apfelbaum, lersek, imammedo, kraxel

On 6/15/22 05:45, Zhenzhong Duan wrote:
> According to spec:
> "TSEG Enable (T_EN): Enabling of SMRAM memory for Extended SMRAM space
> only. When G_SMRAME = 1 and TSEG_EN = 1, the TSEG is enabled to appear
> in the appropriate physical address space. Note that once D_LCK is set,
> this bit becomes read only."
> 
> Changed to match the spec description.
> 
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
> ---
>   hw/pci-host/q35.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
> index ab5a47aff560..20da1213747c 100644
> --- a/hw/pci-host/q35.c
> +++ b/hw/pci-host/q35.c
> @@ -379,7 +379,8 @@ static void mch_update_smram(MCHPCIState *mch)
>           memory_region_set_enabled(&mch->high_smram, false);
>       }
>   
> -    if (pd->config[MCH_HOST_BRIDGE_ESMRAMC] & MCH_HOST_BRIDGE_ESMRAMC_T_EN) {
> +    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] &
>                   MCH_HOST_BRIDGE_ESMRAMC_TSEG_SZ_MASK) {
>           case MCH_HOST_BRIDGE_ESMRAMC_TSEG_SZ_1MB:

Queued, thanks.

paolo


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] q35:Enable TSEG only when G_SMRAME and TSEG_EN both enabled
  2022-06-15  3:45 [PATCH] q35:Enable TSEG only when G_SMRAME and TSEG_EN both enabled Zhenzhong Duan
  2022-06-15  6:57 ` Gerd Hoffmann
  2022-06-15  8:44 ` Paolo Bonzini
@ 2022-06-15  8:59 ` Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2022-06-15  8:59 UTC (permalink / raw)
  To: Zhenzhong Duan
  Cc: qemu-devel, mst, marcel.apfelbaum, lersek, imammedo, kraxel

Queued, thanks.

Paolo




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-15  9:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-15  3:45 [PATCH] q35:Enable TSEG only when G_SMRAME and TSEG_EN both enabled Zhenzhong Duan
2022-06-15  6:57 ` Gerd Hoffmann
2022-06-15  8:44 ` Paolo Bonzini
2022-06-15  8:59 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).