xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Wei Liu <wei.liu2@citrix.com>
Subject: [PATCH qemu-trad] Remove all use of xc_{get, set}_hvm_param()
Date: Wed, 31 May 2017 18:47:42 +0100	[thread overview]
Message-ID: <1496252862-14291-1-git-send-email-andrew.cooper3@citrix.com> (raw)

xc_{get,set}_hvm_param() are problematic because they truncate their values in
a 32bit build.

Luckily, this isn't a problem in practice because all values in question
should be below 2^32.

To expediate the removal of xc_{get,set}_hvm_param() from libxc, switch
qemu-trad over to using xc_hvm_param_{get,set}() which don't suffer from
truncation issues.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
 hw/pc.c             |  4 ++--
 hw/piix4acpi.c      |  2 +-
 hw/xen_machine_fv.c | 10 +++++-----
 i386-dm/helper2.c   |  4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index 09b4af4..572c72b 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -573,7 +573,7 @@ static void load_linux(uint8_t *option_rom,
     uint16_t seg[6];
     uint16_t real_seg;
     int setup_size, kernel_size, initrd_size, cmdline_size;
-    unsigned long end_low_ram;
+    uint64_t end_low_ram;
     uint32_t initrd_max;
     uint8_t header[1024];
     target_phys_addr_t real_addr, prot_addr, cmdline_addr, initrd_addr;
@@ -629,7 +629,7 @@ static void load_linux(uint8_t *option_rom,
 
     /* Special pages are placed at end of low RAM: pick an arbitrary one and
      * subtract a suitably large amount of padding (64kB) to skip BIOS data. */
-    xc_get_hvm_param(xc_handle, domid, HVM_PARAM_BUFIOREQ_PFN, &end_low_ram);
+    xc_hvm_param_get(xc_handle, domid, HVM_PARAM_BUFIOREQ_PFN, &end_low_ram);
     end_low_ram = (end_low_ram << 12) - (64*1024);
 
     /* highest address for loading the initrd */
diff --git a/hw/piix4acpi.c b/hw/piix4acpi.c
index ddbe8e0..1471c56 100644
--- a/hw/piix4acpi.c
+++ b/hw/piix4acpi.c
@@ -206,7 +206,7 @@ static void acpi_shutdown(uint32_t val)
         qemu_system_reset();
         s3_shutdown_flag = 0;
         cmos_set_s3_resume();
-        xc_set_hvm_param(xc_handle, domid, HVM_PARAM_ACPI_S_STATE, 3);
+        xc_hvm_param_set(xc_handle, domid, HVM_PARAM_ACPI_S_STATE, 3);
         break;
     case SLP_TYP_S4_V0:
     case SLP_TYP_S5_V0:
diff --git a/hw/xen_machine_fv.c b/hw/xen_machine_fv.c
index b385d6a..c21f275 100644
--- a/hw/xen_machine_fv.c
+++ b/hw/xen_machine_fv.c
@@ -277,7 +277,7 @@ static void xen_init_fv(ram_addr_t ram_size, int vga_ram_size,
                         const char *initrd_filename, const char *cpu_model,
                         const char *direct_pci)
 {
-    unsigned long ioreq_pfn;
+    uint64_t ioreq_pfn;
     extern void *shared_page;
     extern void *buffered_io_page;
 #ifdef __ia64__
@@ -296,9 +296,9 @@ static void xen_init_fv(ram_addr_t ram_size, int vga_ram_size,
 #endif
 
 #ifdef CONFIG_STUBDOM /* the hvmop is not supported on older hypervisors */
-    xc_set_hvm_param(xc_handle, domid, HVM_PARAM_DM_DOMAIN, DOMID_SELF);
+    xc_hvm_param_set(xc_handle, domid, HVM_PARAM_DM_DOMAIN, DOMID_SELF);
 #endif
-    xc_get_hvm_param(xc_handle, domid, HVM_PARAM_IOREQ_PFN, &ioreq_pfn);
+    xc_hvm_param_get(xc_handle, domid, HVM_PARAM_IOREQ_PFN, &ioreq_pfn);
     fprintf(logfile, "shared page at pfn %lx\n", ioreq_pfn);
     shared_page = xc_map_foreign_range(xc_handle, domid, XC_PAGE_SIZE,
                                        PROT_READ|PROT_WRITE, ioreq_pfn);
@@ -307,7 +307,7 @@ static void xen_init_fv(ram_addr_t ram_size, int vga_ram_size,
         exit(-1);
     }
 
-    xc_get_hvm_param(xc_handle, domid, HVM_PARAM_BUFIOREQ_PFN, &ioreq_pfn);
+    xc_hvm_param_get(xc_handle, domid, HVM_PARAM_BUFIOREQ_PFN, &ioreq_pfn);
     fprintf(logfile, "buffered io page at pfn %lx\n", ioreq_pfn);
     buffered_io_page = xc_map_foreign_range(xc_handle, domid, XC_PAGE_SIZE,
                                             PROT_READ|PROT_WRITE, ioreq_pfn);
@@ -317,7 +317,7 @@ static void xen_init_fv(ram_addr_t ram_size, int vga_ram_size,
     }
 
 #if defined(__ia64__)
-    xc_get_hvm_param(xc_handle, domid, HVM_PARAM_BUFPIOREQ_PFN, &ioreq_pfn);
+    xc_hvm_param_get(xc_handle, domid, HVM_PARAM_BUFPIOREQ_PFN, &ioreq_pfn);
     fprintf(logfile, "buffered pio page at pfn %lx\n", ioreq_pfn);
     buffered_pio_page = xc_map_foreign_range(xc_handle, domid, XC_PAGE_SIZE,
 					     PROT_READ|PROT_WRITE, ioreq_pfn);
diff --git a/i386-dm/helper2.c b/i386-dm/helper2.c
index 78093fe..c5bcf68 100644
--- a/i386-dm/helper2.c
+++ b/i386-dm/helper2.c
@@ -120,7 +120,7 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
     CPUX86State *env;
     static int inited;
     int i, rc;
-    unsigned long bufioreq_evtchn;
+    uint64_t bufioreq_evtchn;
 
     env = qemu_mallocz(sizeof(CPUX86State));
     if (!env)
@@ -158,7 +158,7 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
             }
             ioreq_local_port[i] = rc;
         }
-        rc = xc_get_hvm_param(xc_handle, domid, HVM_PARAM_BUFIOREQ_EVTCHN,
+        rc = xc_hvm_param_get(xc_handle, domid, HVM_PARAM_BUFIOREQ_EVTCHN,
                 &bufioreq_evtchn);
         if (rc < 0) {
             fprintf(logfile, "failed to get HVM_PARAM_BUFIOREQ_EVTCHN error=%d\n",
-- 
2.1.4


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

             reply	other threads:[~2017-05-31 17:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31 17:47 Andrew Cooper [this message]
2017-05-31 17:57 ` [PATCH qemu-trad] Remove all use of xc_{get, set}_hvm_param() Juergen Gross
2017-05-31 17:58   ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1496252862-14291-1-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).