From: "Jan Beulich" Subject: Re: [v6][PATCH 5/7] hvmloader: introduce hypercall for xc_reserved_device_memory_map Date: Thu, 11 Sep 2014 16:45:20 +0100 Message-ID: <5411DFB0020000780003408E@mail.emea.novell.com> References: <1410328190-6372-1-git-send-email-tiejun.chen@intel.com> <1410328190-6372-6-git-send-email-tiejun.chen@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1410328190-6372-6-git-send-email-tiejun.chen@intel.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tiejun Chen Cc: kevin.tian@intel.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, yang.z.zhang@intel.com List-Id: xen-devel@lists.xenproject.org >>> On 10.09.14 at 07:49, wrote: > We will introduce that hypercall xc_reserved_device_memory_map > to hvmloader. Title and text: What does a libxc name do here? Also I don't think this warrants a separate patch - introduce the function along with the code needing it. > Signed-off-by: Tiejun Chen > > diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c > index 80d822f..90dbb6e 100644 > --- a/tools/firmware/hvmloader/util.c > +++ b/tools/firmware/hvmloader/util.c > @@ -828,6 +828,28 @@ int hpet_exists(unsigned long hpet_base) > return ((hpet_id >> 16) == 0x8086); > } > > +int get_reserved_device_memory_map(struct xen_mem_reserved_device_memory entries[], > + uint32_t max_entries) > +{ > + static int map_done = 0; > + struct xen_mem_reserved_device_memory_map memmap = { > + .nr_entries = max_entries > + }; > + > + if ( map_done ) > + return 0; > + > + set_xen_guest_handle(memmap.buffer, entries); > + > + if ( hypercall_memory_op(XENMEM_reserved_device_memory_map, > + &memmap) != 0 ) > + BUG(); I don't think there's any harm in not BUG()ing here - just return the error to the caller (and let it assume there are no entries). In the worst case guest startup will subsequently fail (instead of here). > + > + map_done = 1; The map_done variable if completely bogus here, but I think someone else already pointed this out. Jan