From patchwork Fri Jan 2 10:45:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 42692 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6C07926CD1 for ; Fri, 2 Jan 2015 11:12:15 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id e53sf10509478eek.3 for ; Fri, 02 Jan 2015 03:12:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=wlBENuVt0nqZ1luONUpsbBu0yViaYY/TIqYYVyfDVnA=; b=hjNQRvkGzofwPpQ/4/8KhgxqQHq/3dq/JA6SDMzL1akyxgyBrsaOADTllv+jWNhTj1 q57Ud5fcDl3E+vYuvnIeXPzcOHfaSEvT1QACcWv7IZoMrNvml+7Gfk2dcmJdNMVgTpWY GqGE7k9iuEeSF0Idt4esWNIatlOEEPPu1MnQbmzRDUF1bCtUcn9OwpNVGo0Y5tKpfXy7 S1lcE03TwtnO4Je6jwI0ReAr06CgL0SN4GNCvEM50zSgNvmWbqXjAk/W3DOTo+s/mBwd wm0X8X9iAdbCxVslg6LRGxgQCDnmo3ozIPNwJ5EzG34eDDAAQbn3hMSV0ihbC0++EziF OfQg== X-Gm-Message-State: ALoCoQlz77tM5i0sxhtya96Ro00IhJG0Fr6yt0T/I372w5mbcmNVoGLNnqCkSdv3x61drcGFr7nn X-Received: by 10.180.228.38 with SMTP id sf6mr7999469wic.5.1420197134641; Fri, 02 Jan 2015 03:12:14 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.1 with SMTP id ku1ls1116705lac.80.gmail; Fri, 02 Jan 2015 03:12:14 -0800 (PST) X-Received: by 10.112.132.2 with SMTP id oq2mr75795718lbb.11.1420197134475; Fri, 02 Jan 2015 03:12:14 -0800 (PST) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id xx3si1337396lbb.88.2015.01.02.03.12.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 02 Jan 2015 03:12:14 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by mail-lb0-f181.google.com with SMTP id l4so14761286lbv.26 for ; Fri, 02 Jan 2015 03:12:14 -0800 (PST) X-Received: by 10.112.89.232 with SMTP id br8mr36653757lbb.69.1420197134328; Fri, 02 Jan 2015 03:12:14 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.9.200 with SMTP id c8csp169664lbb; Fri, 2 Jan 2015 03:12:13 -0800 (PST) X-Received: by 10.42.102.66 with SMTP id h2mr57375278ico.88.1420197132647; Fri, 02 Jan 2015 03:12:12 -0800 (PST) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id 65si32328093iol.83.2015.01.02.03.12.11 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 02 Jan 2015 03:12:12 -0800 (PST) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Y709A-0008Py-Al; Fri, 02 Jan 2015 11:12:00 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Y7098-0008Pq-VH for edk2-devel@lists.sourceforge.net; Fri, 02 Jan 2015 11:11:58 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.180 as permitted sender) client-ip=74.125.82.180; envelope-from=ard.biesheuvel@linaro.org; helo=mail-we0-f180.google.com; Received: from mail-we0-f180.google.com ([74.125.82.180]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1Y7098-0001jR-3n for edk2-devel@lists.sourceforge.net; Fri, 02 Jan 2015 11:11:58 +0000 Received: by mail-we0-f180.google.com with SMTP id w62so4330941wes.25 for ; Fri, 02 Jan 2015 03:11:52 -0800 (PST) X-Received: by 10.180.198.209 with SMTP id je17mr130386970wic.17.1420195533089; Fri, 02 Jan 2015 02:45:33 -0800 (PST) Received: from ards-macbook-pro.local ([197.131.3.201]) by mx.google.com with ESMTPSA id c10sm64201270wjy.4.2015.01.02.02.45.30 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 02 Jan 2015 02:45:32 -0800 (PST) From: Ard Biesheuvel To: anthony.perard@citrix.com, christoffer.dall@linaro.org, ijc@hellion.org.uk, stefano.stabellini@eu.citrix.com, lersek@redhat.com, linaro-uefi@lists.linaro.org, edk2-devel@lists.sourceforge.net Date: Fri, 2 Jan 2015 10:45:10 +0000 Message-Id: <1420195510-22100-6-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1420195510-22100-1-git-send-email-ard.biesheuvel@linaro.org> References: <1420195510-22100-1-git-send-email-ard.biesheuvel@linaro.org> X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record -0.0 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1Y7098-0001jR-3n Subject: [edk2] [RFC PATCH 5/5] ArmVirtualizationPkg/VirtFdtDxe: wire up XenBusDxe to "xen, xen" DT node X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This patchs adds support to VirtFdtDxe for the Xen DT node which contains the base address of the Grant Table. This data is communicated to XenBusDxe using a XENIO_PROTOCOL instance. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- .../ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c | 33 ++++++++++++++++++++++ .../ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.inf | 1 + 2 files changed, 34 insertions(+) diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c b/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c index d002e668aa48..c49f726a7f10 100644 --- a/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c +++ b/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c @@ -27,6 +27,7 @@ #include #include +#include #pragma pack (1) typedef struct { @@ -44,6 +45,7 @@ typedef enum { PropertyTypeUart, PropertyTypeTimer, PropertyTypePsci, + PropertyTypeXen, } PROPERTY_TYPE; typedef struct { @@ -59,6 +61,7 @@ STATIC CONST PROPERTY CompatibleProperties[] = { { PropertyTypeTimer, "arm,armv7-timer" }, { PropertyTypeTimer, "arm,armv8-timer" }, { PropertyTypePsci, "arm,psci-0.2" }, + { PropertyTypeXen, "xen,xen" }, { PropertyTypeUnknown, "" } }; @@ -115,6 +118,7 @@ InitializeVirtFdtDxe ( CONST INTERRUPT_PROPERTY *InterruptProp; INT32 SecIntrNum, IntrNum, VirtIntrNum, HypIntrNum; CONST CHAR8 *PsciMethod; + XENIO_PROTOCOL *XenIo; DeviceTreeBase = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeBaseAddress); ASSERT (DeviceTreeBase != NULL); @@ -271,6 +275,35 @@ InitializeVirtFdtDxe ( } break; + case PropertyTypeXen: + ASSERT (Len == 16); + + // + // Retrieve the reg base from this node and add it to a + // XENIO_PROTOCOL instance installed on a new handle. + // + XenIo = AllocateZeroPool (sizeof *XenIo); + ASSERT (XenIo != NULL); + XenIo->GrantTableAddress = fdt64_to_cpu (((UINT64 *)RegProp)[0]); + + Handle = NULL; + Status = gBS->InstallProtocolInterface (&Handle, + &gXenIoProtocolGuid, EFI_NATIVE_INTERFACE, + XenIo); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_ERROR, "%a: Failed to install the XENIO_PROTOCOL " + "protocol on a new handle (Status == %r)\n", + __FUNCTION__, Status)); + FreePool (XenIo); + break; + } + Status = gBS->ConnectController (Handle, NULL, NULL, TRUE); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_ERROR, "%a: Failed to invoke ConnectController () on " + "XENIO_PROTOCOL instance (Status == %r)\n", + __FUNCTION__, Status)); + } + default: break; } diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.inf b/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.inf index 1c9dd20580c4..16b5873d9451 100644 --- a/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.inf +++ b/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.inf @@ -57,6 +57,7 @@ [Protocols] gEfiDevicePathProtocolGuid + gXenIoProtocolGuid [Depex] TRUE