From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Chen, Tiejun" Subject: Re: [v6][PATCH 5/7] hvmloader: introduce hypercall for xc_reserved_device_memory_map Date: Fri, 12 Sep 2014 12:52:57 +0800 Message-ID: <54127C29.8050808@intel.com> References: <1410328190-6372-1-git-send-email-tiejun.chen@intel.com> <1410328190-6372-6-git-send-email-tiejun.chen@intel.com> <5411DFB0020000780003408E@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5411DFB0020000780003408E@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich 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 2014/9/11 23:45, Jan Beulich wrote: >>>> 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? I need to rename this. > > Also I don't think this warrants a separate patch - introduce the > function along with the code needing it. I will squash the following patch into this. > >> 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). Okay so just return rc. > >> + >> + map_done = 1; > > The map_done variable if completely bogus here, but I think > someone else already pointed this out. > Yes. I will remove this. Thanks Tiejun