From: "Jan Beulich" Subject: Re: [RFC][PATCH 3/5] tools:libxc: remove mmio BAR out of RMRR mappings Date: Fri, 08 Aug 2014 16:49:05 +0100 Message-ID: <53E50D91020000780002AB44@mail.emea.novell.com> References: <1407409371-31728-1-git-send-email-tiejun.chen@intel.com> <1407409371-31728-4-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: <1407409371-31728-4-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 07.08.14 at 13:02, wrote: > @@ -300,6 +302,30 @@ static int setup_guest(xc_interface *xch, > goto error_out; > } > > + /* We need to move mmio range out of RMRR mapping. */ > + rc = xc_get_rmrr_map(xch, map, E820MAX); > + if (rc < 0) > + { > + PERROR("Could not get RMRR info on domain"); > + } > + else if ( rc ) > + { > + for ( i = 0; i < rc; i++ ) > + { > + rmrr_end = map[i].addr + map[i].size + 1; > + if ( rmrr_end > mmio_start ) > + { > + mmio_start = rmrr_end; > + } > + } This seems way too simplistic - what if the RMRRs are referring to memory regions extremely far apart? > + mmio_size = (1ull << 32) - mmio_start; Limiting things to 4Gb? > + if ( mmio_size <= 0 ) mmio_size is an unsigned quantity, so this won't do what you intend. Jan