On Thu, Jan 20, 2022 at 09:01:55AM +0100, Klaus Jensen wrote: > +static inline bool nvme_addr_is_iomem(NvmeCtrl *n, hwaddr addr) > +{ > + hwaddr hi, lo; > + > + lo = n->bar0.addr; > + hi = lo + int128_get64(n->bar0.size); > + > + return addr >= lo && addr < hi;
Looks fine considering this implementation always puts CMB in an exclusive BAR. From a spec consideration though, you can put a CMB at a BAR0 offset. I don't think that's going to happen anytime soon here, but may be worth a comment to notify this function needs to be updated if that assumption ever changes. Reviewed-by: Keith Busch <kbu...@kernel.org>