From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xa7Ps-0003ST-Hk for qemu-devel@nongnu.org; Fri, 03 Oct 2014 14:17:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xa7Pm-0003Av-FQ for qemu-devel@nongnu.org; Fri, 03 Oct 2014 14:17:20 -0400 Received: from omzsmtpe04.verizonbusiness.com ([199.249.25.207]:23334) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xa7Pm-0003Ao-8K for qemu-devel@nongnu.org; Fri, 03 Oct 2014 14:17:14 -0400 From: Don Slutz Message-ID: <542EE827.2040506@terremark.com> Date: Fri, 03 Oct 2014 14:17:11 -0400 MIME-Version: 1.0 References: <1412275867-6689-1-git-send-email-dslutz@verizon.com> <1412275867-6689-2-git-send-email-dslutz@verizon.com> <542EA558.3010108@terremark.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 1/1] xen-hvm.c: Add support for Xen access to vmport List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefano Stabellini Cc: xen-devel@lists.xensource.com, Marcel Apfelbaum , Markus Armbruster , "Michael S. Tsirkin" , qemu-devel@nongnu.org, Don Slutz , Alexander Graf , Anthony Liguori , =?ISO-8859-1?Q?Andreas_F=E4rber?= On 10/03/14 12:23, Stefano Stabellini wrote: > On Fri, 3 Oct 2014, Don Slutz wrote: >> On 10/03/14 05:52, Stefano Stabellini wrote: >>> On Thu, 2 Oct 2014, Don Slutz wrote: >>>> This adds synchronisation of the 6 vcpu registers (only 32bits of >>>> them) that vmport.c needs between Xen and QEMU. >>>> ... >>>> } >>>> -static void handle_ioreq(ioreq_t *req) >>>> +static void regs_to_cpu(XenIOState *state, vmware_ioreq_t *vmport_req) >>>> +{ >>>> + X86CPU *cpu; >>>> + CPUX86State *env; >>>> + >>>> + if (!state->cpu_by_ioreq_id[0]) { >>>> + CPUState *cpu_state; >>>> + >>>> + CPU_FOREACH(cpu_state) { >>>> + state->cpu_by_ioreq_id[cpu_state->cpu_index] = cpu_state; >>>> + } >>>> + } >>> This is just the initialization, isn't it? >>> It would be best to move it to an initialization function then. >>> >> A new initialization function would need to be added. A new call to it would >> need >> to be added (not sure where the best place is). Since the overhead here is >> small I went with the less intrusive change. > I'd prefer the initialization function if it is possible. > > > Ok, how does: @@ -1023,6 +1028,11 @@ static void xen_main_loop_prepare(XenIOState *state) state); if (evtchn_fd != -1) { + CPUState *cpu_state; + + CPU_FOREACH(cpu_state) { + state->cpu_by_ioreq_id[cpu_state->cpu_index] = cpu_state; + } qemu_set_fd_handler(evtchn_fd, cpu_handle_ioreq, NULL, state); } } Look? -Don Slutz