From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web09.92683.1638368224900296564 for ; Wed, 01 Dec 2021 06:17:05 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JW86JrTy; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638368224; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=catc8dDWDNThF+C8efmWbNk/AvHAKxIeIwgFB245DZI=; b=JW86JrTyI1laFYe6vbFBqcgqEeofTkBhnjsv1rR+Aawtk748DeHe7zSWHFhR2ZlxYYXbBr tZIwswxxtTFXu+nIJ0CRLkiGeQDo+goSf2g+SSQGtfthuUrEpHqeIOuNn8+h4CYQ0Mauzi GUOzu9QBb8jPD5ElJIDFxYlfFdxx6ms= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-350-yEwQ--cjMOmm-Wg_u2fxSA-1; Wed, 01 Dec 2021 09:16:59 -0500 X-MC-Unique: yEwQ--cjMOmm-Wg_u2fxSA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 82F6510199BD; Wed, 1 Dec 2021 14:16:58 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 32CC17944C; Wed, 1 Dec 2021 14:16:58 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 6E32D1800922; Wed, 1 Dec 2021 15:16:56 +0100 (CET) Date: Wed, 1 Dec 2021 15:16:56 +0100 From: "Gerd Hoffmann" 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 Message-ID: <20211201141656.v32ehkm75pnnpql4@sirius.home.kraxel.org> References: <699f8ae9384b47d66f35f3ab939014190049cdab.1638351613.git.sebastien.boeuf@intel.com> MIME-Version: 1.0 In-Reply-To: <699f8ae9384b47d66f35f3ab939014190049cdab.1638351613.git.sebastien.boeuf@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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