From: "Jan Beulich" Subject: Re: [v5][PATCH 03/10] xen:x86: define a new hypercall to get RMRR mappings Date: Mon, 01 Sep 2014 11:29:28 +0100 Message-ID: <540466A8020000780002F656@mail.emea.novell.com> References: <1409050980-21933-1-git-send-email-tiejun.chen@intel.com> <1409050980-21933-4-git-send-email-tiejun.chen@intel.com> <53FC774D.8000501@citrix.com> <53FC9BB1020000780002D986@mail.emea.novell.com> <53FD3669.3070705@intel.com> <53FD9C03020000780002DEFF@mail.emea.novell.com> <53FD86E9.4020205@intel.com> <53FE92C6.6050605@intel.com> <53FEED4F020000780002E76C@mail.emea.novell.com> <53FED5AF.7080803@intel.com> <53FED802.7080707@intel.com> <53FEF9F8020000780002E7E2@mail.emea.novell.com> <53FFED5D.7040406@intel.com> <54006196020000780002EFC6@mail.emea.novell.com> <54043FEA.6080100@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <54043FEA.6080100@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, Andrew Cooper , ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, yang.z.zhang@intel.com List-Id: xen-devel@lists.xenproject.org >>> On 01.09.14 at 11:44, wrote: > On 2014/8/29 17:18, Jan Beulich wrote: >> >> This still allocates another instance of structures to create a second >> linked list. Did you consider get_device_reserved_memory() to take > > Do you mean we still use this existing type combo, acpi_rmrr_units and > acpi_rmrr_units? > >> a callback function instead? >> > > But we should do something like this, > > 1. .get_device_reserved_memory = get_drm_all, > 2. static int get_drm_all(struct list_head *dev_reserved_memory) > { > return (get_drm_callback(dev_reserved_memory)); > } > > 3. get_drm_callback = get_device_acpi_reserved_memory; > 4. static int get_device_acpi_reserved_memory(struct list_head > *dev_reserved_memory) > { > ... > dev_reserved_memory = &acpi_rmrr_units; > ... > } > > Then while calling the hypercall, > > struct list_head *dev_reserved_memory = NULL; > nr_entries = ops->get_device_reserved_memory(dev_reserved_memory); > if (!nr_entries) > list_for_each_entry( darm, dev_reserved_memory, list ) > { > xxx.start_pfn = ...; > xxx.nr_pages = ...; > if ( copy_to_guest_offset(buffer, i, &xxx, 1) ) > ... > } Clearly not: The callback ought to be used _while_ processing the hypercall. And of course the callback shouldn't be used to retrieve &acpi_rmrr_units, but to report back to the calling entity the individual regions. Jan