[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] hvmloader / qemu-xen: Getting rid of resource conflict for OpRegion.



Switch to a new address that can reach to Jean.

On Thu, Dec 20, 2012 at 11:52 AM, G.R. <firemeteor@xxxxxxxxxxxxxxxxxxxxx> wrote:
> This is hvmloader part of the change that gets rid of the resource
> conflict warning in the guest kernel.
> The OpRegion may not always be page aligned.
> As a result one extra page is required to fully accommodate the
> OpRegion in that case.
> Just reserve one more page here.
>
> Signed-off-by: Timothy Guo <firemeteor@xxxxxxxxxxxxxxxxxxxxx>
>
> diff -r 11b4bc743b1f tools/firmware/hvmloader/e820.c
> --- a/tools/firmware/hvmloader/e820.c    Mon Dec 17 14:59:11 2012 +0000
> +++ b/tools/firmware/hvmloader/e820.c    Thu Dec 20 00:07:40 2012 +0800
> @@ -142,11 +142,11 @@ int build_e820_table(struct e820entry *e
>          nr++;
>
>          e820[nr].addr = igd_opregion_base;
> -        e820[nr].size = 2 * PAGE_SIZE;
> +        e820[nr].size = 3 * PAGE_SIZE;
>          e820[nr].type = E820_NVS;
>          nr++;
>
> -        e820[nr].addr = igd_opregion_base + 2 * PAGE_SIZE;
> +        e820[nr].addr = igd_opregion_base + 3 * PAGE_SIZE;
>          e820[nr].size = (uint32_t)-e820[nr].addr;
>          e820[nr].type = E820_RESERVED;
>          nr++;
> diff -r 11b4bc743b1f tools/firmware/hvmloader/pci.c
> --- a/tools/firmware/hvmloader/pci.c    Mon Dec 17 14:59:11 2012 +0000
> +++ b/tools/firmware/hvmloader/pci.c    Thu Dec 20 00:07:40 2012 +0800
> @@ -98,7 +98,7 @@ void pci_setup(void)
>                  virtual_vga = VGA_pt;
>                  if ( vendor_id == 0x8086 )
>                  {
> -                    igd_opregion_pgbase = mem_hole_alloc(2);
> +                    igd_opregion_pgbase = mem_hole_alloc(3);
>                      /*
>                       * Write the the OpRegion offset to give the opregion
>                       * address to the device model. The device model will 
> trap
>
>
> This is qemu-xen part of the change that gets rid of the resource
> conflict warning in the guest kernel.
> If the host OpRegion is page aligned, two pages will be sufficient.
> Otherwise, we need to map one more page to have it fully accommodated
> -- the guest kernel would map this extra page and complain about
> resource conflict.
>
> Signed-off-by: Timothy Guo <firemeteor@xxxxxxxxxxxxxxxxxxxxx>
>
> diff --git a/hw/pt-graphics.c b/hw/pt-graphics.c
> index c6f8869..3f2b285 100644
> --- a/hw/pt-graphics.c
> +++ b/hw/pt-graphics.c
> @@ -81,6 +81,7 @@ uint32_t igd_read_opregion(struct pt_dev *pci_dev)
>  void igd_write_opregion(struct pt_dev *real_dev, uint32_t val)
>  {
>      uint32_t host_opregion = 0;
> +    uint32_t map_size = 2;
>      int ret;
>
>      if ( igd_guest_opregion )
> @@ -74,11 +93,13 @@ void igd_write_opregion(struct pt_dev *real_dev,
> uint32_t val)
>      host_opregion = pt_pci_host_read(real_dev->pci_dev, PCI_INTEL_OPREGION, 
> 4);
>      igd_guest_opregion = (val & ~0xfff) | (host_opregion & 0xfff);
>      PT_LOG("Map OpRegion: %x -> %x\n", host_opregion, igd_guest_opregion);
> +    //If the opregion is not page-aligned, map one more page to fit
> the entire region.
> +    map_size += (host_opregion & 0xfff) != 0;
>
>      ret = xc_domain_memory_mapping(xc_handle, domid,
>              igd_guest_opregion >> XC_PAGE_SHIFT,
>              host_opregion >> XC_PAGE_SHIFT,
> -            2,
> +            map_size,
>              DPCI_ADD_MAPPING);
>
>      if ( ret != 0 )

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.