public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gerd Hoffmann" <kraxel@redhat.com>
To: sebastien.boeuf@intel.com
Cc: devel@edk2.groups.io, jiewen.yao@intel.com, jordan.l.justen@intel.com
Subject: Re: [PATCH 1/5] OvmfPkg: Handle Cloud Hypervisor host bridge
Date: Wed, 1 Dec 2021 15:16:56 +0100	[thread overview]
Message-ID: <20211201141656.v32ehkm75pnnpql4@sirius.home.kraxel.org> (raw)
In-Reply-To: <699f8ae9384b47d66f35f3ab939014190049cdab.1638351613.git.sebastien.boeuf@intel.com>

  Hi,

> +    case CLOUDHV_DEVICE_ID: // Cloud Hypervisor host bridge

No need for the comment ...

> +++ b/OvmfPkg/Include/IndustryStandard/CloudHv.h
> @@ -0,0 +1,35 @@
> +/** @file
> +  Various defines related to Cloud Hypervisor
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +#ifndef __CLOUDHV_H__
> +#define __CLOUDHV_H__
> +
> +//
> +// Host Bridge Device ID
> +//
> +#define CLOUDHV_DEVICE_ID 0x0d57

... this is enough documentation IMHO.

> +  if (mAcpiPmBaseAddress == 0) {
> +    IoWrite8 (CLOUDHV_ACPI_SHUTDOWN_IO_ADDRESS, 5 << 2 | 1 << 5);

This looks like the sleep control register of the hw-reduced acpi pm
profile.  I'd suggest to use a new variable then, for example use

    mAcpiHwReducedSleepCtl = CLOUDHV_ACPI_SHUTDOWN_IO_ADDRESS

> +    case 0xffff: /* microvm */
> +      return;

Huh?

> @@ -778,21 +782,22 @@ QemuInitializeRam (
>    if (IsMtrrSupported ()) {
>      MtrrGetAllMtrrs (&MtrrSettings);
>  
> -    //
> -    // MTRRs disabled, fixed MTRRs disabled, default type is uncached
> -    //
> -    ASSERT ((MtrrSettings.MtrrDefType & BIT11) == 0);
> -    ASSERT ((MtrrSettings.MtrrDefType & BIT10) == 0);
> -    ASSERT ((MtrrSettings.MtrrDefType & 0xFF) == 0);
> -
> -    //
> -    // flip default type to writeback
> -    //
> -    SetMem (&MtrrSettings.Fixed, sizeof MtrrSettings.Fixed, 0x06);
> -    ZeroMem (&MtrrSettings.Variables, sizeof MtrrSettings.Variables);
> -    MtrrSettings.MtrrDefType |= BIT11 | BIT10 | 6;
> -    MtrrSetAllMtrrs (&MtrrSettings);
> +    if (mHostBridgeDevId != CLOUDHV_DEVICE_ID) {

Do you need the MtrrGetAllMtrrs() call?  If not you can just use this:

   if (IsMtrrSupported () && mHostBridgeDevId != CLOUDHV_DEVICE_ID) 


> @@ -372,14 +375,18 @@ MiscInitialization (
>                               MICROVM_PSEUDO_DEVICE_ID);
>        ASSERT_RETURN_ERROR (PcdStatus);
>        return;
> +    case CLOUDHV_DEVICE_ID:
> +      DEBUG ((DEBUG_INFO, "%a: Cloud Hypervisor host bridge\n", __FUNCTION__));
> +      PcdStatus = PcdSet16S (PcdOvmfHostBridgePciDevId,
> +                             CLOUDHV_DEVICE_ID);
> +      ASSERT_RETURN_ERROR (PcdStatus);
> +      return;
>      default:
>        DEBUG ((DEBUG_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n",
>          __FUNCTION__, mHostBridgeDevId));
>        ASSERT (FALSE);
>        return;
>    }
> -  PcdStatus = PcdSet16S (PcdOvmfHostBridgePciDevId, mHostBridgeDevId);
> -  ASSERT_RETURN_ERROR (PcdStatus);

Removing this check looks suspicious.

If it is not needed here for some reason move that change to a separate
patch with a commit message explaining things.

take care,
  Gerd


  reply	other threads:[~2021-12-01 14:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-01 12:01 [PATCH 0/5] Add Cloud Hypervisor support for x86 sebastien.boeuf
2021-12-01 12:01 ` [PATCH 1/5] OvmfPkg: Handle Cloud Hypervisor host bridge sebastien.boeuf
2021-12-01 14:16   ` Gerd Hoffmann [this message]
2021-12-01 12:01 ` [PATCH 2/5] OvmfPkg: Create global entry point for SMBIOS parsing sebastien.boeuf
2021-12-01 14:21   ` Gerd Hoffmann
2021-12-01 12:01 ` [PATCH 3/5] OvmfPkg: Retrieve SMBIOS from Cloud Hypervisor sebastien.boeuf
2021-12-01 14:27   ` Gerd Hoffmann
2021-12-01 12:01 ` [PATCH 4/5] OvmfPkg: Generalize AcpiPlatformDxe sebastien.boeuf
2021-12-01 14:28   ` Gerd Hoffmann
2021-12-01 12:01 ` [PATCH 5/5] OvmfPkg: Install ACPI tables for Cloud Hypervisor sebastien.boeuf
2021-12-01 14:30   ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211201141656.v32ehkm75pnnpql4@sirius.home.kraxel.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox