|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [RFC PATCH 2/2] plat/rcar: Add region id support for PCI
On 4/21/26 10:57, Mykyta Poturai wrote: Hello Mykyta With Region ID enabled, all CPU memory accesses need to have rgid bits set in the physical address. This creates a problem for PCI BAR accesses, as it would require all BARs to be 64bit. Implement fixup_bar callback to add rgid bits to the address before mapping it to the guests. For context. When Region ID support is enabled, the RGID value is encoded in the upper bits of physical addresses for both RAM and device MMIO in host device tree. From Xen's perspective, these are just regular physical addresses, and ideally Xen should not need to be RGID-aware at all. But I understand what this series is trying to solve. It is worth mentioning that when Region ID support is enabled, there will be no 32-bit addresses in the host device tree anymore, since encoding the RGID effectively moves every address beyond the 4GB boundary (unless the RGID is 0). This might break any code in Xen that relies on 32-bit address space for some reason, e.g. HOST_ITS_WORKAROUND_32BIT_ADDR which requires 32-bit addresses for in-memory data structures (refer gicv3_its_enable_quirk_gen4()).
NIT: MADDR_PA_MASK is defined but never used ...
Options RCAR_RGID and RCAR_PA_BITS lack range constraints. A misconfigured options might cause undefined shift behavior at compile time. However, I see a valid request in a separate email to consider using a firmware table to pass these values, so just ignore this comment. ***** I was wondering whether the RGID could be extracted at runtime from anaddress that already carries it. Do addresses in the host device tree (e.g., device MMIO ranges, host bridge windows, etc) already contain RGID bits? If so, then in rcar4_pcie_fixup_bar() you could obtain the RGID from the bridge instance that is already passed as a parameter. Something like below: #define MADDR_GET_RGID(addr) ((addr) >> CONFIG_RCAR_PA_BITS)paddr_t rgid = MADDR_GET_RGID(bridge->some_hw_addr_as_it_is_specified_in_dt); *addr = (rgid << CONFIG_RCAR_PA_BITS) | (*addr & MADDR_PA_MASK); This would eliminate CONFIG_RCAR_RGID entirely by deducing it from existing platform data rather than requiring it to be passed explicitly via the device tree. As for CONFIG_RCAR_PA_BITS, I think it could remain as-is since it isconstant across an SoC generation, unless I am mistaken. As far as I am aware, on Gen4 the RGID occupies 4 bits (0–15) starting at bit 36, and on Gen5 it occupies 5 bits (0–31) starting at bit 43. Since Xen can identify the hardware it is running on (thanks to the compatible string), the appropriate #define-s could be applied. Would the above approach work, or is it better to pass all these values explicitly? Please note, I am not 100% sure whether this is the right and reliable approach, but it should be considered. F
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |