public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"cenjiahui@huawei.com" <cenjiahui@huawei.com>,
	"lersek@redhat.com" <lersek@redhat.com>
Cc: "Justen, Jordan L" <jordan.l.justen@intel.com>,
	"ard.biesheuvel@arm.com" <ard.biesheuvel@arm.com>,
	"leif@nuviainc.com" <leif@nuviainc.com>,
	"xieyingtai@huawei.com" <xieyingtai@huawei.com>,
	"miaoyubo@huawei.com" <miaoyubo@huawei.com>,
	"xuxiaoyang2@huawei.com" <xuxiaoyang2@huawei.com>
Subject: Re: [edk2-devel] [PATCH v2 0/4] Add extra pci roots support for Arm
Date: Fri, 11 Dec 2020 10:57:45 +0000	[thread overview]
Message-ID: <CO1PR11MB49309CE7950720C23AF4020F8CCA0@CO1PR11MB4930.namprd11.prod.outlook.com> (raw)
In-Reply-To: <5d2daf54-a57b-c4bd-a757-cf6b710cd4e5@huawei.com>



> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Jiahui Cen via groups.io
> Sent: Friday, December 4, 2020 2:49 PM
> To: devel@edk2.groups.io; lersek@redhat.com
> Cc: Justen, Jordan L <jordan.l.justen@intel.com>; ard.biesheuvel@arm.com; leif@nuviainc.com; xieyingtai@huawei.com;
> miaoyubo@huawei.com; xuxiaoyang2@huawei.com
> Subject: Re: [edk2-devel] [PATCH v2 0/4] Add extra pci roots support for Arm
> 
> Hi Laszlo,
> 
> During the modification of this patch series, I got a confusing problem
> that the EDK2's Alignment seems not fit with Linux on ARM.
> 
> EDK2, in CalculateResourceAperture, aligns the offset of child nodes
> in descending order and uses the *Bridge's alignment* to align the
> total length of Bridge.
> 
> However, Linux, in pbus_size_mem, would align the size of child nodes
> and use *the half of max alignment of child nodes* to align the total
> length of Bridge.
> 
> eg. A Root Bridge with Bus [d2]
>     -+-[0000:d2]---01.0-[d3]----01.0
>     where [d2:01.00] is a pcie-pci-bridge with BAR0 (mem, 64-bit, non-pref) [size=256]
>           [d3:01.00] is a PCI Device with BAR0 (mem, 64-bit, pref) [size=128K]
>                                           BAR4 (mem, 64-bit, pref) [size=64M]
> 
>     In EDK2, the Resource Map would be:
>         PciBus: Resource Map for Root Bridge PciRoot(0xD2)
>         Type =  Mem64; Base = 0x8004000000;     Length = 0x4200000;     Alignment = 0x3FFFFFF
>            Base = 0x8004000000; Length = 0x4100000;     Alignment = 0x3FFFFFF;  Owner = PPB [D2|01|00:**]; Type = PMem64
>            Base = 0x8008100000; Length = 0x100; Alignment = 0xFFF;      Owner = PPB [D2|01|00:10]
> 
>         PciBus: Resource Map for Bridge [D2|01|00]
>         Type = PMem64; Base = 0x8004000000;     Length = 0x4100000;     Alignment = 0x3FFFFFF
>            Base = 0x8004000000; Length = 0x4000000;     Alignment = 0x3FFFFFF;  Owner = PCI [D3|01|00:20]
>            Base = 0x8008000000; Length = 0x20000;       Alignment = 0x1FFFF;    Owner = PCI [D3|01|00:10]
>         Type =  Mem64; Base = 0x8008100000;     Length = 0x100; Alignment = 0xFFF
> 
>     It shows that with EDK2's alignment [d2:01.00] only requires
>     a PMem64 resource range of 0x4100000.
> 
>     However in Linux, [d2:01.00]'s BAR14 (Prefetchable Memory
>     Resource behind the Bridge) requires a PMem64 resource range
>     of 0x06000000, which comes from (0x4000000 + 0x20000) with
>     alignment=0x1FFFFFF the half of the max alignment 0x3FFFFFF.

How is 0x3FFFFFF calculated?
0x3FFFFFF = 0x8000000 / 2 - 1, and 0x8000000 is the minimum value that's
power of 2 and bigger than 0x6000000. Is my understanding correct?

I don't understand why this calculation method is chosen.
It seems a kernel bug to me.
I thought Linux doesn't handle the pci resource assignment but just use what was
assigned by firmware.

> 
> Furthermore, Linux Kernel will treat pcie-root-port as a hotplugable
> bridge and try to require more resource. But EDK2 seems not support
> hotplug padding for ARM?

Hotplug padding is supported through HotPlugInit protocol in edk2.


  parent reply	other threads:[~2020-12-11 10:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-09 13:05 [PATCH v2 0/4] Add extra pci roots support for Arm Jiahui Cen
2020-11-09 13:05 ` [PATCH v2 1/4] OvmfPkg: Extract functions form PciHostBridgeLib Jiahui Cen
2020-11-11 16:45   ` Laszlo Ersek
2020-11-12  3:21     ` Jiahui Cen
2020-11-09 13:05 ` [PATCH v2 2/4] ArmVirtPkg: Use extracted PciHostBridgeUtilityLib Jiahui Cen
2020-11-11 17:27   ` Laszlo Ersek
2020-11-12  3:30     ` [edk2-devel] " Jiahui Cen
2020-11-09 13:05 ` [PATCH v2 3/4] OvmfPkg: Extract functions of extra pci roots Jiahui Cen
2020-11-09 13:05 ` [PATCH v2 4/4] ArmVirtPkg: Support " Jiahui Cen
2020-11-11 14:33 ` [PATCH v2 0/4] Add extra pci roots support for Arm Laszlo Ersek
2020-11-12  3:20   ` [edk2-devel] " Jiahui Cen
2020-12-04  6:48   ` Jiahui Cen
2020-12-04 15:08     ` Laszlo Ersek
2020-12-11 10:57     ` Ni, Ray [this message]
2020-12-15 12:52       ` Jiahui Cen
2020-12-17 13:23         ` Laszlo Ersek
2020-12-17 13:37           ` Ard Biesheuvel
2020-12-17 14:42             ` Jonathan Cameron
2020-12-17 13:52           ` Jiahui Cen
2020-11-12  8:49 ` Ard Biesheuvel
2020-11-13 19:44   ` Laszlo Ersek
2020-11-16  1:33     ` [edk2-devel] " Jiahui Cen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CO1PR11MB49309CE7950720C23AF4020F8CCA0@CO1PR11MB4930.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox