From patchwork Tue Feb 24 18:03:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 44978 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 264342029F for ; Tue, 24 Feb 2015 18:06:45 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id r20sf16349943wiv.3 for ; Tue, 24 Feb 2015 10:06:44 -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:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=Jm1+Td4ASPOqXqdWU8In807ABnoIkQ1tLYr3Sbcfnfw=; b=FhbIrCtveWU4h3g8Arj8Vv6btmBu80sApucp3iEQrRT0LuiWGmAXR7SOZPwyKoUXnu JZPz2d1Xdz8eJfMNufdQjlDyO4Trl0CEIZtYZ0xEAOcMITtZjfn8O+5pknD6IIx8IBcO +uBpERhb3Lehx6y3QnHL9K4Dd/7sJOW+p7R0qf7KIjgBZ9km5O5O49fLlEUCC2AFDQFd HkdQHPV7pxGPhTLfCjc/aqpHunYBQUCVBymYUfpuprhublzsIGVLKgi3P181PYboyftK 3cT3yvtmPOoU8+w68ktLcUpAX7OupVQPkYBwub1wWrNskWyUHXPZnfh4zYKtNBOklERM eeUQ== X-Gm-Message-State: ALoCoQkfVFLN4xhD8u4YSbUtz+E8M6bjRwNINzbm17Ris4iMeGupwdbmhDesF9iFt6DlZWg79U1h X-Received: by 10.112.219.102 with SMTP id pn6mr1707331lbc.12.1424801204485; Tue, 24 Feb 2015 10:06:44 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.104 with SMTP id ln8ls652871lac.94.gmail; Tue, 24 Feb 2015 10:06:44 -0800 (PST) X-Received: by 10.152.43.51 with SMTP id t19mr15207117lal.73.1424801204345; Tue, 24 Feb 2015 10:06:44 -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 an1si17458696lac.99.2015.02.24.10.06.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Feb 2015 10:06:44 -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 lbvn10 with SMTP id n10so26783475lbv.4 for ; Tue, 24 Feb 2015 10:06:44 -0800 (PST) X-Received: by 10.152.28.5 with SMTP id x5mr15160548lag.112.1424801204219; Tue, 24 Feb 2015 10:06:44 -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.35.133 with SMTP id h5csp2079409lbj; Tue, 24 Feb 2015 10:06:43 -0800 (PST) X-Received: by 10.140.148.216 with SMTP id 207mr39448534qhu.62.1424801199775; Tue, 24 Feb 2015 10:06:39 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id p20si39871255qgd.117.2015.02.24.10.06.39 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 24 Feb 2015 10:06:39 -0800 (PST) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YQJrm-0003mN-Cw; Tue, 24 Feb 2015 18:05:54 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YQJrk-0003hL-EM for xen-devel@lists.xen.org; Tue, 24 Feb 2015 18:05:52 +0000 Received: from [85.158.137.68] by server-14.bemta-3.messagelabs.com id 62/10-02885-F7DBCE45; Tue, 24 Feb 2015 18:05:51 +0000 X-Env-Sender: ard.biesheuvel@linaro.org X-Msg-Ref: server-11.tower-31.messagelabs.com!1424801151!11928552!1 X-Originating-IP: [74.125.82.182] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.13.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 22059 invoked from network); 24 Feb 2015 18:05:51 -0000 Received: from mail-we0-f182.google.com (HELO mail-we0-f182.google.com) (74.125.82.182) by server-11.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 24 Feb 2015 18:05:51 -0000 Received: by wesk11 with SMTP id k11so26818708wes.11 for ; Tue, 24 Feb 2015 10:05:51 -0800 (PST) X-Received: by 10.194.190.10 with SMTP id gm10mr34885732wjc.91.1424801150894; Tue, 24 Feb 2015 10:05:50 -0800 (PST) Received: from ards-macbook-pro.lan (bl11-65-113.dsl.telepac.pt. [85.244.65.113]) by mx.google.com with ESMTPSA id w8sm12792521wja.4.2015.02.24.10.05.48 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 24 Feb 2015 10:05:50 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.sourceforge.net, olivier.martin@arm.com, lersek@redhat.com, roy.franz@linaro.org, leif.lindholm@linaro.org, stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, anthony.perard@citrix.com, xen-devel@lists.xen.org, julien.grall@linaro.org, jordan.l.justen@intel.com, michael.d.kinney@intel.com Date: Tue, 24 Feb 2015 18:03:09 +0000 Message-Id: <1424800990-15777-29-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1424800990-15777-1-git-send-email-ard.biesheuvel@linaro.org> References: <1424800990-15777-1-git-send-email-ard.biesheuvel@linaro.org> Cc: wei.liu2@citrix.com, Ard Biesheuvel Subject: [Xen-devel] [PATCH v5 28/29] ArmVirtualizationPkg/VirtFdtDxe: wire up XenBusDxe to "xen, xen" DT node X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org 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 List-Archive: 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 Reviewed-by: Laszlo Ersek Reviewed-by: Olivier Martin Signed-off-by: Ard Biesheuvel --- .../ArmVirtualizationPkg/ArmVirtualization.dsc.inc | 2 ++ .../ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c | 23 ++++++++++++++++++++++ .../ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.inf | 1 + 3 files changed, 26 insertions(+) diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc index a1e10d7d79cb..0de1b9c6d75a 100644 --- a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc +++ b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc @@ -107,6 +107,8 @@ # USB Libraries UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf + XenIoMmioLib|OvmfPkg/Library/XenIoMmioLib/XenIoMmioLib.inf + [LibraryClasses.common.SEC] PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf ArmPlatformSecExtraActionLib|ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.inf diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c b/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c index e63294a12e11..c9a181a871b8 100644 --- a/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c +++ b/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -50,6 +51,7 @@ typedef enum { PropertyTypeFwCfg, PropertyTypePciHost, PropertyTypeGicV3, + PropertyTypeXen, } PROPERTY_TYPE; typedef struct { @@ -68,6 +70,7 @@ STATIC CONST PROPERTY CompatibleProperties[] = { { PropertyTypeFwCfg, "qemu,fw-cfg-mmio" }, { PropertyTypePciHost, "pci-host-ecam-generic" }, { PropertyTypeGicV3, "arm,gic-v3" }, + { PropertyTypeXen, "xen,xen" }, { PropertyTypeUnknown, "" } }; @@ -523,6 +526,26 @@ InitializeVirtFdtDxe ( } break; + case PropertyTypeXen: + ASSERT (Len == 16); + + // + // Retrieve the reg base from this node and wire it up to the + // MMIO flavor of the XenBus root device I/O protocol + // + RegBase = fdt64_to_cpu (((UINT64 *)RegProp)[0]); + Handle = NULL; + Status = XenIoMmioInstall (&Handle, RegBase); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_ERROR, "%a: XenIoMmioInstall () failed on a new handle " + "(Status == %r)\n", __FUNCTION__, Status)); + break; + } + + DEBUG ((EFI_D_INFO, "Found Xen node with Grant table @ 0x%Lx\n", RegBase)); + + break; + default: break; } diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.inf b/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.inf index bca0f0b5f39b..d830dd131db8 100644 --- a/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.inf +++ b/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.inf @@ -42,6 +42,7 @@ FdtLib VirtioMmioDeviceLib HobLib + XenIoMmioLib [Guids] gFdtTableGuid