On 23 April 2018 at 13:10, Auger Eric <eric.au...@redhat.com> wrote: > Hi Peter, > > On 04/16/2018 02:59 PM, Peter Maydell wrote: >> On 12 April 2018 at 08:37, Eric Auger <eric.au...@redhat.com> wrote:
>>> +/** >>> + * TODO: handle the case where the level resolves less than >>> + * granule_sz -3 IA bits. >>> + */ >>> +static inline >>> +uint64_t iova_level_offset(uint64_t iova, int level, int granule_sz) >>> +{ >>> + return (iova >> level_shift(level, granule_sz)) & >>> + MAKE_64BIT_MASK(0, granule_sz - 3); >>> +} >>> + >>> +#endif >> >> When does the TODO case happen, and what goes wrong? > Sorry for the delay [back to the office]. > > This refers to > D4.2 of ARM ARM , Effect of granule size on translation table addressing > and indexing/ Reduced IA width. > > " > Depending on the configuration and implementation choices, the required > input address width for the initial level of lookup might be smaller > than the number of address bits that can be resolved at that level" > > For instance with 4k granule and IA limited to 35 bit, we use a 9-bit > mask here and initial level 1 offset is based on IA[30, 38] although IA > is limited to 35. Hmm. We do get this right for the table walk code in target/arm/helper.c, so it would be kind of nice to get it right here too. thanks -- PMM