From nobody Tue Jan 21 08:31:45 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of groups.io designates
 66.175.222.108 as permitted sender) client-ip=66.175.222.108;
 envelope-from=bounce+27952+105560+1787277+3901457@groups.io;
 helo=mail02.groups.io;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as
 permitted sender)
  smtp.mailfrom=bounce+27952+105560+1787277+3901457@groups.io;
	dmarc=fail(p=none dis=none)  header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1685620644; cv=none;
	d=zohomail.com; s=zohoarc;
	b=WTXTTgcMwHNXPw2ZyN5jAEvtNsiELCmZBBpiJwXyOPGiWbzzQXH+q8QYVf4qsGiyZ7SXnLtNAPD+bcDJFlBDhD537Vp2aMAkzakcuBxjt33XyhURv3c7ecz8t1GKwUWM6G7RTBCYKZ3ljpp8rpFWJmoCdwxtbw+LHOgNKjf0cXg=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1685620644;
 h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To;
	bh=YBUiTyGgvfrJarp4TTXGN5Czoqj+1KdTOUqhpOlNYWk=;
	b=RQVud6rIc+n5qAq8mE/y0Ra/yX9jp4CJtPmwK8c3mL3bRg+NJxzBMygbwTtnUd++BMxEeOZdS4jyU5UGLSebwkV9OZdivBoUFvdPBiw13HwZvwvNTuHKgVynZy1AEGJUpCeKUAcqKvgMVH0Wb9+rVolMZEAmsiHlByIrRsKNOqY=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as
 permitted sender)
  smtp.mailfrom=bounce+27952+105560+1787277+3901457@groups.io;
	dmarc=fail header.from=<kraxel@redhat.com> (p=none dis=none)
Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by
 mx.zohomail.com
	with SMTPS id 1685620643996130.50445859319632;
 Thu, 1 Jun 2023 04:57:23 -0700 (PDT)
Return-Path: <bounce+27952+105560+1787277+3901457@groups.io>
X-Received: by 127.0.0.2 with SMTP id H5GkYY1788612xg35QjzGyay;
 Thu, 01 Jun 2023 04:57:23 -0700
X-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.web11.29288.1685620642883886459
 for <devel@edk2.groups.io>;
 Thu, 01 Jun 2023 04:57:23 -0700
