From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web11.33810.1613997106117097175 for ; Mon, 22 Feb 2021 04:31:46 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FSyNu4Ad; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613997105; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3O0EMjtD+j/C7DNDhiKazeQoZIRhvxQylsTmvvR+wNA=; b=FSyNu4AdlQmBORxFrs7eNDtjPuP9hzATxW9EpUadKeJVvnKe2Q8hEiXAUXXk5CV/MKJGNO JicG/YHxqsPEw7DnorWDW4Lrll9r9yNOM1UXB0js6m18Y9LK6HcTvnI3zZAIvg10wTHOX9 j1EQrJiImadAfv//Tdb0WpnqYa+Y5s8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-493-pLWMXAFYN3uCEdVtAm9Psg-1; Mon, 22 Feb 2021 07:31:41 -0500 X-MC-Unique: pLWMXAFYN3uCEdVtAm9Psg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CFD596D4E3; Mon, 22 Feb 2021 12:31:39 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-67.ams2.redhat.com [10.36.113.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5423C5D6B1; Mon, 22 Feb 2021 12:31:38 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v8 03/10] OvmfPkg/CpuHotplugSmm: add Qemu Cpu Status helper To: devel@edk2.groups.io, ankur.a.arora@oracle.com Cc: imammedo@redhat.com, boris.ostrovsky@oracle.com, Jordan Justen , Ard Biesheuvel , Aaron Young References: <20210222071928.1401820-1-ankur.a.arora@oracle.com> <20210222071928.1401820-4-ankur.a.arora@oracle.com> From: "Laszlo Ersek" Message-ID: Date: Mon, 22 Feb 2021 13:31:37 +0100 MIME-Version: 1.0 In-Reply-To: <20210222071928.1401820-4-ankur.a.arora@oracle.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 02/22/21 08:19, Ankur Arora wrote: > Add QemuCpuhpWriteCpuStatus() which will be used to update the QEMU > CPU status register. On error, it hangs in a similar fashion as > other helper functions. > > Cc: Laszlo Ersek > Cc: Jordan Justen > Cc: Ard Biesheuvel > Cc: Igor Mammedov > Cc: Boris Ostrovsky > Cc: Aaron Young > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3132 > Signed-off-by: Ankur Arora > --- > > Notes: > Address this review comment: > () Move QemuCpuhpWriteCpuStatus() (declaration and definition) between > QemuCpuhpWriteCpuSelector() and QemuCpuhpWriteCommand() to match > the order of the register descriptions in QEMU. > > OvmfPkg/CpuHotplugSmm/QemuCpuhp.h | 6 ++++++ > OvmfPkg/CpuHotplugSmm/QemuCpuhp.c | 22 ++++++++++++++++++++++ > 2 files changed, 28 insertions(+) > > diff --git a/OvmfPkg/CpuHotplugSmm/QemuCpuhp.h b/OvmfPkg/CpuHotplugSmm/QemuCpuhp.h > index 1e23b150910e..859412c1a173 100644 > --- a/OvmfPkg/CpuHotplugSmm/QemuCpuhp.h > +++ b/OvmfPkg/CpuHotplugSmm/QemuCpuhp.h > @@ -42,6 +42,12 @@ QemuCpuhpWriteCpuSelector ( > ); > > VOID > +QemuCpuhpWriteCpuStatus ( > + IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo, > + IN UINT8 CpuStatus > + ); > + > +VOID > QemuCpuhpWriteCommand ( > IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo, > IN UINT8 Command > diff --git a/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c b/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c > index 36372a5e6193..9434bb14dd4e 100644 > --- a/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c > +++ b/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c > @@ -114,6 +114,28 @@ QemuCpuhpWriteCpuSelector ( > } > > VOID > +QemuCpuhpWriteCpuStatus ( > + IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo, > + IN UINT8 CpuStatus > + ) > +{ > + EFI_STATUS Status; > + > + Status = MmCpuIo->Io.Write ( > + MmCpuIo, > + MM_IO_UINT8, > + ICH9_CPU_HOTPLUG_BASE + QEMU_CPUHP_R_CPU_STAT, > + 1, > + &CpuStatus > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, Status)); > + ASSERT (FALSE); > + CpuDeadLoop (); > + } > +} > + > +VOID > QemuCpuhpWriteCommand ( > IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo, > IN UINT8 Command > Reviewed-by: Laszlo Ersek