From patchwork Fri Jan 31 16:43:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11360277 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D509D1395 for ; Fri, 31 Jan 2020 16:44:12 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BB157206F0 for ; Fri, 31 Jan 2020 16:44:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB157206F0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ixZO9-0008ID-KX; Fri, 31 Jan 2020 16:43:25 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ixZO7-0008Hz-Mx for xen-devel@lists.xenproject.org; Fri, 31 Jan 2020 16:43:23 +0000 X-Inumbo-ID: cb343e6c-4448-11ea-b211-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id cb343e6c-4448-11ea-b211-bc764e2007e4; Fri, 31 Jan 2020 16:43:23 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 523F6AD3C; Fri, 31 Jan 2020 16:43:22 +0000 (UTC) From: Jan Beulich To: "xen-devel@lists.xenproject.org" References: Message-ID: <90e7ed4e-aff5-1b0b-e3a8-fbb4c058a7d1@suse.com> Date: Fri, 31 Jan 2020 17:43:25 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Subject: [Xen-devel] [PATCH v4 3/7] x86/HVM: introduce "curr" into hvmemul_rep_{mov, sto}s() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: George Dunlap , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Paul Durrant Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" There are a number of uses of "current" already, and more may appear down the road. Latch into a local variable. At this occasion also drop stray casts from code getting touched anyway. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper Reviewed-by: Paul Durrant --- v4: New. --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -1747,7 +1747,8 @@ static int hvmemul_rep_movs( { struct hvm_emulate_ctxt *hvmemul_ctxt = container_of(ctxt, struct hvm_emulate_ctxt, ctxt); - struct hvm_vcpu_io *vio = ¤t->arch.hvm.hvm_io; + struct vcpu *curr = current; + struct hvm_vcpu_io *vio = &curr->arch.hvm.hvm_io; unsigned long saddr, daddr, bytes; paddr_t sgpa, dgpa; uint32_t pfec = PFEC_page_present; @@ -1807,8 +1808,8 @@ static int hvmemul_rep_movs( } /* Check for MMIO ops */ - (void) get_gfn_query_unlocked(current->domain, sgpa >> PAGE_SHIFT, &sp2mt); - (void) get_gfn_query_unlocked(current->domain, dgpa >> PAGE_SHIFT, &dp2mt); + get_gfn_query_unlocked(curr->domain, sgpa >> PAGE_SHIFT, &sp2mt); + get_gfn_query_unlocked(curr->domain, dgpa >> PAGE_SHIFT, &dp2mt); if ( sp2mt == p2m_mmio_direct || dp2mt == p2m_mmio_direct || (sp2mt == p2m_mmio_dm && dp2mt == p2m_mmio_dm) ) @@ -1873,7 +1874,7 @@ static int hvmemul_rep_movs( rc = hvm_copy_from_guest_phys(buf, sgpa, bytes); if ( rc == HVMTRANS_okay ) - rc = hvm_copy_to_guest_phys(dgpa, buf, bytes, current); + rc = hvm_copy_to_guest_phys(dgpa, buf, bytes, curr); xfree(buf); @@ -1910,7 +1911,8 @@ static int hvmemul_rep_stos( { struct hvm_emulate_ctxt *hvmemul_ctxt = container_of(ctxt, struct hvm_emulate_ctxt, ctxt); - struct hvm_vcpu_io *vio = ¤t->arch.hvm.hvm_io; + struct vcpu *curr = current; + struct hvm_vcpu_io *vio = &curr->arch.hvm.hvm_io; unsigned long addr, bytes; paddr_t gpa; p2m_type_t p2mt; @@ -1943,7 +1945,7 @@ static int hvmemul_rep_stos( } /* Check for MMIO op */ - (void)get_gfn_query_unlocked(current->domain, gpa >> PAGE_SHIFT, &p2mt); + get_gfn_query_unlocked(curr->domain, gpa >> PAGE_SHIFT, &p2mt); switch ( p2mt ) { @@ -1992,7 +1994,7 @@ static int hvmemul_rep_stos( if ( df ) gpa -= bytes - bytes_per_rep; - rc = hvm_copy_to_guest_phys(gpa, buf, bytes, current); + rc = hvm_copy_to_guest_phys(gpa, buf, bytes, curr); if ( buf != p_data ) xfree(buf);