From patchwork Thu Mar 1 06:57:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 130108 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp2452266edc; Wed, 28 Feb 2018 22:58:06 -0800 (PST) X-Google-Smtp-Source: AG47ELszbjQoje7bPQOET8mhFu4V1Yfg17v0efcjC7BhzyNnmRj9h2un6ltfqBoerZbgML+QNpdE X-Received: by 10.99.96.200 with SMTP id u191mr742302pgb.252.1519887486616; Wed, 28 Feb 2018 22:58:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519887486; cv=none; d=google.com; s=arc-20160816; b=Y6ZtSSo0QL3oNCNrjqwY5muiHTgof2oqtT70/4osS6y2vfBXbZiqeNxBPFzXyno7HK 7KLvWFQmKDdQM6F+blJctcPjF6g89MQU0Fo69Ma91oQiDodU/AcZMJuA6ITeiqm8nDkO 43LmVKWjMR6gF71TcyVQZPLmYdJ0jCI1WD4xwvVSSfoAqetAokXGa0ij0KGkzL3Yihn4 5ePUcG98IPF6kyvrcFjIUHasOmhKVtmD8dtvFSEVl+3fhzFExFPF2QB/XUnF9wVPa6Ak jR5qYo79ly5+KgMCq4MMcbejyXa9KHedzQ1Oy704d/7An7wqqCHlxWpZqCEXcLfr2JnB X1xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=oNSZ48XUacrU4kFCS4Miz7AHfis52/lG2a1eIL8xtcs=; b=MLCJwBUUbHp1rHNJ4463ybTQPjs4sX+FL4La7U/WPTgFQJB0ZQ+f1hN4s1a7QT848e zd6wrQ3ATV/cP2H3BPKzV5iVYrQw4coRFR6zLY6//zkgsqCWZWZKwxXGMJb6qFQwNEQA uZ1HpRXEv0iok85BmVnJ5wh33P5M5Gv5ic8aa6o8r1w36hnPWWA9NEKpgjez9Sv2fgb8 MRA7OZmOVhRBp6exUBHiXrNlrsVZlktyBDmdqI+Wdmc7hD+cpNia9GlAi6N1OaCxA13x Y6pWj3k8UtG7MHG5JVV5AXeEo1vQ3YNhBjpEcFvMNvrx5ZNsYuKlXl1dsNMWqoGkZgVJ rRrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SHky5vis; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id r15si2494653pfh.230.2018.02.28.22.58.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 22:58:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SHky5vis; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BED8422423850; Wed, 28 Feb 2018 22:51:57 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c05::241; helo=mail-pg0-x241.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C8D372242384D for ; Wed, 28 Feb 2018 22:51:56 -0800 (PST) Received: by mail-pg0-x241.google.com with SMTP id i14so1974195pgv.3 for ; Wed, 28 Feb 2018 22:58:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=bEJrHALBP5sZBhCG8iELqW6i6kZQegbglx/Zp8dhedM=; b=SHky5visqodMcd2Y7fSkHYqO7V1mw+UpiPlJELDrqzYXy7QiAnK1xr5OH1NMmm59y1 hvB75uJFJ4vGiycOukMpMEA6RQQDVjaM8XuyR1Jl01SWRjZKFmOgXJTpao5Hq0wSOjQx tu1C04cfiQHLGBTLvhWthVYdIJ04/uaq656hs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=bEJrHALBP5sZBhCG8iELqW6i6kZQegbglx/Zp8dhedM=; b=g5FjLeVJjxGy/a4GFTLgefwrhD1iXSWCQ+Dyuu2Bd7axgpKDsmtG3Er/ffuvWu2uRX TQRj8cubCtkRa2aLfiD+eJldnCiT74DAPybB09jP8UZ9xsgC0R4alr4xjJCN0Hs0AEGP fd/BOHuVdH2eeigHcObTN9ZvxkxBTXnu/WCSUwrzFuvABgrhH+z+hjnuR6ppVhrtSv5s wdb5WNS7MTkT7gh6l1yp4Owkxr0hnjGGbWROUrxZHG6J/zNj668hE6Xm9nWVodbJiAVN Aw8bttbiSWFqEi5h0UXyAMwn1xKXStIvBdDILun/HclD4qW9BxKzQDXSDxKSNjtA90dC x4yA== X-Gm-Message-State: APf1xPBajMi4Blt9pusmtqHHVq9B420NQHVOgl1ufm18zwIuDseSL8B+ xc5Bu6k5iT6wfE52yH4XOdsDzZGgoSM= X-Received: by 10.98.166.200 with SMTP id r69mr892160pfl.205.1519887484023; Wed, 28 Feb 2018 22:58:04 -0800 (PST) Received: from localhost.localdomain ([45.56.152.115]) by smtp.gmail.com with ESMTPSA id p63sm6489867pfk.74.2018.02.28.22.58.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Feb 2018 22:58:03 -0800 (PST) From: Heyi Guo To: edk2-devel@lists.01.org Date: Thu, 1 Mar 2018 14:57:18 +0800 Message-Id: <1519887444-75510-1-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [edk2] [PATCH v5 0/6] Add translation support to generic PciHostBridge X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ruiyu Ni , Eric Dong , Ard Biesheuvel , Jordan Justen , Anthony Perard , Heyi Guo , Prince Agyeman , Michael D Kinney , Laszlo Ersek , Star Zeng MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Patch v5 inherits the code from RFC v4; we don't restart the version number for RFC to PATCH change. v5: - Patch 4/6: Modify the code according to the comments from Ray. - Patch 1/6 and 2/6 are totally new. They add initialization for all fields of PCI_ROOT_BRIDGE_APERTURE temporary variables in PciHostBridgeLib instances, so that they will not suffer from extension of PCI_ROOT_BRIDGE_APERTURE structure. - Generate a separate patch (3/6) for PciHostBridgeLib.h change. Though it is a prerequisite for patch 4/6, it does not change the code in PciHostBridge driver and won't cause any build failure or functional issue. v4: - Modify the code according to the comments from Ray, Laszlo and Ard (Please see the notes of Patch 1/3) - Ignore translation of bus in CreateRootBridge. v3: - Keep definition of Translation consistent in EDKII code: Translation = device address - host address. - Patch 2/2 is split into 2 patches (2/3 and 3/3). - Refine comments and commit messages to make the code easier to understand. v2: Changs are made according to the discussion on the mailing list, including: - PciRootBridgeIo->Configuration should return CPU view address, as well as PciIo->GetBarAttributes, and Translation Offset should be equal to PCI view address - CPU view address. - Add translation offset to PCI_ROOT_BRIDGE_APERTURE structure definition. - PciHostBridge driver internally used Base Address is still based on PCI view address, and translation offset = CPU view - PCI view, which follows the definition in ACPI, and not the same as that in UEFI spec. Cc: Ruiyu Ni Cc: Ard Biesheuvel Cc: Star Zeng Cc: Eric Dong Cc: Laszlo Ersek Cc: Michael D Kinney Cc: Maurice Ma Cc: Prince Agyeman Cc: Benjamin You Cc: Jordan Justen Cc: Anthony Perard Cc: Julien Grall Heyi Guo (6): CorebootPayloadPkg/PciHostBridgeLib: Init PCI aperture to 0 OvmfPkg/PciHostBridgeLib: Init PCI aperture to 0 MdeModulePkg/PciHostBridgeLib.h: add address Translation MdeModulePkg/PciHostBridgeDxe: Add support for address translation MdeModulePkg/PciBus: convert host address to device address MdeModulePkg/PciBus: return CPU address for GetBarAttributes MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.h | 21 ++++ MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostResource.h | 3 + MdeModulePkg/Include/Library/PciHostBridgeLib.h | 19 +++ CorebootPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c | 5 + MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c | 12 +- MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c | 129 +++++++++++++++++--- MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c | 118 ++++++++++++++++-- OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 4 + OvmfPkg/Library/PciHostBridgeLib/XenSupport.c | 5 + 9 files changed, 288 insertions(+), 28 deletions(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Tested-by: Ard Biesheuvel Reviewed-by: Ruiyu Ni