> > --- a/target-arm/kvm.c > > +++ b/target-arm/kvm.c > > @@ -627,3 +627,17 @@ int kvm_arch_msi_data_to_gsi(uint32_t data) { > > return (data - 32) & 0xffff; > > } > > + > > +unsigned long get_guest_max_pfn(void) { > > + /* To be done */ > > + > > + return 0; > > +} > > + > > +unsigned long *tighten_guest_free_page_bmap(unsigned long *bmap) { > > + /* To be done */ > > + > > + return bmap; > > +} > > diff --git a/target-i386/kvm.c b/target-i386/kvm.c index > > abf50e6..0b394cb 100644 > > --- a/target-i386/kvm.c > > +++ b/target-i386/kvm.c > > @@ -3327,3 +3327,38 @@ int kvm_arch_msi_data_to_gsi(uint32_t data) { > > abort(); > > } > > + > > +unsigned long get_guest_max_pfn(void) { > > + PCMachineState *pcms = PC_MACHINE(current_machine); > > + ram_addr_t above_4g_mem = pcms->above_4g_mem_size; > > + unsigned long max_pfn; > > + > > + if (above_4g_mem) { > > + max_pfn = ((1ULL << 32) + above_4g_mem) >> TARGET_PAGE_BITS; > > + } else { > > + max_pfn = pcms->below_4g_mem_size >> TARGET_PAGE_BITS; > > + } > > + > > + return max_pfn; > > +} > > Why is this in kvm?
I can't find a better place. Do you have any suggestion? > > + pos = (above_4g_mem + below_4g_mem) >> TARGET_PAGE_BITS; > > + len = ((1ULL << 32) - below_4g_mem) >> TARGET_PAGE_BITS; > > + bitmap_clear(bmap, pos, len); > > + } > > + > > + return bmap; > > +} > > what does this do? External APIs should have documentation. I will add the documentation. Thanks! Liang