X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
 [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 us-mta-284-XmF5_oZEP_qfFFA1l7UsQQ-1; Thu, 01 Jun 2023 07:57:15 -0400
X-MC-Unique: XmF5_oZEP_qfFFA1l7UsQQ-1
X-Received: from smtp.corp.redhat.com
 (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 480BE101A53A;
	Thu,  1 Jun 2023 11:57:15 +0000 (UTC)
X-Received: from sirius.home.kraxel.org (unknown [10.39.192.155])
	by smtp.corp.redhat.com (Postfix) with ESMTPS id 07F8D112132D;
	Thu,  1 Jun 2023 11:57:15 +0000 (UTC)
X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000)
	id BB6DD18007B7; Thu,  1 Jun 2023 13:57:13 +0200 (CEST)
From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: Jiewen Yao <jiewen.yao@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Leif Lindholm <quic_llindhol@quicinc.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Oliver Steffen <osteffen@redhat.com>,
	Pawel Polawski <ppolawsk@redhat.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Sami Mujawar <sami.mujawar@arm.com>,
	Ard Biesheuvel <ardb@kernel.org>
Subject: [edk2-devel] [PATCH v2 1/4] ArmVirt: add VirtioSerialDxe to
 ArmVirtQemu builds
Date: Thu,  1 Jun 2023 13:57:10 +0200
Message-Id: <20230601115713.1212372-2-kraxel@redhat.com>
In-Reply-To: <20230601115713.1212372-1-kraxel@redhat.com>
References: <20230601115713.1212372-1-kraxel@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Precedence: Bulk
List-Unsubscribe: <mailto:devel+unsubscribe@edk2.groups.io>
List-Subscribe: <mailto:devel+subscribe@edk2.groups.io>
List-Help: <mailto:devel+help@edk2.groups.io>
Sender: devel@edk2.groups.io
List-Id: <devel.edk2.groups.io>
Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io
Reply-To: devel@edk2.groups.io,kraxel@redhat.com
X-Gm-Message-State: nyYgERjECpQnrWsNV6X97F9gx1787277AA=
Content-Transfer-Encoding: quoted-printable
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io;
 q=dns/txt; s=20140610; t=1685620643;
 bh=7FhfbWC9Btj8oxeDD/S+31q6QjAvf2TobvvGfbEsh4M=;
 h=Cc:Content-Type:Date:From:Reply-To:Subject:To;
 b=jNpvYSLlfbvPpfJqEGGGjxuOCENi42ulx9o4NTgiAR2vKppiLWgjaSwd1B8E2K+QGt3
 jRxHjx73Q3FHgBpoCDmApgreOnyNIxu3rksysHG9j/Q4AABeXSwxuR/sS+H4nNOl1CKjA
 NA9PeM8j5Ui9nu5oxZQcode0CRoeWwF7L40=
X-ZohoMail-DKIM: pass (identity @groups.io)
X-ZM-MESSAGEID: 1685620646046100017
Content-Type: text/plain; charset="utf-8"; x-default="true"

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
---
 ArmVirtPkg/ArmVirtQemu.dsc           | 1 +
 ArmVirtPkg/ArmVirtQemuKernel.dsc     | 1 +
 ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 1 +
 3 files changed, 3 insertions(+)

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 449e73b9e132..d998f816b2b3 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -448,6 +448,7 @@ [Components.common]
   OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
   OvmfPkg/VirtioNetDxe/VirtioNet.inf
   OvmfPkg/VirtioRngDxe/VirtioRng.inf
+  OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
=20
   #
   # FAT filesystem + GPT/MBR partitioning + UDF filesystem + virtio-fs
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKerne=
l.dsc
index 3cb9120e4e10..c9d2b18392b9 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -353,6 +353,7 @@ [Components.common]
   OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
   OvmfPkg/VirtioNetDxe/VirtioNet.inf
   OvmfPkg/VirtioRngDxe/VirtioRng.inf
+  OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
=20
   #
   # FAT filesystem + GPT/MBR partitioning + UDF filesystem + virtio-fs
diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc b/ArmVirtPkg/ArmVirtQemuF=
vMain.fdf.inc
index 8a063bac04ac..2894bc853a46 100644
--- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
+++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
@@ -98,6 +98,7 @@ [FV.FvMain]
   INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
   INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
   INF OvmfPkg/VirtioRngDxe/VirtioRng.inf
+  INF OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
=20
   INF ShellPkg/Application/Shell/Shell.inf
   INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
--=20
2.40.1




-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105560): https://edk2.groups.io/g/devel/message/105560
Mute This Topic: https://groups.io/mt/99261955/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
From nobody Tue Jan 21 08:31:45 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of groups.io designates
 66.175.222.108 as permitted sender) client-ip=66.175.222.108;
 envelope-from=bounce+27952+105558+1787277+3901457@groups.io;
 helo=mail02.groups.io;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as
 permitted sender)
  smtp.mailfrom=bounce+27952+105558+1787277+3901457@groups.io;
	dmarc=fail(p=none dis=none)  header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1685620642; cv=none;
	d=zohomail.com; s=zohoarc;
	b=jatBp50RHpHW/LJ7Wrt+WoSjcwIWZBnDSWRx9R2MKXpezaX9fxlHl2WN+maJsyrq3YfZhVNUYgNMXWBYlYCGx55+GufHfjN+/mGCDo5UyZXZ4PRo8hVD5Lh0t3iD/yG1lNQCCZt0WfmDclGsQunjPMCTLigotw7HMj88jjlhnHg=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1685620642;
 h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To;
	bh=85Efz213Pi7SN3Nq+NgGQ3MIqcX0VbsbQdnLd6xK5WM=;
	b=G3sHU9piUScRv7YF9YO8LSo001IA1fJsTDtoUDEm+Td2WCR86UleugUyvjGT7ZKkE7pENHdzmCP2okfPm1k8UnUxS8pcogP6k/3JI8nJPZiwJQFaGGfyt/hBK9i2C6+YXp3a7hG5nmxlgLVOzXXTvZHHD/+XeNzTgV/SrMjIEls=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as
 permitted sender)
  smtp.mailfrom=bounce+27952+105558+1787277+3901457@groups.io;
	dmarc=fail header.from=<kraxel@redhat.com> (p=none dis=none)
Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by
 mx.zohomail.com
	with SMTPS id 1685620642729344.78547942612397;
 Thu, 1 Jun 2023 04:57:22 -0700 (PDT)
