From patchwork Thu Nov 23 18:32:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 119527 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp1172711edl; Thu, 23 Nov 2017 10:33:56 -0800 (PST) X-Google-Smtp-Source: AGs4zMYghF5A6EbE0NHtPxJlRVnP4Znj9OGosPusKQ6OqnvKAWHOZj13kbKRbobUu/DD3vd3o4Ci X-Received: by 10.107.22.71 with SMTP id 68mr20776340iow.150.1511462036321; Thu, 23 Nov 2017 10:33:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511462036; cv=none; d=google.com; s=arc-20160816; b=H02UgaFJ5H6sG20NLrUhog9QthGktNV0QNAvI8chpOhVMmKeHp+4xXLuMo5RKhHv2E 6Y04cFxJ5yzPqgbD00EFrD7pwJpdRR/+gQNltl3IdusaKckZ+52h0aNAgYTFaLjZkvdT xMAJBeGwi0bkEvAl+XKWPiDF6KYsn/qoFy/fwinZlDeN5y5qv/HE0ap5i6Ezc5cthWcY SO7DpCiOunybIMDFQ7d7g5o/NHorVuqFmV9suhy1G3Xq2oTovXlV84WZKVgvTTAAN8uT v+JyKV7Q90TGJKqQVrYqZMbuXlyWVE3Vp+6JDONUs6t9ASkjEOyQx9rb9izv70kXfrGS UHyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=4xAzSnXDpfOfVpOQ6oyKpQH0yo38CWH808cRQGG7apw=; b=fsvI1dKVmdEzTMDciwBZqExPFecOWTuo2cFg791BUgh9vtZjqvTjhnxyMY4YHnG1/W +qRENb6DRVBHtJihYmIsjxY6hEnDcG5+8QTG2e/rPUQ4vmTSgJkMBL25KSpcCiIpeXlF r0PBgKM+3tHeNZsoZmmPwQ04aS1CLi9YEhlpP5Dm8vu6iFRqlDqwfrp8m3bJzHKjd4eM 4Bbr4ShhbEOvBUgWuA13KJ2tUFJkPsrDCgw59uU9WfTehedfv42JWcAHYKOZi88xAYEr nrjBYp8RP0eU9iBlRatNl3eOuSwMRL5Ud7LsJ/VX3rAMlZ5Sykq1sd/p+s0d7mGll7Nv mXWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GbmnqdHB; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id x63si6903412itf.74.2017.11.23.10.33.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Nov 2017 10:33:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GbmnqdHB; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eHwIZ-0005RS-VC; Thu, 23 Nov 2017 18:32:31 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eHwIY-0005Nz-JJ for xen-devel@lists.xen.org; Thu, 23 Nov 2017 18:32:30 +0000 Received: from [193.109.254.147] by server-8.bemta-6.messagelabs.com id F5/ED-27709-E34171A5; Thu, 23 Nov 2017 18:32:30 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsXiVRvkqGsrIh5 lMP0gr8WSj4tZHBg9ju7+zRTAGMWamZeUX5HAmvH2y0v2go+KFQ8nPGduYPwm0cXIxSEkMJFR 4vr146wgDovAPGaJo1O/MIM4EgL9rBLn218CZTiBnDyJJ1+WMEPYaRJbe+dC2ZUSbfs+AtkcQ KPUJNa8iYKY2sck8fNgIytInE1AR2LdjFqQchEBaYlrny8zgtjMAvESj6deZwOxhQVSJdYu2w 5mswioSmy7eRnM5hWwlfi+4go7xCp5iV1tF8HO4QSKHz3wAWqtjcTnz4oTGAUXMDKsYtQoTi0 qSy3SNTLRSyrKTM8oyU3MzNE1NDDTy00tLk5MT81JTCrWS87P3cQIDDcGINjBuO9j5CFGSQ4m JVFemV9iUUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeG8KiUcJCRalpqdWpGXmAAMfJi3BwaMkw rsdJM1bXJCYW5yZDpE6xWjJsW/PrT9MHM9mvm5g5ph2tbWJWYglLz8vVUqcdzNIgwBIQ0ZpHt w4WHReYpSVEuZlBDpQiKcgtSg3swRV/hWjOAejkjDvW5ApPJl5JXBbXwEdxAR00M/jwiAHlSQ ipKQaGCNudc+vzjLKOscW8Onl0ss+h8ols1SZIqymrGCpuSec/Tise9aprX9lv8SsNy2fPW15 9Fv/BQZt1w0Uu3cGW1+oepXr8kKKbYHivgWsr8rEdZ5+j5tlWi+y54Ee6/4NO9u8W6L1ZzltM v/8mVdsvYZPVcGnmwfPKGgdWpJooHro77RDm6497FZiKc5INNRiLipOBACtHwYfyQIAAA== X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-16.tower-27.messagelabs.com!1511461949!117542641!1 X-Originating-IP: [74.125.82.65] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 17747 invoked from network); 23 Nov 2017 18:32:29 -0000 Received: from mail-wm0-f65.google.com (HELO mail-wm0-f65.google.com) (74.125.82.65) by server-16.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 23 Nov 2017 18:32:29 -0000 Received: by mail-wm0-f65.google.com with SMTP id r68so18457122wmr.1 for ; Thu, 23 Nov 2017 10:32:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=p7mIpd+LKbbnz3Q6Ip8QWRoPh1RWI6NlPgc/wD0uX6c=; b=GbmnqdHBV34f+GsJNdWxaJcDOubRUh2OuW5FENEKP8Jop7POijilUeQz5WyrGBT+DW z6YQVRW4t5A/UD653AdTnEJ8iMrSYHS+4VCFgMYRbKxyycXpm57xzCNlDROH3WS3hinz rVlVZIg0Ntvijm/knijCsTgNXkbIBgs7+Bp4s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=p7mIpd+LKbbnz3Q6Ip8QWRoPh1RWI6NlPgc/wD0uX6c=; b=Vy8wps1tZr3J4Vb9U8uiCsx/WGi4jsMAoQcJF0J8XWpB658LBP2Aai54wt7vrtfEv3 q0g05RZTXXWcB3mG7/ypVBQVlSmWa7xAClh5i5rLaJy6tWoPlDyiyjfwRBjTF6TX9dCG UDszyHxTmYe2qh/tkfmSbQH+Cmtq+5fxtdUwXQ9ugX2iMGEfnuAkwIQZiRjlKdyd9vmE qRytwLSD7APqL/PqG7XObraWYTWiIubFvOuTgIArxLNbacGTjwcfreH0Kt1r7YiIOq9F 79FHSodJcS0/EdFrOF+OfA1wWQtM0913WA38q8veryJhNRVFmra6TMWScuUx+1+ht2k5 3t0Q== X-Gm-Message-State: AJaThX5SWhCZrKpy7pH27Q+uCmKbpzZrP4L+HQV5SXhMEDMh3VNYp4El 19Cs2URCWi+AArbao8VG5tJd5Nb0Sf4= X-Received: by 10.28.27.206 with SMTP id b197mr7580768wmb.96.1511461948624; Thu, 23 Nov 2017 10:32:28 -0800 (PST) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id n32sm41412950wrb.62.2017.11.23.10.32.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Nov 2017 10:32:28 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 23 Nov 2017 18:32:09 +0000 Message-Id: <20171123183210.12045-16-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171123183210.12045-1-julien.grall@linaro.org> References: <20171123183210.12045-1-julien.grall@linaro.org> Cc: sstabellini@kernel.org, Julien Grall , andre.przywara@linaro.org Subject: [Xen-devel] [PATCH for-next 15/16] xen/arm: traps: Move the definition of mmio_info_t in try_handle_mmio X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" mmio_info_t is currently filled by do_trap_data_guest_abort but only important when emulation an MMIO region. A follow-up patch will merge stage-2 prefetch abort and stage-2 data abort in a single helper. To prepare that, mmio_info_t is now filled by try_handle_mmio. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- xen/arch/arm/traps.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index e30dd9b7e2..a68e01b457 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1936,9 +1936,14 @@ static void do_trap_instr_abort_guest(struct cpu_user_regs *regs, } static bool try_handle_mmio(struct cpu_user_regs *regs, - mmio_info_t *info) + const union hsr hsr, + paddr_t gpa) { - const struct hsr_dabt dabt = info->dabt; + const struct hsr_dabt dabt = hsr.dabt; + mmio_info_t info = { + .gpa = gpa, + .dabt = dabt + }; int rc; /* stage-1 page table should never live in an emulated MMIO region */ @@ -1956,7 +1961,7 @@ static bool try_handle_mmio(struct cpu_user_regs *regs, if ( check_workaround_766422() && (regs->cpsr & PSR_THUMB) && dabt.write ) { - rc = decode_instruction(regs, &info->dabt); + rc = decode_instruction(regs, &info.dabt); if ( rc ) { gprintk(XENLOG_DEBUG, "Unable to decode instruction\n"); @@ -1964,7 +1969,7 @@ static bool try_handle_mmio(struct cpu_user_regs *regs, } } - return !!handle_mmio(info); + return !!handle_mmio(&info); } /* @@ -2002,7 +2007,7 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, const struct hsr_dabt dabt = hsr.dabt; int rc; vaddr_t gva; - mmio_info_t info; + paddr_t gpa; uint8_t fsc = hsr.dabt.dfsc & ~FSC_LL_MASK; mfn_t mfn; @@ -2013,15 +2018,13 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, if ( dabt.eat ) return __do_trap_serror(regs, true); - info.dabt = dabt; - gva = get_hfar(true /* is_data */); if ( hpfar_is_valid(dabt.s1ptw, fsc) ) - info.gpa = get_faulting_ipa(gva); + gpa = get_faulting_ipa(gva); else { - rc = gva_to_ipa(gva, &info.gpa, GV2M_READ); + rc = gva_to_ipa(gva, &gpa, GV2M_READ); /* * We may not be able to translate because someone is * playing with the Stage-2 page table of the domain. @@ -2042,7 +2045,7 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, .kind = dabt.s1ptw ? npfec_kind_in_gpt : npfec_kind_with_gla }; - p2m_mem_access_check(info.gpa, gva, npfec); + p2m_mem_access_check(gpa, gva, npfec); /* * The only way to get here right now is because of mem_access, * thus reinjecting the exception to the guest is never required. @@ -2054,7 +2057,7 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, * Attempt first to emulate the MMIO as the data abort will * likely happen in an emulated region. */ - if ( try_handle_mmio(regs, &info) ) + if ( try_handle_mmio(regs, hsr, gpa) ) { advance_pc(regs, hsr); return; @@ -2065,11 +2068,11 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, * with the Stage-2 page table. Walk the Stage-2 PT to check * if the entry exists. If it's the case, return to the guest */ - mfn = gfn_to_mfn(current->domain, gaddr_to_gfn(info.gpa)); + mfn = gfn_to_mfn(current->domain, gaddr_to_gfn(gpa)); if ( !mfn_eq(mfn, INVALID_MFN) ) return; - if ( try_map_mmio(gaddr_to_gfn(info.gpa)) ) + if ( try_map_mmio(gaddr_to_gfn(gpa)) ) return; break; @@ -2079,7 +2082,7 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, } gdprintk(XENLOG_DEBUG, "HSR=0x%x pc=%#"PRIregister" gva=%#"PRIvaddr - " gpa=%#"PRIpaddr"\n", hsr.bits, regs->pc, gva, info.gpa); + " gpa=%#"PRIpaddr"\n", hsr.bits, regs->pc, gva, gpa); inject_dabt_exception(regs, gva, hsr.len); }