From nobody Thu Nov 14 05:47:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43307+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1562252320; cv=none; d=zoho.com; s=zohoarc; b=JV7N1B21lDDGsxgQbp8TQ0eozVY6MHL5oC/61WHKJ6377d/1O/20TaDOqwAS6PTGcxvsj9DhIGmhmfNKVQBKnw2LZ5U7Yn+E67u876gyoQwIs4e68IbiDq51UBWBcQv/hFp5pChm8arjnoVWFKNuBBfR9s96FNGT+tvO//kLHzo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562252320; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=LfX5PiOJp+l9ciLH7Q0iK2lhiQx8iLuUPgR3vN4rSao=; b=cHVwcMwoHagGfaogFoQ+GXG8K/Xdxd7hvZ3+AmnUI1jrhTI7TSLqes+NNCXlxxT+rhzSzy5g8Kzf97CMt35azBv8AIJiRzc4w10meW1LuyxbQxqDXJuc8aeTdF+xkb1OiRtBUVpHM2meiJuRU1XBHs4hFI0AOc4XT8knNlfME7s= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43307+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1562252320103885.9490159094192; Thu, 4 Jul 2019 07:58:40 -0700 (PDT) Return-Path: X-Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by groups.io with SMTP; Thu, 04 Jul 2019 07:58:39 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+43307+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of anthony.perard@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of anthony.perard@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 4C3oAaBPMzpSpCq59DS3iJHOINMXm6fH+JNG10tetOWQZhlZXBpUDKHYQYIEYvzvg8OMOTMVl9 TqdK2/BalUkD90cz8o06dPDq5sidju7i73Gv56RiUt9KiqP6r5pTxWQy5mOjzAopbUcrHMlCtb awiSTysjpwRYfb/2wW2egMcly5QDZg0ELiffpN9IPDMFL+y3bBUeodihNfiSXbHuZ766r81TDa jIS5Bc3yKTI4gw9oAz1ZTmcwO8Ga5LnYIW+4LUAftQCcsifq4lp+9gKV3tA/oDxFzaqqokEAto z/I= X-SBRS: 2.7 X-MesageID: 2650941 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.63,451,1557201600"; d="scan'208";a="2650941" From: "Anthony PERARD" To: CC: , Ard Biesheuvel , Jordan Justen , Laszlo Ersek , Julien Grall , Anthony PERARD Subject: [edk2-devel] [PATCH v3 32/35] OvmfPkg/PlatformBootManagerLib: Use a Xen console for ConOut/ConIn Date: Thu, 4 Jul 2019 15:42:30 +0100 Message-ID: <20190704144233.27968-33-anthony.perard@citrix.com> In-Reply-To: <20190704144233.27968-1-anthony.perard@citrix.com> References: <20190704144233.27968-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1562252319; bh=xJ/oVN2uHghfYqPl10xprBBUKRLMmJsADeSgm2QvkMo=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=LqIBNmw3T3Wtw10xuXQxFNOf2/2NZ0rS5Iq0c2LIVra3rAbh8tPpl3ZZIcq82Vu9GOZ X7WbEDCkF72Bf0tUOeEF9eJ0EYzRcKEJrDLOv9PNE1zeyQcgeQo2T/sDbKPP0+vDdRsnT j/DQ2LBchOfQnkhax0Yzz5bSYBr7KmbJzgQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" On a Xen PVH guest, none of the existing serial or console interface works, so we add a new one, based on XenConsoleSerialPortLib, and implemented via SerialDxe. That is a simple console implementation that can works on both PVH guest and HVM guests, even if it rarely going to be use on HVM. Have PlatformBootManagerLib look for the new console, when running as a Xen guest. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Reviewed-by: Laszlo Ersek --- Notes: v3: - removed PciSioSerialDxe and IsaSerialDxe from OvmfXen, since they would not be used, maybe, to check. - some coding style fix =20 - not changed: PciSioSerialDxe: even if we add SerialDxe, we still needs PciSioSerialDxe to have OVMF use the emulated serial port on HVM. =20 v2: - Use MdeModulePkg/Universal/SerialDxe instead of something new. - Have PlatformInitializeConsole() look for it by using the known-in-advance device path for the xen console in the PLATFORM_CONSOLE_CONNECT_ENTRY. OvmfPkg/OvmfXen.dsc | 4 ++ OvmfPkg/OvmfXen.fdf | 1 + .../PlatformBootManagerLib.inf | 4 ++ .../PlatformBootManagerLib/BdsPlatform.h | 1 + .../PlatformBootManagerLib/BdsPlatform.c | 3 +- .../PlatformBootManagerLib/PlatformData.c | 59 ++++++++++++++++++- 6 files changed, 69 insertions(+), 3 deletions(-) diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index 1ecae3fb45..487bada64d 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -586,6 +586,10 @@ [Components] OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf OvmfPkg/XenBusDxe/XenBusDxe.inf OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf + MdeModulePkg/Universal/SerialDxe/SerialDxe.inf { + + SerialPortLib|OvmfPkg/Library/XenConsoleSerialPortLib/XenConsoleSeri= alPortLib.inf + } MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntim= eDxe.inf MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf index fa0830a324..5c1a925d6a 100644 --- a/OvmfPkg/OvmfXen.fdf +++ b/OvmfPkg/OvmfXen.fdf @@ -312,6 +312,7 @@ [FV.DXEFV] INF OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf INF OvmfPkg/XenBusDxe/XenBusDxe.inf INF OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf +INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf =20 INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRun= timeDxe.inf diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.= inf b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index b2d3b4fb4d..646a1c522c 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -61,6 +61,10 @@ [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate ## CONSUMES + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits ## CONSUMES + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity ## CONSUMES + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits ## CONSUMES =20 [Pcd.IA32, Pcd.X64] gEfiMdePkgTokenSpaceGuid.PcdFSBClock diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h b/OvmfPkg= /Library/PlatformBootManagerLib/BdsPlatform.h index 49a072b400..153e215101 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h @@ -165,6 +165,7 @@ typedef struct { #define CONSOLE_IN BIT1 #define STD_ERROR BIT2 extern PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[]; +extern PLATFORM_CONSOLE_CONNECT_ENTRY gXenPlatformConsole[]; =20 // // Platform BDS Functions diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg= /Library/PlatformBootManagerLib/BdsPlatform.c index 9ae590293a..ee6ee6608f 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -399,7 +399,8 @@ PlatformBootManagerBeforeConsole ( // EfiBootManagerDispatchDeferredImages (); =20 - PlatformInitializeConsole (gPlatformConsole); + PlatformInitializeConsole ( + XenDetected() ? gXenPlatformConsole : gPlatformConsole); PcdStatus =3D PcdSet16S (PcdPlatformBootTimeOut, GetFrontPageTimeoutFromQemu ()); ASSERT_RETURN_ERROR (PcdStatus); diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c b/OvmfPk= g/Library/PlatformBootManagerLib/PlatformData.c index 36aab784d7..a9b1fe274a 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c @@ -9,18 +9,19 @@ =20 #include "BdsPlatform.h" #include +#include =20 // // Debug Agent UART Device Path structure // -#pragma pack(1) +#pragma pack (1) typedef struct { VENDOR_DEVICE_PATH VendorHardware; UART_DEVICE_PATH Uart; VENDOR_DEVICE_PATH TerminalType; EFI_DEVICE_PATH_PROTOCOL End; } VENDOR_UART_DEVICE_PATH; -#pragma pack() +#pragma pack () =20 // // USB Keyboard Device Path structure @@ -43,6 +44,18 @@ typedef struct { } VENDOR_RAMFB_DEVICE_PATH; #pragma pack () =20 +// +// Xen Console Device Path structure +// +#pragma pack(1) +typedef struct { + VENDOR_DEVICE_PATH VendorHardware; + UART_DEVICE_PATH Uart; + VENDOR_DEVICE_PATH TerminalType; + EFI_DEVICE_PATH_PROTOCOL End; +} XEN_CONSOLE_DEVICE_PATH; +#pragma pack() + ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode =3D gPnpPs2Keyboard; ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode =3D gPnp16550ComPort; UART_DEVICE_PATH gUartDeviceNode =3D gUart; @@ -141,6 +154,37 @@ STATIC VENDOR_RAMFB_DEVICE_PATH gQemuRamfbDevicePath = =3D { gEndEntire }; =20 +STATIC XEN_CONSOLE_DEVICE_PATH gXenConsoleDevicePath =3D { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8) (sizeof (VENDOR_DEVICE_PATH)), + (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + EDKII_SERIAL_PORT_LIB_VENDOR_GUID + }, + { + { + MESSAGING_DEVICE_PATH, + MSG_UART_DP, + { + (UINT8) (sizeof (UART_DEVICE_PATH)), + (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8) + } + }, + 0, + FixedPcdGet64 (PcdUartDefaultBaudRate), + FixedPcdGet8 (PcdUartDefaultDataBits), + FixedPcdGet8 (PcdUartDefaultParity), + FixedPcdGet8 (PcdUartDefaultStopBits), + }, + gPcAnsiTerminal, + gEndEntire +}; + // // Predefined platform default console device path // @@ -163,6 +207,17 @@ PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[] = =3D { } }; =20 +PLATFORM_CONSOLE_CONNECT_ENTRY gXenPlatformConsole[] =3D { + { + (EFI_DEVICE_PATH_PROTOCOL *)&gXenConsoleDevicePath, + (CONSOLE_OUT | CONSOLE_IN | STD_ERROR) + }, + { + NULL, + 0 + } +}; + // // Predefined platform connect sequence // --=20 Anthony PERARD -=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 (#43307): https://edk2.groups.io/g/devel/message/43307 Mute This Topic: https://groups.io/mt/32308731/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-