From patchwork Wed Dec 20 08:21:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 122448 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5274708qgn; Wed, 20 Dec 2017 00:21:43 -0800 (PST) X-Google-Smtp-Source: ACJfBotpofR5u2zHTrZnkai3Gf8rMHunWCogcIQlD2YIv256icEx2RyejkfSF68IDehRpI/NUW7g X-Received: by 10.101.91.74 with SMTP id y10mr2569891pgr.55.1513758103175; Wed, 20 Dec 2017 00:21:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513758103; cv=none; d=google.com; s=arc-20160816; b=f/0cZ6gpUMRAHAtl07rTTRK+EJZswYp8OITko6nKzGlwVVFrVur8D8crp759Bv5REL bJ4VwEz3Pv9U0UKbNy+UtRItEqs4lRvdacSuRwHDGIyTcq7a3NG1chjDlYlqjqTJpQ2A scyN5je2Myp1+jBIMckooI/5MrWqEaXtO0UNkWgaslqLgCdsGvcxKd6o0l+wzZ3rNe0k o3/AXJGWf9tHYmmD3cfAwmYZQjODUiwxBkMtFGlkjYr5D95tdmZK73RmHP+nLTz3RiTH 3gy8WXdhJE3PWQmKs+1v1R5JEbikqj+I7KLyr/LDogrvTpTduW3OYlUB7UajJNSbmjNS exEg== 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=UqIkS3tghszWLFn1BqSThC/FwrqvqutsIDPNIKdNko4=; b=dOsvR1X8++N64tpAqdeKsoAH58vGyoGiiQWkAiA1sv21v3/0sBZxLJUgvf1F6BnfvA b/fxT2WUhMdUC2MFjNwJVPfNKNB2sQaNMozlq0cquKLSCCl+CqIjDwF5mIt7gHGMOJZf daeDuaek4C3P5oQ03AMhbqBNU2wj5YPIlLoQUFFrsIEKjp01I2G4XXgPAZBhQWMXPvEb EyNb2nKThvb4JTiqIGfHOwWr/wxmPCPnMkWIBvyOYNbBJ5xH+aG7pR8z4hAfLggNuBCH d7oxiXcNOjvwkKQWDooWEocDHaSMauU3fGLqtoPnZV/bxT59Xsl6UrTwzHCnJhDOvgeM ZMhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ePqPAQWY; 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 n22si5787976pgc.294.2017.12.20.00.21.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 00:21:43 -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=ePqPAQWY; 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 7D511222447C7; Wed, 20 Dec 2017 00:16:54 -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:c00::22c; helo=mail-pf0-x22c.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf0-x22c.google.com (mail-pf0-x22c.google.com [IPv6:2607:f8b0:400e:c00::22c]) (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 4C9B2208F7A58 for ; Wed, 20 Dec 2017 00:16:53 -0800 (PST) Received: by mail-pf0-x22c.google.com with SMTP id e3so12271332pfi.10 for ; Wed, 20 Dec 2017 00:21:40 -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=wFrMdnXCosxPfUFMrvmZA0EmNIbL8FxHxluTrohFMuQ=; b=ePqPAQWYVXdhVdUAwWEh85e8MdSfCMoCI9BCMBIi+ukuwucmjU8B+la2kqCfKZ0s9k NTXjy+eVND7l+TbzFAOyQV3lxDREYlydWFHfAirY+Opean37FV6KY/8VhwoC4MXe6zq+ kS/cDBcyafFTO3+fp6hfjLvRuzEvjIUlhg+fs= 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=wFrMdnXCosxPfUFMrvmZA0EmNIbL8FxHxluTrohFMuQ=; b=rU+88zMFfXNgFQ28f5desVKABslGXMUJRTBj2q+mROd081azQCsD7B794D3kJE+X9h YFmMwZPvD+X0gMlwEeDjgw3aktdVEVsTPCOlYk5qvX8I9hqym3nhXIcyUBBg968KRn8F 2fGCKqrZzidZnj8R8AzW3D3wlgnNUw/zHi1M68X8i7r2o7dbmfD6Gumv/oIdX3JklyPH ul8u03YW3sn2T0143XCDsR+Dr2ePR9nFvn58pmRkLfItiYxcTXvHPylHFVMylvfUrl87 F1eJM3ojfeVNuGces3Dtg5oBItkR9LvaUvKa0X8Y5kTm9Q+3grnWe72Asg+BV1sCUcH9 eHSg== X-Gm-Message-State: AKGB3mKmK1z9s70tVrCxYPeaMXkxawvUKk69SUNnhx7ZIpS/TSDWgRY9 ndzC4aoM6jlACxIs39PJJxT3BcoyJa8= X-Received: by 10.99.170.1 with SMTP id e1mr5826871pgf.120.1513758100041; Wed, 20 Dec 2017 00:21:40 -0800 (PST) Received: from localhost.localdomain ([45.56.152.249]) by smtp.gmail.com with ESMTPSA id h13sm30349169pfi.40.2017.12.20.00.21.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Dec 2017 00:21:39 -0800 (PST) From: Heyi Guo To: linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org Date: Wed, 20 Dec 2017 16:21:18 +0800 Message-Id: <1513758078-99534-1-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [edk2] [RFC] MdeModulePkg/PciHostBridge: Add address translation support 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 , Jason Zhang , Ard Biesheuvel , Heyi Guo , Star Zeng MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" PCIe on some ARM platforms requires address translation, not only for legacy IO access, but also for 32bit memory BAR access as well. There will be "Address Translation Unit" or something similar in PCI host bridges to translation CPU address to PCI address and vice versa. So we think it may be useful to add address translation support to the generic PCI host bridge driver. This RFC only contains one minor change to the definition of PciHostBridgeLib, and there certainly will be a lot of other changes to make it work, including: 1. Use CPU address for GCD space add and allocate operations, instead of PCI address; also IO space will be changed to memory space if translation exists. 2. RootBridgeIoMemRead/Write, RootBridgeIoRead/Write need to get translation of the corresponding aperture, add the translation to the input address, and then call CpuIo2 protocol; IO access will also be converted to memory access if IO translation exists. 3. RootBridgeIoConfiguration needs to fill AddrTranslationOffset in the discriptor. If it makes sense, then I'll continue to prepare the formal patch. Any comments? Thanks, Gary (Heyi Guo) Cc: Star Zeng Cc: Eric Dong Cc: Ruiyu Ni Cc: Ard Biesheuvel Cc: Jason Zhang --- MdeModulePkg/Include/Library/PciHostBridgeLib.h | 1 + 1 file changed, 1 insertion(+) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/MdeModulePkg/Include/Library/PciHostBridgeLib.h b/MdeModulePkg/Include/Library/PciHostBridgeLib.h index d42e9ec..b9e8c0f 100644 --- a/MdeModulePkg/Include/Library/PciHostBridgeLib.h +++ b/MdeModulePkg/Include/Library/PciHostBridgeLib.h @@ -22,6 +22,7 @@ typedef struct { UINT64 Base; UINT64 Limit; + UINT64 Translation; } PCI_ROOT_BRIDGE_APERTURE; typedef struct {