> -----Original Message----- > From: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx> > Sent: Tuesday, June 11, 2024 1:44 PM > To: Michael Kelley <mhklinux@xxxxxxxxxxx>; linux-hyperv@xxxxxxxxxxxxxxx; > netdev@xxxxxxxxxxxxxxx; Paul Rosswurm <paulros@xxxxxxxxxxxxx> > Cc: Dexuan Cui <decui@xxxxxxxxxxxxx>; stephen@xxxxxxxxxxxxxxxxxx; KY > Srinivasan <kys@xxxxxxxxxxxxx>; olaf@xxxxxxxxx; vkuznets > <vkuznets@xxxxxxxxxx>; davem@xxxxxxxxxxxxx; wei.liu@xxxxxxxxxx; > edumazet@xxxxxxxxxx; kuba@xxxxxxxxxx; pabeni@xxxxxxxxxx; leon@xxxxxxxxxx; > Long Li <longli@xxxxxxxxxxxxx>; ssengar@xxxxxxxxxxxxxxxxxxx; linux- > rdma@xxxxxxxxxxxxxxx; daniel@xxxxxxxxxxxxx; john.fastabend@xxxxxxxxx; > bpf@xxxxxxxxxxxxxxx; ast@xxxxxxxxxx; hawk@xxxxxxxxxx; tglx@xxxxxxxxxxxxx; > shradhagupta@xxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx > Subject: RE: [PATCH net-next] net: mana: Add support for variable page > sizes of ARM64 > > > @@ -183,7 +184,7 @@ int mana_smc_setup_hwc(struct shm_channel *sc, > bool > > > reset_vf, u64 eq_addr, > > > > > > /* EQ addr: low 48 bits of frame address */ > > > shmem = (u64 *)ptr; > > > - frame_addr = PHYS_PFN(eq_addr); > > > + frame_addr = MANA_PFN(eq_addr); > > > *shmem = frame_addr & PAGE_FRAME_L48_MASK; > > > all_addr_h4bits |= (frame_addr >> PAGE_FRAME_L48_WIDTH_BITS) << > > > (frame_addr_seq++ * PAGE_FRAME_H4_WIDTH_BITS); > > > > In mana_smc_setup_hwc() a few lines above this change, code using > > PAGE_ALIGNED() is unchanged. Is it correct that the eq/cq/rq/sq > > addresses > > must be aligned to 64K if PAGE_SIZE is 64K? > > Since we still using PHYS_PFN on them, if not aligned to PAGE_SIZE, > the lower bits may be lost. (You said the same below.) > > > > > Related, I wonder about how MANA_PFN() is defined. If PAGE_SIZE is 64K, > > MANA_PFN() will first right-shift 16, then left shift 4. The net is > > right-shift 12, > > corresponding to the 4K chunks that MANA expects. But that approach > > guarantees > > that the rightmost 4 bits of the MANA PFN will always be zero. That's > > consistent > > with requiring the addresses to be PAGE_ALIGNED() to 64K, but I'm > unclear > > whether > > that is really the requirement. You might compare with the definition > of > > HVPFN_DOWN(), which has a similar goal for Linux guests communicating > > with > > Hyper-V. > > @Paul Rosswurm You said MANA HW has "no page concept". So the > "frame_addr" > In the mana_smc_setup_hwc() is NOT related to physical page number, > correct? > Can we just use phys_adr >> 12 like below? > > #define MANA_MIN_QSHIFT 12 > #define MANA_PFN(a) ((a) >> MANA_MIN_QSHIFT) > > /* EQ addr: low 48 bits of frame address */ > shmem = (u64 *)ptr; > - frame_addr = PHYS_PFN(eq_addr); > + frame_addr = MANA_PFN(eq_addr); > I just confirmed with Paul, we can use phys_adr >> 12. And I will change the alignment requirements to be 4k. Thanks, - Haiyang