Return-Path: <bounce+27952+105558+1787277+3901457@groups.io>
X-Received: by 127.0.0.2 with SMTP id GhMtYY1788612xfoTTZ7oNdS;
 Thu, 01 Jun 2023 04:57:22 -0700
X-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.web11.29284.1685620640990738195
 for <devel@edk2.groups.io>;
 Thu, 01 Jun 2023 04:57:21 -0700
X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
 [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 us-mta-74-T1v3lqBcNSK25sld78kdnQ-1; Thu, 01 Jun 2023 07:57:17 -0400
X-MC-Unique: T1v3lqBcNSK25sld78kdnQ-1
X-Received: from smtp.corp.redhat.com
 (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 95DE1101A55C;
	Thu,  1 Jun 2023 11:57:16 +0000 (UTC)
X-Received: from sirius.home.kraxel.org (unknown [10.39.192.155])
	by smtp.corp.redhat.com (Postfix) with ESMTPS id 5AD89492B00;
	Thu,  1 Jun 2023 11:57:16 +0000 (UTC)
X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000)
	id BFDCB1800934; Thu,  1 Jun 2023 13:57:13 +0200 (CEST)
From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: Jiewen Yao <jiewen.yao@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Leif Lindholm <quic_llindhol@quicinc.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Oliver Steffen <osteffen@redhat.com>,
	Pawel Polawski <ppolawsk@redhat.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Sami Mujawar <sami.mujawar@arm.com>,
	Ard Biesheuvel <ardb@kernel.org>
Subject: [edk2-devel] [PATCH v2 2/4] ArmVirt/PlatformBootManagerLib: factor
 out IsVirtio()
Date: Thu,  1 Jun 2023 13:57:11 +0200
Message-Id: <20230601115713.1212372-3-kraxel@redhat.com>
In-Reply-To: <20230601115713.1212372-1-kraxel@redhat.com>
References: <20230601115713.1212372-1-kraxel@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Precedence: Bulk
List-Unsubscribe: <mailto:devel+unsubscribe@edk2.groups.io>
List-Subscribe: <mailto:devel+subscribe@edk2.groups.io>
List-Help: <mailto:devel+help@edk2.groups.io>
Sender: devel@edk2.groups.io
List-Id: <devel.edk2.groups.io>
Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io
Reply-To: devel@edk2.groups.io,kraxel@redhat.com
X-Gm-Message-State: kfNTwlH5aJIrkoVSZbHokJfpx1787277AA=
Content-Transfer-Encoding: quoted-printable
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io;
 q=dns/txt; s=20140610; t=1685620642;
 bh=M4Aqj9WmpHcglUidHCg51Y5xoEcjEJL+6Y6QtIBhK0Y=;
 h=Cc:Content-Type:Date:From:Reply-To:Subject:To;
 b=V6jIhDczm7iqxeSpf+9yhaswoRaNfBk25g54lsXnBRM/SPseGpD/GYevfWIcmRfnDgx
 LMWCFkuuqohgXWI8lfJ3erBymwL1uA3wPVTwPr7YVrLrzVw+Z+Ciqx1ceCs2rh2lAMAax
 /utfwD50IvJUuE2Q0dCjOy2u20i3q7bHTeQ=
X-ZohoMail-DKIM: pass (identity @groups.io)
X-ZM-MESSAGEID: 1685620644035100003
Content-Type: text/plain; charset="utf-8"; x-default="true"

IsVirtioRng() becomes just a thin wrapper for IsVirtio().
This allows to add similar thin wrappers for other virtio
devices in the future.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
---
 .../PlatformBootManagerLib/PlatformBm.c       | 26 +++++++++++++++----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVi=
rtPkg/Library/PlatformBootManagerLib/PlatformBm.c
index 10c815378cd5..5eb6f0f9c14a 100644
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
@@ -269,15 +269,16 @@ IsPciDisplay (
 }
=20
 /**
-  This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG devi=
ce at
-  the VIRTIO_DEVICE_PROTOCOL level.
+  This function checks if a handle corresponds to the Virtio Device ID giv=
en
+  at the VIRTIO_DEVICE_PROTOCOL level.
 **/
 STATIC
 BOOLEAN
 EFIAPI
-IsVirtioRng (
+IsVirtio (
   IN EFI_HANDLE    Handle,
-  IN CONST CHAR16  *ReportText
+  IN CONST CHAR16  *ReportText,
+  IN UINT16        VirtIoDeviceId
   )
 {
   EFI_STATUS              Status;
@@ -293,7 +294,22 @@ IsVirtioRng (
   }
=20
   return (BOOLEAN)(VirtIo->SubSystemDeviceId =3D=3D
-                   VIRTIO_SUBSYSTEM_ENTROPY_SOURCE);
+                   VirtIoDeviceId);
+}
+
+/**
+  This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG devi=
ce at
+  the VIRTIO_DEVICE_PROTOCOL level.
+**/
+STATIC
+BOOLEAN
+EFIAPI
+IsVirtioRng (
+  IN EFI_HANDLE    Handle,
+  IN CONST CHAR16  *ReportText
+  )
+{
+  return IsVirtio (Handle, ReportText, VIRTIO_SUBSYSTEM_ENTROPY_SOURCE);
 }
=20
 /**
--=20
2.40.1




-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105558): https://edk2.groups.io/g/devel/message/105558
Mute This Topic: https://groups.io/mt/99261952/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
From nobody Tue Jan 21 08:31:45 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of groups.io designates
 66.175.222.108 as permitted sender) client-ip=66.175.222.108;
 envelope-from=bounce+27952+105557+1787277+3901457@groups.io;
 helo=mail02.groups.io;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as
 permitted sender)
  smtp.mailfrom=bounce+27952+105557+1787277+3901457@groups.io;
	dmarc=fail(p=none dis=none)  header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1685620642; cv=none;
	d=zohomail.com; s=zohoarc;
	b=M0c3RfE1bBZNYzyYMruHkiOuCiqj2YXe7mhXFdouIJjSjrzwS6ypmChi3H8+KbZhzNJCw2wLdjGA6B/YjBucb4kZIn8mvPrpZweU1kDuE8Z0m1YtJdhj5MbMw2YpwecppYqKukaZsUHNjWBfvEIpmPDquie4DspfPnNJQWHQUFM=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1685620642;
 h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To;
	bh=Mgr9gTyiTA/bhQospdcVvc/d56+vNQ2z8p4+7kFzmr4=;
	b=GE6lgcBHBQfFJtQqln1xMYY1NVkKntGvrcs+q+cOIaSG4KX/xp6fFKYdiO59scTV3rZdF3GIMXYHu2ZrlIONVt9tie9AVu1rZSLP4SlWWMuILEMTdiZelLSZf7byvCwaAAUueTSZjQA7e1b8b4x+0vSpOQ0lnh06pvCuJ9meYmU=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as
 permitted sender)
  smtp.mailfrom=bounce+27952+105557+1787277+3901457@groups.io;
	dmarc=fail header.from=<kraxel@redhat.com> (p=none dis=none)
Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by
 mx.zohomail.com
	with SMTPS id 16856206423551023.6693718089227;
 Thu, 1 Jun 2023 04:57:22 -0700 (PDT)
Return-Path: <bounce+27952+105557+1787277+3901457@groups.io>
X-Received: by 127.0.0.2 with SMTP id O5ZSYY1788612xROsCzz7UEn;
 Thu, 01 Jun 2023 04:57:21 -0700
X-Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.129.124])
 by mx.groups.io with SMTP id smtpd.web10.28949.1685620641012832327
 for <devel@edk2.groups.io>;
 Thu, 01 Jun 2023 04:57:21 -0700
X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
 [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 us-mta-465-8RO-WWwRN4uvZP9T0PJQLQ-1; Thu, 01 Jun 2023 07:57:17 -0400
X-MC-Unique: 8RO-WWwRN4uvZP9T0PJQLQ-1
X-Received: from smtp.corp.redhat.com
 (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A26E085A5BA;
	Thu,  1 Jun 2023 11:57:16 +0000 (UTC)
X-Received: from sirius.home.kraxel.org (unknown [10.39.192.155])
	by smtp.corp.redhat.com (Postfix) with ESMTPS id 6107440C6EC4;
	Thu,  1 Jun 2023 11:57:16 +0000 (UTC)
X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000)
	id C417E180098E; Thu,  1 Jun 2023 13:57:13 +0200 (CEST)
From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: Jiewen Yao <jiewen.yao@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Leif Lindholm <quic_llindhol@quicinc.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Oliver Steffen <osteffen@redhat.com>,
	Pawel Polawski <ppolawsk@redhat.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Sami Mujawar <sami.mujawar@arm.com>,
	Ard Biesheuvel <ardb@kernel.org>
Subject: [edk2-devel] [PATCH v2 3/4] ArmVirt/PlatformBootManagerLib: factor
 out IsVirtioPci()
Date: Thu,  1 Jun 2023 13:57:12 +0200
Message-Id: <20230601115713.1212372-4-kraxel@redhat.com>
In-Reply-To: <20230601115713.1212372-1-kraxel@redhat.com>
References: <20230601115713.1212372-1-kraxel@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Precedence: Bulk
List-Unsubscribe: <mailto:devel+unsubscribe@edk2.groups.io>
List-Subscribe: <mailto:devel+subscribe@edk2.groups.io>
List-Help: <mailto:devel+help@edk2.groups.io>
Sender: devel@edk2.groups.io
List-Id: <devel.edk2.groups.io>
Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io
Reply-To: devel@edk2.groups.io,kraxel@redhat.com
X-Gm-Message-State: H2ZKGJNY6Gb25iMYmJGmmAxVx1787277AA=
Content-Transfer-Encoding: quoted-printable
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io;
 q=dns/txt; s=20140610; t=1685620641;
 bh=hPP3OI1mqouwToklMdKjsMqbxu+ZbRamfLdmnLUBCDk=;
 h=Cc:Content-Type:Date:From:Reply-To:Subject:To;
 b=V2D5U2ZXwpYzgFbAChJQkCH9il1OPhpE+LLIo+p+dyuaQ/FSrNsqbsORfhi4MsJalpB
 k1tniTUXEHYRR7Ty3m7yoUOa6xtfzjixlfqBYTfcAyaPp9QdgMmAYCHmS/Zf6qZHIaull
 YN1l4ZGKJGtYrgaPRuBuPCYzLpxtOlgsRfQ=
X-ZohoMail-DKIM: pass (identity @groups.io)
X-ZM-MESSAGEID: 1685620644050100004
Content-Type: text/plain; charset="utf-8"; x-default="true"

IsVirtioPciRng() becomes just a thin wrapper for IsVirtioPci().
This allows to add similar thin wrappers for other virtio
devices in the future.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
---
 .../PlatformBootManagerLib/PlatformBm.c       | 30 ++++++++++++++-----
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVi=
rtPkg/Library/PlatformBootManagerLib/PlatformBm.c
index 5eb6f0f9c14a..ed38c42a43ee 100644
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
@@ -313,15 +313,16 @@ IsVirtioRng (
 }
=20
 /**
-  This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG devi=
ce at
-  the EFI_PCI_IO_PROTOCOL level.
+  This function checks if a handle corresponds to the Virtio Device ID giv=
en
+  at the EFI_PCI_IO_PROTOCOL level.
 **/
 STATIC
 BOOLEAN
 EFIAPI
-IsVirtioPciRng (
+IsVirtioPci (
   IN EFI_HANDLE    Handle,
-  IN CONST CHAR16  *ReportText
+  IN CONST CHAR16  *ReportText,
+  IN UINT16        VirtIoDeviceId
   )
 {
   EFI_STATUS           Status;
@@ -387,11 +388,11 @@ IsVirtioPciRng (
   //
   // From DeviceId and RevisionId, determine whether the device is a
   // modern-only Virtio 1.0 device. In case of Virtio 1.0, DeviceId can
-  // immediately be restricted to VIRTIO_SUBSYSTEM_ENTROPY_SOURCE, and
+  // immediately be restricted to VirtIoDeviceId, and
   // SubsystemId will only play a sanity-check role. Otherwise, DeviceId c=
an
   // only be sanity-checked, and SubsystemId will decide.
   //
-  if ((DeviceId =3D=3D 0x1040 + VIRTIO_SUBSYSTEM_ENTROPY_SOURCE) &&
+  if ((DeviceId =3D=3D 0x1040 + VirtIoDeviceId) &&
       (RevisionId >=3D 0x01))
   {
     Virtio10 =3D TRUE;
@@ -419,7 +420,7 @@ IsVirtioPciRng (
     return TRUE;
   }
=20
-  if (!Virtio10 && (SubsystemId =3D=3D VIRTIO_SUBSYSTEM_ENTROPY_SOURCE)) {
+  if (!Virtio10 && (SubsystemId =3D=3D VirtIoDeviceId)) {
     return TRUE;
   }
=20
@@ -430,6 +431,21 @@ IsVirtioPciRng (
   return FALSE;
 }
=20
+/**
+  This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG devi=
ce at
+  the EFI_PCI_IO_PROTOCOL level.
+**/
+STATIC
+BOOLEAN
+EFIAPI
+IsVirtioPciRng (
+  IN EFI_HANDLE    Handle,
+  IN CONST CHAR16  *ReportText
+  )
+{
+  return IsVirtioPci (Handle, ReportText, VIRTIO_SUBSYSTEM_ENTROPY_SOURCE);
+}
+
 /**
   This CALLBACK_FUNCTION attempts to connect a handle non-recursively, ask=
ing
   the matching driver to produce all first-level child handles.
--=20
2.40.1




-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105557): https://edk2.groups.io/g/devel/message/105557
Mute This Topic: https://groups.io/mt/99261950/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
From nobody Tue Jan 21 08:31:45 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of groups.io designates
 66.175.222.108 as permitted sender) client-ip=66.175.222.108;
 envelope-from=bounce+27952+105561+1787277+3901457@groups.io;
 helo=mail02.groups.io;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as
 permitted sender)
  smtp.mailfrom=bounce+27952+105561+1787277+3901457@groups.io;
	dmarc=fail(p=none dis=none)  header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1685620644; cv=none;
	d=zohomail.com; s=zohoarc;
	b=PzHgOBRtQSpiXUMeBq9sEsubFImOlHxOGNI4DYX64i+v1mLSp+jI6WnqG62SgFtrNTq/61n4oyVbxhJSsyPbKfg57rxWD4sUFuopHQhqbW+KFW4xo+X6ebRmPSNXASdV/BAvZxTS1PfAhC7myOIpa5MhIODh/rrwA0MZUr2dNRw=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1685620644;
 h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To;
	bh=bc9eKffedCQi3uMcts6y9jlrw5FY3Ehmqs569msJ168=;
	b=buglgqxAMqE1C/OzYkRWfzDhG8i15K0/pCi9sM7gOe/kajZ/5ekDWxKGp2JLVLL4daTqf/g7p8vayNkZjjLhsU8XiUcYolXFff4qhQcsCg+5p5W+1mFXY4ME5TIZx10sP6MEH+4phRWVfQYFOGmVad1mfTU9VIIjqPvgJ+K4+3k=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as
 permitted sender)
  smtp.mailfrom=bounce+27952+105561+1787277+3901457@groups.io;
	dmarc=fail header.from=<kraxel@redhat.com> (p=none dis=none)
Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by
 mx.zohomail.com
	with SMTPS id 168562064440744.571927957247;
 Thu, 1 Jun 2023 04:57:24 -0700 (PDT)
Return-Path: <bounce+27952+105561+1787277+3901457@groups.io>
X-Received: by 127.0.0.2 with SMTP id 6tMMYY1788612xS6zqvzKKTl;
 Thu, 01 Jun 2023 04:57:24 -0700
X-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.web11.29289.1685620643311710655
 for <devel@edk2.groups.io>;
 Thu, 01 Jun 2023 04:57:23 -0700
X-Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com
 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 us-mta-648-GTNH4wKHMr-fwBZ749Y2Hg-1; Thu, 01 Jun 2023 07:57:18 -0400
X-MC-Unique: GTNH4wKHMr-fwBZ749Y2Hg-1
X-Received: from smtp.corp.redhat.com
 (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 14A9F3C17C6B;
	Thu,  1 Jun 2023 11:57:18 +0000 (UTC)
X-Received: from sirius.home.kraxel.org (unknown [10.39.192.155])
	by smtp.corp.redhat.com (Postfix) with ESMTPS id AC68CC154DA;
	Thu,  1 Jun 2023 11:57:17 +0000 (UTC)
X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000)
	id C80161800993; Thu,  1 Jun 2023 13:57:13 +0200 (CEST)
From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: Jiewen Yao <jiewen.yao@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Leif Lindholm <quic_llindhol@quicinc.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Oliver Steffen <osteffen@redhat.com>,
	Pawel Polawski <ppolawsk@redhat.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Sami Mujawar <sami.mujawar@arm.com>
Subject: [edk2-devel] [PATCH v2 4/4] ArmVirt/PlatformBootManagerLib: set up
 virtio serial as console
Date: Thu,  1 Jun 2023 13:57:13 +0200
Message-Id: <20230601115713.1212372-5-kraxel@redhat.com>
In-Reply-To: <20230601115713.1212372-1-kraxel@redhat.com>
References: <20230601115713.1212372-1-kraxel@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Precedence: Bulk
List-Unsubscribe: <mailto:devel+unsubscribe@edk2.groups.io>
List-Subscribe: <mailto:devel+subscribe@edk2.groups.io>
List-Help: <mailto:devel+help@edk2.groups.io>
Sender: devel@edk2.groups.io
List-Id: <devel.edk2.groups.io>
Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io
Reply-To: devel@edk2.groups.io,kraxel@redhat.com
X-Gm-Message-State: rmA6h7VdTTlEXJxOy9mkfwMbx1787277AA=
Content-Transfer-Encoding: quoted-printable
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io;
 q=dns/txt; s=20140610; t=1685620644;
 bh=J3PiExlpY22+vkFgkByPzIMxT14YDLWWCjJLNFON1Ps=;
 h=Cc:Content-Type:Date:From:Reply-To:Subject:To;
 b=EZia0KnpatcW7l4HnRxlb6w/ulCKAHE01p+DrvB9oMIGA1+2X/83fSnP5LuOUSHhhWN
 plZdMwlt7KNcpS30Z1Sm1tN0f0iK7NkT0sHuIyMPHzbE+HHlChLkCCDHzXYtqK2BlNGtB
 XiSxMaHN0YOFWi0FReBz9cWb/lOXNJTz4L8=
X-ZohoMail-DKIM: pass (identity @groups.io)
X-ZM-MESSAGEID: 1685620646429100019
Content-Type: text/plain; charset="utf-8"; x-default="true"

In case a virtio serial device is found in the system register the first
console port as EFI console, by updating ConIn, ConOut and ErrOut.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 .../PlatformBootManagerLib/PlatformBm.c       | 172 ++++++++++++++++++
 1 file changed, 172 insertions(+)

diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVi=
rtPkg/Library/PlatformBootManagerLib/PlatformBm.c
index ed38c42a43ee..b92a916f7eec 100644
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
@@ -312,6 +312,21 @@ IsVirtioRng (
   return IsVirtio (Handle, ReportText, VIRTIO_SUBSYSTEM_ENTROPY_SOURCE);
 }
=20
+/**
+  This FILTER_FUNCTION checks if a handle corresponds to a Virtio serial d=
evice at
+  the VIRTIO_DEVICE_PROTOCOL level.
+**/
+STATIC
+BOOLEAN
+EFIAPI
+IsVirtioSerial (
+  IN EFI_HANDLE    Handle,
+  IN CONST CHAR16  *ReportText
+  )
+{
+  return IsVirtio (Handle, ReportText, VIRTIO_SUBSYSTEM_CONSOLE);
+}
+
 /**
   This function checks if a handle corresponds to the Virtio Device ID giv=
en
   at the EFI_PCI_IO_PROTOCOL level.
@@ -446,6 +461,21 @@ IsVirtioPciRng (
   return IsVirtioPci (Handle, ReportText, VIRTIO_SUBSYSTEM_ENTROPY_SOURCE);
 }
=20
+/**
+  This FILTER_FUNCTION checks if a handle corresponds to a Virtio serial d=
evice at
+  the EFI_PCI_IO_PROTOCOL level.
+**/
+STATIC
+BOOLEAN
+EFIAPI
+IsVirtioPciSerial (
+  IN EFI_HANDLE    Handle,
+  IN CONST CHAR16  *ReportText
+  )
+{
+  return IsVirtioPci (Handle, ReportText, VIRTIO_SUBSYSTEM_CONSOLE);
+}
+
 /**
   This CALLBACK_FUNCTION attempts to connect a handle non-recursively, ask=
ing
   the matching driver to produce all first-level child handles.
@@ -534,6 +564,142 @@ AddOutput (
     ));
 }
=20
+/**
+  This CALLBACK_FUNCTION retrieves the EFI_DEVICE_PATH_PROTOCOL from
+  the handle, appends serial, uart and terminal nodes, finally updates
+  ConIn, ConOut and ErrOut.
+**/
+STATIC
+VOID
+EFIAPI
+SetupVirtioSerial (
+  IN EFI_HANDLE    Handle,
+  IN CONST CHAR16  *ReportText
+  )
+{
+  STATIC CONST ACPI_HID_DEVICE_PATH  SerialNode =3D {
+    {
+      ACPI_DEVICE_PATH,
+      ACPI_DP,
+      {
+        (UINT8)(sizeof (ACPI_HID_DEVICE_PATH)),
+        (UINT8)((sizeof (ACPI_HID_DEVICE_PATH)) >> 8)
+      },
+    },
+    EISA_PNP_ID (0x0501),
+    0
+  };
+
+  STATIC CONST UART_DEVICE_PATH  UartNode =3D {
+    {
+      MESSAGING_DEVICE_PATH,
+      MSG_UART_DP,
+      {
+        (UINT8)(sizeof (UART_DEVICE_PATH)),
+        (UINT8)((sizeof (UART_DEVICE_PATH)) >> 8)
+      },
+    },
+    0,
+    115200,
+    8,
+    1,
+    1
+  };
+
+  STATIC CONST VENDOR_DEVICE_PATH  TerminalNode =3D {
+    {
+      MESSAGING_DEVICE_PATH,
+      MSG_VENDOR_DP,
+      {
+        (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
+        (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+      },
+    },
+    DEVICE_PATH_MESSAGING_VT_UTF8
+  };
+
+  EFI_STATUS                Status;
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath, *OldDevicePath;
+
+  DevicePath =3D DevicePathFromHandle (Handle);
+
+  if (DevicePath =3D=3D NULL) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a: %s: handle %p: device path not found\n",
+      __func__,
+      ReportText,
+      Handle
+      ));
+    return;
+  }
+
+  DevicePath =3D AppendDevicePathNode (
+                 DevicePath,
+                 &SerialNode.Header
+                 );
+
+  OldDevicePath =3D DevicePath;
+  DevicePath    =3D AppendDevicePathNode (
+                    DevicePath,
+                    &UartNode.Header
+                    );
+  FreePool (OldDevicePath);
+
+  OldDevicePath =3D DevicePath;
+  DevicePath    =3D AppendDevicePathNode (
+                    DevicePath,
+                    &TerminalNode.Header
+                    );
+  FreePool (OldDevicePath);
+
+  Status =3D EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a: %s: adding to ConIn: %r\n",
+      __func__,
+      ReportText,
+      Status
+      ));
+    return;
+  }
+
+  Status =3D EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL=
);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+
+      "%a: %s: adding to ConOut: %r\n",
+      __func__,
+      ReportText,
+      Status
+      ));
+    return;
+  }
+
+  Status =3D EfiBootManagerUpdateConsoleVariable (ErrOut, DevicePath, NULL=
);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a: %s: adding to ErrOut: %r\n",
+      __func__,
+      ReportText,
+      Status
+      ));
+    return;
+  }
+
+  FreePool (DevicePath);
+
+  DEBUG ((
+    DEBUG_VERBOSE,
+    "%a: %s: added to ConIn, ConOut and ErrOut\n",
+    __func__,
+    ReportText
+    ));
+}
+
 STATIC
 VOID
 PlatformRegisterFvBootOption (
@@ -932,6 +1098,12 @@ PlatformBootManagerBeforeConsole (
   // instances on Virtio PCI RNG devices.
   //
   FilterAndProcess (&gEfiPciIoProtocolGuid, IsVirtioPciRng, Connect);
+
+  //
+  // Register Virtio serial devices as console.
+  //
+  FilterAndProcess (&gVirtioDeviceProtocolGuid, IsVirtioSerial, SetupVirti=
oSerial);
+  FilterAndProcess (&gEfiPciIoProtocolGuid, IsVirtioPciSerial, SetupVirtio=
Serial);
 }
=20
 /**
--=20
2.40.1




-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105561): https://edk2.groups.io/g/devel/message/105561
Mute This Topic: https://groups.io/mt/99261957/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-